Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unifi Switch Port Error #25893

Closed
MwC-Trexx opened this issue Aug 12, 2019 · 29 comments
Closed

Unifi Switch Port Error #25893

MwC-Trexx opened this issue Aug 12, 2019 · 29 comments
Assignees

Comments

@MwC-Trexx
Copy link

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

@probot-home-assistant
Copy link

Hey there @Kane610, mind taking a look at this issue as its been labeled with a integration (unifi) you are listed as a codeowner for? Thanks!

@frankhommers
Copy link

I have the same problem I think

2019-08-19 22:14:58 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 254, in async_update_ha_state
    self._async_write_ha_state()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 278, in _async_write_ha_state
    state = self.state
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 528, in state
    return STATE_ON if self.is_on else STATE_OFF
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/unifi/switch.py", line 209, in is_on
    return self.port.poe_mode != "off"
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/unifi/switch.py", line 256, in port
    return self.device.ports[self.client.sw_port]
AttributeError: 'NoneType' object has no attribute 'ports'

@wiuwiu
Copy link
Contributor

wiuwiu commented Aug 21, 2019

I have the same:

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

Plus another error in this component:
Couldn't find key: 'None'

@Kane610
Copy link
Member

Kane610 commented Sep 26, 2019

This seems to happen when something gets disconnected from the network, I'm investigating what can be the cause of this.

@Kane610
Copy link
Member

Kane610 commented Oct 2, 2019

Hey guys! Anyone interested in verifying this fix in the betas starting later today?

@aaronwolen
Copy link

Absolutely. I'll give it a go and report back.

@Kane610
Copy link
Member

Kane610 commented Oct 2, 2019

So what you need to do is also to go into the entity registry and remove those POE control switches that are reporting that issue. The reason for this is that I think that a UniFi bug which causes wireless devices to show as wired devices triggers these faulty poe control switch entities

@aaronwolen
Copy link

Apologies for the lack of updates—believe it or not my USG failed on me and I'm waiting for a replacement... 🙄

@Kane610
Copy link
Member

Kane610 commented Oct 4, 2019

@aaronwolen too bad :/. Fortunately you don't need the USG to test this, only a controller and a POE switch

@pfunkmallone
Copy link

I'd be happy to help test...I too am seeing this error. You mention deleting the POE control switches in the entity registry. Can you help me understand which entities to delete? How do I identify them?

@Kane610
Copy link
Member

Kane610 commented Oct 13, 2019

Any difference after 0.100?

@pfunkmallone
Copy link

Unfortunately, I've found the errors to be too inconsistent. Sometimes after a restart I don't get them. I didn't receive them on 0.100.2, but the device_tracker component is blowing up for Unifi, so I'm back to running 0.99.3 (my home automation relies heavily on presence).

@Kane610
Copy link
Member

Kane610 commented Oct 13, 2019

Describe blowing up please :)

@pfunkmallone
Copy link

Thanks Kane610! Now that I have device_tracker working again, I'm not seeing these errors on 0.100.2.

Re: device_tracker: I still had it configured in YAML. Apparently I missed the breaking notes to remove it.

@Kane610 Kane610 closed this as completed Oct 31, 2019
@frankhommers
Copy link

I still have this problem in 0.101.2

Log Details (ERROR)
Thu Nov 07 2019 15:17:01 GMT+0100 (Central European Standard Time)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 275, in async_update_ha_state
    self._async_write_ha_state()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 309, in _async_write_ha_state
    state = self.state
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 576, in state
    return STATE_ON if self.is_on else STATE_OFF
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/unifi/switch.py", line 204, in is_on
    return self.port.poe_mode != "off"
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/unifi/switch.py", line 249, in port
    return self.device.ports[self.client.sw_port]
AttributeError: 'NoneType' object has no attribute 'ports'

image

@JonGilmore
Copy link
Contributor

any updates on this? Still seeing it in the latest (0.102.3) release.

@roflmao
Copy link

roflmao commented Dec 8, 2019

I have this on 0.102.3 on my unifi with 1 UniFi AP-nanoHD + UniFi AP-AC-LR + 1 UniFi Switch 8 POE-60W:

2019-12-08 21:40:11 ERROR (MainThread) [aiounifi.api Couldn't find key: 'None'
2019-12-08 21:40:11 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 275, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 309, in _async_write_ha_state
    state = self.state
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 576, in state
    return STATE_ON if self.is_on else STATE_OFF
  File "/usr/src/homeassistant/homeassistant/components/unifi/switch.py", line 204, in is_on
    return self.port.poe_mode != "off"
  File "/usr/src/homeassistant/homeassistant/components/unifi/switch.py", line 249, in port
    return self.device.ports[self.client.sw_port
AttributeError: 'NoneType' object has no attribute 'ports'

@wimb0
Copy link

wimb0 commented Jan 16, 2020

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'

@beanian
Copy link

beanian commented Jan 24, 2020

+1 Seeing this behaviour on 104 also

@niemyjski
Copy link

+1 Seeing this behaviour on 104.3 also

@jamjammer
Copy link

+1 Seeing this behavior on 104.3 as well.

@ioanbsu
Copy link

ioanbsu commented Feb 2, 2020

+1 seeing this. Can't start homeassistant, can't remove integration(through homeassistant UI)

@dandomin
Copy link

dandomin commented Feb 6, 2020

+1 seeing the same - my indicates 34k times!

@dr808
Copy link

dr808 commented Feb 7, 2020

I'm seeing this in 105.2. Can't figure out how to turn it off in the logs either. homeassistant.components.unifi: fatal does nothing - though maybe that's not the correct one.

@jjanderson
Copy link

+1 here... I also am experincing this. Can we re-open this or should I log a new one?

@lee-costa
Copy link

Started seeing it today as well. Over 2K times in the last few hours.

@declanshanaghy
Copy link

+1 on this issue for me

@wbradmoore
Copy link

been happening for months now for me

@lee-costa
Copy link

@wbradmoore Your posted reminded me to share what has worked for me: Simply removing and re-adding the integration.

For whatever reason, it solved it for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests