Core: Critical errors when wifi deactivated on freebox component

Created on 9 Aug 2020  路  17Comments  路  Source: home-assistant/core

The problem


I don't use the builtin wifi capabilities of my freebox so I'm getting those errors that are filling up my logs:

Update for switch.freebox_wifi fails                                                                                                                                                                                                                                                        
Traceback (most recent call last):                                                                                                                                                                                                                                                          
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 272, in async_update_ha_state                                                                                                                                                                                         
    await self.async_device_update()                                                                                                                                                                                                                                                        
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 463, in async_device_update                                                                                                                                                                                           
    await self.async_update()  # type: ignore                                                                                                                                                                                                                                               
  File "/usr/src/homeassistant/homeassistant/components/freebox/switch.py", line 75, in async_update                                                                                                                                                                                        
    datas = await self._router.wifi.get_global_config()                                                                                                                                                                                                                                     
  File "/usr/src/homeassistant/homeassistant/components/freebox/router.py", line 186, in wifi                                                                                                                                                                                               
    return self._api.wifi                                                                                                                                                                                                                                                                   
AttributeError: 'NoneType' object has no attribute 'wifi'

Environment

  • Home Assistant Core release with the issue: 0.113.3
  • Last working Home Assistant Core release (if known): n/a
  • Operating environment (OS/Container/Supervised/Core): Docker
  • Integration causing this issue: freebox
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/freebox/

Problem-relevant configuration.yaml

n/a

Traceback/Error logs

Update for switch.freebox_wifi fails                                                                                                                                                                                                                                                        
Traceback (most recent call last):                                                                                                                                                                                                                                                          
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 272, in async_update_ha_state                                                                                                                                                                                         
    await self.async_device_update()                                                                                                                                                                                                                                                        
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 463, in async_device_update                                                                                                                                                                                           
    await self.async_update()  # type: ignore                                                                                                                                                                                                                                               
  File "/usr/src/homeassistant/homeassistant/components/freebox/switch.py", line 75, in async_update                                                                                                                                                                                        
    datas = await self._router.wifi.get_global_config()                                                                                                                                                                                                                                     
  File "/usr/src/homeassistant/homeassistant/components/freebox/router.py", line 186, in wifi                                                                                                                                                                                               
    return self._api.wifi                                                                                                                                                                                                                                                                   
AttributeError: 'NoneType' object has no attribute 'wifi'

Additional information

freebox

Most helpful comment

Could not reproduce the error.

  • With Wi-Fi disabled i have no errors.
  • Tried to shutdown Wi-Fi and reboot HA while Wi-Fi off still no error.
  • Last thing i must try is to setup a new HA and associate Freebox with Wi-Fi disabled. Maybe the error comes from setting up integration with Wi-Fi disabled. => Will try and report ASAP !

All 17 comments

Hey there @snoof85, @quentame, mind taking a look at this issue as its been labeled with an integration (freebox) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@Quentame should we fix this in the aiofreepybox lib ?

@Quentame should we fix this in the aiofreepybox lib ?

Emmmm, don't think so.

Checking this week.

@Quentame should we fix this in the aiofreepybox lib ?

Not needed, it's on HA side, thanks 馃槈

Is the error coming after you remove the integration ?

Nope, just configured it

Nope, just configured it

Oh !
Okey, reopening then.

How did you configure your Freebox? Bridge mode?

How did you configure your Freebox? Bridge mode?

Nope, it's in router mode with wifi deactivated.

image

Could not reproduce the error.

  • With Wi-Fi disabled i have no errors.
  • Tried to shutdown Wi-Fi and reboot HA while Wi-Fi off still no error.
  • Last thing i must try is to setup a new HA and associate Freebox with Wi-Fi disabled. Maybe the error comes from setting up integration with Wi-Fi disabled. => Will try and report ASAP !

