8000 Unifi Integration Unexpected error 502 Disconnects indefinetly · Issue #40145 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Unifi Integration Unexpected error 502 Disconnects indefinetly #40145

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

Closed
muniter opened this issue Sep 16, 2020 · 5 comments
Closed

Unifi Integration Unexpected error 502 Disconnects indefinetly #40145

muniter opened this issue Sep 16, 2020 · 5 comments
Assignees

Comments

@muniter
Copy link
muniter commented Sep 16, 2020

The problem

The Unifi integration, disconnects after a day or so, and stays as so until Home Assistant is restarted.

Picture of many of my wifi devices, which are working perfectly, but Unifi reports them as Unavailable.
image

Environment

  • Home Assistant Core release with the issue: 0.114.4
  • Last working Home Assistant Core release (if known):
  • Operating environment (OS/Container/Supervised/Core): Supervised
  • Integration causing this issue: Ubiquiti UniFi
  • Link to integration documentation on our website: Ubiquiti Unifi

Problem-relevant configuration.yaml

Is configured using the GUI, here's a picture.

image

Traceback/Error logs

Logger: aiounifi.websocket
Source: /usr/local/lib/python3.8/site-packages/aiounifi/websocket.py:99
First occurred: September 15, 2020, 11:01:19 PM (1 occurrences)
Last logged: September 15, 2020, 11:01:19 PM

Unexpected error 502, message='Invalid response status', url=URL('wss://appunifi.muniter.xyz:443/wss/s/default/events')

------------------------------------------------

Logger: homeassistant.components.unifi
Source: components/unifi/controller.py:193
Integration: Ubiquiti UniFi (documentation, issues)
First occurred: September 15, 2020, 11:01:04 PM (1 occurrences)
Last logged: September 15, 2020, 11:01:04 PM

Lost connection to UniFi controller

------------------------------------------------

2020-09-15 23:01:04 WARNING (MainThread) [homeassistant.components.unifi] Lost connection to UniFi controller
2020-09-15 23:01:19 INFO (MainThread) [homeassistant.components.unifi] Will try to reconnect to UniFi controller
2020-09-15 23:01:19 ERROR (MainThread) [aiounifi.websocket] Unexpected error 502, message='Invalid response status', url=URL('wss://appunifi.muniter.xyz:443/wss/s/default/events')

Additional information

As can bee seen, It get's an unexpected error, and disconnects from the Unifi integration. Problem is, It never tries to reconnect again. I have to restart Home Assistant. This happens every 18 - 24 hours. Meaning every other day I have to restart Home Assistant just because of that.

I'm running the unifi controller localy, outside of homeassistant, in a docker container, with valid SSL certificates, behind an nginx reverse proxy, I test the controller when Home Assistant loses connection and everything is fine, I rarely restart the controller, only on updates. So doesn't seem like a controller issue.

I believe that the integration should try to connect again.

@probot-home-assistant
Copy link

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

@iuro
Copy link
iuro commented Sep 18, 2020

Related problem since 0.114.4. Device keep going from home to unavailable.

Error log:

_Exception in async_update_callback when dispatching 'unifi-reachable-192.168.1.113-default': () Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/unifi/unifi_entity_base.py", line 52, in async_update_callback self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in async_write_ha_state sstate = self.state File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 667, in state return STATE_ON if self.is_on else STATE_OFF File "/usr/src/homeassistant/homeassistant/components/unifi/switch.py", line 184, in is_on return self.port.poe_mode != "off" AttributeError: 'NoneType' object has no attribute 'poe_mode'
7:18:23 PM – util/logging.py (ERROR) - message first occurred at 7:12:59 PM and shows up 66 times
Entity switch.unifi_poe_b2_ee_df_1c_8d_ec reports faulty device or port None
7:18:23 PM – Ubiquiti UniFi (WARNING) - message first occurred at 7:12:59 PM and shows up 77 times
Couldn't find key:
7:18:23 PM – /usr/local/lib/python3.8/site-packages/aiounifi/api.py (ERROR) - message first occurred at 7:12:59 PM and shows up 77 times
Lost connection to UniFi controller
7:18:08 PM – Ubiquiti UniFi (WARNING) - message first occurred at 7:12:59 PM and shows up 11 times
Unexpected error 'NoneType' object has no attribute 'poe_mode'
7:18:08 PM – /usr/local/lib/python3.8/site-packages/aiounifi/websocket.py (ERROR) - message first occurred at 7:12:59 PM and shows up 11 times

@JonasPed1
Copy link
Contributor

I agree that it would be nice if the unifi integration would try to reconnect. I am running the unifi controller behind an reverse proxy. The reverse proxy returns an 502 if it can not reach its upstream server. This happens, for instance, if the unifi controller is upgraded and restarted. I use unifi for presence detection, so it is quite annoying that I have to restart hass once in a while due to lost connection to the unifi controller.

So a +1 for a reconnect from me :-)

@muniter
Copy link
Author
muniter commented Nov 25, 2020

@JonasPed Hey Jonas, you don't have to restart Home Assistant to get the integration back, a few releases ago you can reload individual integrations, just go to the integrations page click the 3 dots, and reload.

@Kane610
Copy link
Member
Kane610 commented Dec 10, 2020

PR merged

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

5 participants
0