core icon indicating copy to clipboard operation
core copied to clipboard

Netgear Integration erorr: Retrying setup: object of type 'NoneType' has no len()

Open drphungky opened this issue 2 years ago • 2 comments

The problem

I get an error when either installing or autodetecting and installing the Netgear integration. On the integration page it says: Retrying setup: object of type 'NoneType' has no len()

The log says:

Logger: homeassistant.components.netgear
Source: helpers/device_registry.py:136
Integration: NETGEAR ([documentation](https://www.home-assistant.io/integrations/netgear), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+netgear%22))
First occurred: 3:26:04 PM (17 occurrences)
Last logged: 3:40:58 PM

Unexpected error fetching NighthawkRouter Devices data: object of type 'NoneType' has no len()
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in _async_update_data
    return await self.update_method()
  File "/usr/src/homeassistant/homeassistant/components/netgear/__init__.py", line 79, in async_update_devices
    return await router.async_update_device_trackers()
  File "/usr/src/homeassistant/homeassistant/components/netgear/router.py", line 201, in async_update_device_trackers
    device_mac = format_mac(ntg_device.mac)
  File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 136, in format_mac
    if len(to_test) == 17 and to_test.count(":") == 5:
TypeError: object of type 'NoneType' has no len()

What version of Home Assistant Core has the issue?

2022.8.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Netgear

Link to integration documentation on our website

https://www.home-assistant.io/integrations/netgear

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.netgear
Source: helpers/device_registry.py:136
Integration: NETGEAR ([documentation](https://www.home-assistant.io/integrations/netgear), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+netgear%22))
First occurred: 3:26:04 PM (17 occurrences)
Last logged: 3:40:58 PM

Unexpected error fetching NighthawkRouter Devices data: object of type 'NoneType' has no len()
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in _async_update_data
    return await self.update_method()
  File "/usr/src/homeassistant/homeassistant/components/netgear/__init__.py", line 79, in async_update_devices
    return await router.async_update_device_trackers()
  File "/usr/src/homeassistant/homeassistant/components/netgear/router.py", line 201, in async_update_device_trackers
    device_mac = format_mac(ntg_device.mac)
  File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 136, in format_mac
    if len(to_test) == 17 and to_test.count(":") == 5:
TypeError: object of type 'NoneType' has no len()

Additional information

No response

drphungky avatar Aug 09 '22 19:08 drphungky

netgear documentation netgear source (message by IssueLinks)

Hey there @hacf-fr, @quentame, @starkillerog, mind taking a look at this issue as it has been labeled with an integration (netgear) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

@drphungky thank you for reporting the issue. I implemented a fix in this PR: https://github.com/home-assistant/core/pull/76626

If you appreciate the Netgear intgration, consider sponsering the upstream library: https://github.com/MatMaul/pynetgear

starkillerOG avatar Aug 11 '22 19:08 starkillerOG

Fixed by #76626

frenck avatar Aug 15 '22 09:08 frenck