I'm experiencing the same problem with wifi disabled (I'm using Ubiquiti's Unifi AP) . It was the same with the Freebox mini 4k and now with the Freebox pop.
The freebox wifi was off when I've setted the integration.
Also it would be great to allow disabelling the trackers on Freebox for those, like us, who use another wifi AP, as every devices are seen in the both integrations (Freebox and Ubiquiti Unifi, for me)

`2020-09-09 11:39:52 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up freebox platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 192, in _async_setup_platform await asyncio.gather(*pending) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 301, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 472, in _async_add_entity await entity.async_added_to_hass() File "/usr/src/homeassistant/homeassistant/components/freebox/sensor.py", line 125, in async_added_to_hass self.async_update_state() File "/usr/src/homeassistant/homeassistant/components/freebox/sensor.py", line 149, in async_update_state for call in self._router.call_list: TypeError: 'NoneType' object is not iterable

@os131 yours is about the call sensor.

Do you have a other error ? (indicating wifi)

@os131 Disabling a platform from an integration is a good point but not sure if doable... Would need an expert/core dev answer !
You can still disable all entities from the device tracker of the Freebox integration and disable new entities auto add for the Freebox integration.

Edit : @Quentame the error with call logs is there when there's no calls in the call log of the Freebox (tested & reproduced !)
Will open another issue !)

Opened : #39863

File "/usr/src/homeassistant/homeassistant/components/freebox/router.py", line 186, in wifi
return self._api.wifi
AttributeError: 'NoneType' object has no attribute 'wifi'```

The log means that _api is None, not the wifi attribute, which can't be None after open a connection with the Freebox.

Can you:

  • Remove the integration.
  • Reboot HA
  • Add the integration again.

And tell me if the issue still exists.

If it does, after which event ?

@os131 yours is about the call sensor.

Do you have a other error ? (indicating wifi)

Wifi error comes time to time (the first error since your post came this morning). There is no special event that can explain why this error raise up at this moment specificaly.

```
2020-09-15 08:16:16 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.freebox_wifi fails
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 964, in _create_direct_connection
hosts = await asyncio.shield(self._resolve_host(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 964, in _create_direct_connection
hosts = await asyncio.shield(self._resolve_host(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 815, in _resolve_host
await event.wait()
File "/usr/local/lib/python3.8/site-packages/aiohttp/locks.py", line 37, in wait
raise self._exc
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 829, in _resolve_host
addrs = await \
File "/usr/local/lib/python3.8/site-packages/aiohttp/resolver.py", line 29, in resolve
infos = await self._loop.getaddrinfo(
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 825, in getaddrinfo
return await self.run_in_executor(
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(self.args, *self.kwargs)
File "/usr/local/lib/python3.8/socket.py", line 918, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 263, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 454, in async_device_update
await self.async_update() # type: ignore
File "/usr/src/homeassistant/homeassistant/components/freebox/switch.py", line 75, in async_update
datas = await self._router.wifi.get_global_config()
File "/usr/local/lib/python3.8/site-packages/aiofreepybox/api/wifi.py", line 10, in get_global_config
return await self._access.get('wifi/config/')
File "/usr/local/lib/python3.8/site-packages/aiofreepybox/access.py", line 112, in get
return await self._perform_request(self.session.get, end_url)
File "/usr/local/lib/python3.8/site-packages/aiofreepybox/access.py", line 90, in _perform_request
r = await verb(url, *request_params)
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 480, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 523, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 858, in _create_connection
_, proto = await self._create_direct_connection(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 971, in _create_direct_connection
raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host xxxxxxxx.fbxos.fr:xxxxxx ssl:default [Try again]
2020-09-15 08:16:16 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 964, in _create_direct_connection
hosts = await asyncio.shield(self._resolve_host(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 964, in _create_direct_connection
hosts = await asyncio.shield(self._resolve_host(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 815, in _resolve_host
await event.wait()
File "/usr/local/lib/python3.8/site-packages/aiohttp/locks.py", line 37, in wait
raise self._exc
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 829, in _resolve_host
addrs = await \
File "/usr/local/lib/python3.8/site-packages/aiohttp/resolver.py", line 29, in resolve
infos = await self._loop.getaddrinfo(
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 825, in getaddrinfo
return await self.run_in_executor(
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(
self.args, **self.kwargs)
File "/usr/local/lib/python3.8/socket.py", line 918, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/freebox/router.py", line 79, in update_all
await self.update_sensors()
File "/usr/src/homeassistant/homeassistant/components/freebox/router.py", line 115, in update_sensors
syst_datas: Dict[str, Any] = await self._api.system.get_config()
File "/usr/local/lib/python3.8/site-packages/aiofreepybox/api/system.py", line 10, in get_config
return await self._access.get('system/')
File "/usr/local/lib/python3.8/site-packages/aiofreepybox/access.py", line 112, in get
return await self._perform_request(self.session.get, end_url)
File "/usr/local/lib/python3.8/site-packages/aiofreepybox/access.py", line 90, in _perform_request
r = await verb(url, **request_params)
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 480, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 523, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 858, in _create_connection
_, proto = await self._create_direct_connection(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 971, in _create_direct_connection
raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host xxxxxxxx.fbxos.fr:xxxxxx ssl:default [Try again]
```

