core: Unifi Switch Port Error

Home Assistant release with the issue:

0.97.2

Last working Home Assistant release (if known):

Operating environment (Hass.io/Docker/Windows/etc.):

Hass.io VM

Component/platform:

https://www.home-assistant.io/components/unifi/#switch

Description of problem:

After installation of current 0.97.2 upgrade to resolve unifi “upgradeable” issue, the new switch issue appeared.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):


N/A - Unifi configured through Integration

Traceback (if applicable):

AttributeError: 'NoneType' object has no attribute 'ports'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 254, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in _async_write_ha_state
    state = self.state
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 528, in state
    return STATE_ON if self.is_on else STATE_OFF
  File "/usr/src/homeassistant/homeassistant/components/unifi/switch.py", line 209, in is_on
    return self.port.poe_mode != "off"
  File "/usr/src/homeassistant/homeassistant/components/unifi/switch.py", line 256, in port
    return self.device.ports[self.client.sw_port]
AttributeError: 'NoneType' object has no attribute 'ports'
Connected

Additional information: Cloud-hosted Unifi Controller. Controller: 5.11.36 Switch FW: 4.0.49.10569

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 29 (8 by maintainers)

Most upvoted comments

This issue seems to be back in 0.104: Can’t find this in breaking changes, so leaving a comment here.

2020-01-16 09:51:36 ERROR (MainThread) [aiounifi.api] Couldn't find key: 'None' 2020-01-16 09:51:36 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 284, in async_update_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state state = self.state File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 588, in state return STATE_ON if self.is_on else STATE_OFF File "/usr/src/homeassistant/homeassistant/components/unifi/switch.py", line 219, in is_on return self.port.poe_mode != "off" File "/usr/src/homeassistant/homeassistant/components/unifi/switch.py", line 264, in port return self.device.ports[self.client.sw_port] AttributeError: 'NoneType' object has no attribute 'ports'

+1 Seeing this behaviour on 104 also