@os131

Wifi error comes time to time (the first error since your post came this morning). There is no special event that can explain why this error raise up at this moment specificaly.

You were having an occasionnal error while the Freebox is busy and did not handle the API call. The sensor should get back to normal at the next update (30s).

The error is not the same as the initial.


@benjR

File "/usr/src/homeassistant/homeassistant/components/freebox/router.py", line 186, in wifi
return self._api.wifi
AttributeError: 'NoneType' object has no attribute 'wifi'```

this means _api is None, and the only mean it can be None is after remove the integration.

A fix has been made on 0.115.0 when sensors try to update after the integration removal, see #38842

Thanks @Quentame I did try to remove and reinstall the integration to test the fix, but I broke something somehow... I did remove the integration from the config panel (after shutting down HA), remove authorizations from freeboxOS to connect, remove the freebox folder in .storage, restarted and added back, accepted on the freebox delta panel, but now I don't have anything.

Trace here, I'll open another issue for this.

Please confirm the authentification on the freebox                                                                                                                                                                                                                                          
2020-10-30 09:34:56 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 9ufqaq4a.fbxos.fr for freebox                                                                                                                                                                  
Traceback (most recent call last):                                                                                                                                                                                                                                                          
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 234, in async_setup                                                                                                                                                                                                   
    result = await component.async_setup_entry(hass, self)  # type: ignore                                                                                                                                                                                                                  
  File "/usr/src/homeassistant/homeassistant/components/freebox/__init__.py", line 65, in async_setup_entry                                                                                                                                                                                 
    await router.setup()                                                                                                                                                                                                                                                                    
  File "/usr/src/homeassistant/homeassistant/components/freebox/router.py", line 75, in setup                                                                                                                                                                                               
    await self.update_all()                                                                                                                                                                                                                                                                 
  File "/usr/src/homeassistant/homeassistant/components/freebox/router.py", line 82, in update_all                                                                                                                                                                                          
    await self.update_sensors()                                                                                                                                                                                                                                                             
  File "/usr/src/homeassistant/homeassistant/components/freebox/router.py", line 123, in update_sensors                                                                                                                                                                                     
    self.sensors_temperature[sensor["name"]] = sensor["value"]                                                                                                                                                                                                                              
KeyError: 'value'                                               

Yep, please create a new issue.
Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Konstigt picture Konstigt  路  3Comments

neonandu picture neonandu  路  3Comments

moskovskiy82 picture moskovskiy82  路  3Comments

MartinHjelmare picture MartinHjelmare  路  3Comments

sibbl picture sibbl  路  3Comments