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 OS 4.0.3 EA release breaks UniFi integrations #116411

Closed
to4ko opened this issue Apr 29, 2024 · 20 comments · Fixed by #116639
Closed

UniFi OS 4.0.3 EA release breaks UniFi integrations #116411

to4ko opened this issue Apr 29, 2024 · 20 comments · Fixed by #116639

Comments

@to4ko
Copy link

to4ko commented Apr 29, 2024

The problem

Unifi Network and Unifi Protect are not working with Unifi OS 4.0.3

It gives next message
homeassistant.bootstrap] Waiting on integrations to complete setup: {('unifi', '1a32234bcdf065653f810dcdca0c68d3'): 33491.298705887}

and after some time hang totally

What version of Home Assistant Core has the issue?

core-2024.4.4

What was the last working version of Home Assistant Core?

core-2024.4.4

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

unifi network, unifi protect

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@to4ko
Copy link
Author

to4ko commented Apr 29, 2024

@Kane610 hi! could you please take a look on this one? integrations are not working but command line sensor (gettin additional infor from unifi api) working ok

@Kane610
Copy link
Member

Kane610 commented Apr 29, 2024

Early access is unsupported territory so this is always the risk.

Do you run a local account or cloud account?
If you enable debug logs do you see any more information?

@to4ko
Copy link
Author

to4ko commented Apr 29, 2024

Early access is unsupported territory so this is always the risk.

Do you run a local account or cloud account? If you enable debug logs do you see any more information?

Agree about early access, but this is preparaion to udm pro max migration coming tomorrow...

i'm running local account. this what it shows in debug

2024-04-29 20:57:26.784 DEBUG (MainThread) [aiounifi.interfaces.connectivity] sending (to https://192.168.1.1:443) get, None, {'allow_redirects': False}
2024-04-29 20:57:26.794 DEBUG (MainThread) [aiounifi.interfaces.connectivity] received (from https://192.168.1.1:443) 200 text/html <ClientResponse(https://192.168.1.1:443) [200 OK]>
2024-04-29 20:57:26.794 DEBUG (MainThread) [aiounifi.interfaces.connectivity] data (from https://192.168.1.1:443) b'<!doctype html><html lang="en"><head><meta charset="utf-8"><link rel="icon" href="/favicon.ico?v3" sizes="any"><link rel="icon" href="/favicon.svg?v3" type="image/svg+xml"><link rel="apple-touch-icon" href="/apple-touch-icon.png?v3"><title>UniFi OS</title><meta name="viewport" content="width=device-width,initial-scale=1"><script>window.UNIFI_OS_MANIFEST = {"model":{"id":"UDMPRO","shortName":"UDM Pro","longName":"UniFi Dream Machine Pro"},"images":[{"size":1024,"url":"/assets/images/1024.png?udmpro-3.0.0"},{"size":64,"url":"/assets/images/64.png?udmpro-3.0.0"},{"size":48,"url":"/assets/images/48.png?udmpro-3.0.0"}]}</script><script defer="defer" src="/main.25b16840f1c6a49ff40b.js"></script><link href="/main.0e9197a3.css" rel="stylesheet"></head><body id="portal-body"><div id="portal-root"></div></body></html>'
2024-04-29 20:57:26.794 DEBUG (MainThread) [aiounifi.interfaces.connectivity] Talking to UniFi OS device: True
2024-04-29 20:57:26.794 DEBUG (MainThread) [aiounifi.interfaces.connectivity] sending (to https://192.168.1.1:443/api/auth/login) post, {'username': 'xxxxxxxxxxxx', 'password': 'xxxxxxxxxxxxx', 'remember': True}, {}
2024-04-29 20:57:27.194 DEBUG (MainThread) [aiounifi.interfaces.connectivity] received (from https://192.168.1.1:443/api/auth/login) 200 application/json <ClientResponse(https://192.168.1.1:443/api/auth/login) [200 OK]>
2024-04-29 20:57:27.194 DEBUG (MainThread) [aiounifi.interfaces.connectivity] data (from https://192.168.1.1:443/api/auth/login) b'{"unique_id":"5113ac49-eb25-418c-b2b6-978d4c536470","first_name":"xxxxxxxxxxx","last_name":" ","alias":"","full_name":"ha_telemetry_backup","email":"","email_status":"UNVERIFIED","email_is_null":true,"user_email":"","phone":"","avatar_relative_path":"","avatar_rpath2":"","status":"ACTIVE","employee_number":"","create_time":1698517807,"login_time":1714411532,"extras":{},"username":"xxxxxxx","local_account_exist":true,"password_revision":1698517807,"sso_account":"","sso_uuid":"","sso_username":"","sso_picture":"","uid_sso_id":"","uid_sso_account":"","uid_account_status":"","groups":[{"unique_id":"e6dbf815-b938-463a-8c9e-43c4bf2e6f1e","name":"UDMP","up_id":"","up_ids":[],"system_name":"UDMP","create_time":"2020-06-29T22:17:23+03:00"}],"roles":[{"unique_id":"2e40369b-662e-46a1-b3b8-beba85a5b8c9","name":"Super Admin","system_role":true,"system_key":"super_administrator","level":2,"create_time":"2019-11-28T15:00:13+03:00","update_time":"2019-11-28T18:00:13+03:00","is_private":false}],"permissions":{"innerspace.management":["admin"],"network.management":["admin"],"protect.management":["admin"],"system.management.location":["admin"],"system.management.user":["admin"]},"scopes":["write:protect.viewer","write:protect.user:$","write:protect.user","write:protect.sensor","write:protect.schedule","write:protect.nvr","write:protect.light","write:protect.legacyUFV","write:protect.group","write:protect.doorlock","write:protect.deviceGroup","write:protect.chime","write:protect.camera","write:protect.bridge","view:user_timezone","view:user","view:unifi-os:user","view:systemlog","view:settings","view:role","view:permission:viewer","view:permission:admin","view:permission","view:os-menu:user","view:os-menu:system-log","view:os-menu:storage","view:os-menu:settings","view:os-menu:notify-settings","view:os-menu:map","view:os-menu:devices","view:os-menu:about","view:notification","view:location_policy","view:location_device","view:location_activity","view:location","view:identity:update","view:identity:settings","view:identity:services","view:identity:organization_info","view:holiday_timezone","view:holiday","view:group","view:door_group","view:controller:uid-agent","view:controller:talk","view:controller:protect","view:controller:olympus","view:controller:network","view:controller:led","view:controller:innerspace","view:controller:drive","view:controller:connect","view:controller:calculus","view:controller:access","view:cloud_access","view:app:users","view:app:uid-agent","view:app:settings","view:app:locations","view:access:user","view:access.visitor","view:access.systemlog","view:access.settings","view:access.schedule","view:access.policy","view:access.pin_code","view:access.nfc_card","view:access.face","view:access.device","view:access.dashboard","update:access.device","systemlog:user","systemlog:system","systemlog:network","systemlog:location","systemlog:connect","systemlog:access","send:identity:email","revoke:identity:credential","readmedia:protect.camera","readlive:protect.camera","read:protect.viewer","read:protect.user:$","read:protect.user","read:protect.sensor","read:protect.schedule","read:protect.nvr","read:protect.light","read:protect.legacyUFV","read:protect.group","read:protect.doorlock","read:protect.deviceGroup","read:protect.chime","read:protect.camera","read:protect.bridge","open:door","notify:user","notify:location","notify:access","manage:controller:talk","manage:controller:protect","manage:controller:olympus","manage:controller:network","manage:controller:led","manage:controller:innerspace","manage:controller:drive","manage:controller:connect","manage:controller:calculus","manage:controller:access","edit:user_timezone","edit:user","edit:unifi-os:user_group","edit:unifi-os:user","edit:systemlog","edit:settings","edit:role","edit:permission:viewer","edit:permission:admin","edit:os-settings:update_install","edit:os-settings:update_channel","edit:os-settings:support_file","edit:os-settings:ssh","edit:os-settings:send_diagnostics","edit:os-settings:restart","edit:os-settings:raid","edit:os-settings:poweroff","edit:os-settings:notify","edit:os-settings:hotspare","edit:os-settings:general","edit:os-settings:client_network","edit:os-settings:auto_update","edit:notification","edit:location_policy","edit:location_device","edit:location_activity","edit:location","edit:identity:update","edit:identity:status","edit:identity:settings","edit:identity:services","edit:identity:organization_info","edit:holiday_timezone","edit:holiday","edit:group","edit:feedback","edit:door_group","edit:controller:uid-agent","edit:access:user","edit:access.visitor","edit:access.settings","edit:access.schedule","edit:access.policy","edit:access.pin_code","edit:access.nfc_card","edit:access.face","edit:access.device","deletemedia:protect.camera","delete:protect.viewer","delete:protect.user:$","delete:protect.user","delete:protect.sensor","delete:protect.schedule","delete:protect.nvr","delete:protect.light","delete:protect.legacyUFV","delete:protect.group","delete:protect.doorlock","delete:protect.deviceGroup","delete:protect.chime","delete:protect.camera","delete:protect.bridge","delete:access.device","create:protect.viewer","create:protect.user","create:protect.sensor","create:protect.schedule","create:protect.liveview","create:protect.light","create:protect.group","create:protect.doorlock","create:protect.deviceGroup","create:protect.chime","create:protect.camera","create:protect.bridge","assign:role","assign:identity:wifi","assign:identity:vpn","assign:identity:talk","assign:identity:evstation","assign:identity:camera","adopt:access.device"],"cloud_access_granted":false,"only_local_account":true,"update_time":1698517807,"avatar":null,"nfc_token":"","nfc_display_id":"","nfc_card_type":"","nfc_card_status":"","role":"admin","roleId":"2e40369b-662e-46a1-b3b8-beba85a5b8c9","id":"5113ac49-eb25-418c-b2b6-978d4c536470","isOwner":false,"isSuperAdmin":true,"isMember":false,"maskedEmail":"","accessMask":2014,"permissionMask":8028,"deviceToken":"xxxxxxxxxxxxxxxxxxxxxxxxjZmOTczZi0yYzYyLTQ1MmItYWUyYS02MDAzNGIyZjkwYzAiLCJpYXQiOjE3MTQ0MTM0NDcsImlzcyI6IlVMUC1HTyIsInVzZXJfaWQiOiI1MTEzYWM0OS1lYjI1LTQxOGMtYjJiNi05NzhkNGM1MzY0NzAifQ.lXnjaYVMP1trMpp99Wmhu1UsuGfbVdPY-WZzJOT8mJ8","ssoAuth":{}}'
2024-04-29 20:57:27.194 DEBUG (MainThread) [aiounifi.interfaces.connectivity] Logged in to UniFi https://192.168.1.1:443/api/auth/login
2024-04-29 20:57:27.235 ERROR (MainThread) [aiounifi.interfaces.connectivity] Server handshake error connecting to UniFi websocket: '401, message='Invalid response status', url=URL('wss://192.168.1.1:443/proxy/network/wss/s/default/events')'
2024-04-29 20:57:27.235 ERROR (MainThread) [homeassistant.components.unifi] Websocket setup failed```

@to4ko
Copy link
Author

to4ko commented Apr 29, 2024

same time unifi api replying back normally on

data='{"username":"xxx","password":"xxxxx"}'; ip='https://192.168.1.1:443';\ c=$(curl -H 'Content-Type: application/json' -d $data -ksc - $ip/api/auth/login -o /dev/null);\ echo "${c}" | curl -ksb - $ip/proxy/network/api/s/default/stat/device/

with
image

exactly as it was on unifi os 3.2.12

plus Unifi Protect version kept the same but it's not working as well as network

@Kane610
Copy link
Member

Kane610 commented Apr 29, 2024

Seems to be a problem setting up the websocket

@to4ko
Copy link
Author

to4ko commented Apr 29, 2024

any quick fix solution?

@Kane610
Copy link
Member

Kane610 commented Apr 29, 2024

No. Need to figure out if websocket has been moved or changed or something. If you know how to use the browser developer tools you can play around in the unifi interface and look at the traffic to see if you can identify it

@to4ko
Copy link
Author

to4ko commented Apr 29, 2024

so i got protect working - delete integration, restart ha and it got found automatically and integration started just fine. same trick not working for network. but i got new simpthom - integration entities got aliveevery 9-10 seconds. and went back to unavailable

Recording.2024-04-29.214351.mp4

@Kane610
Copy link
Member

Kane610 commented Apr 29, 2024

What does the log say?

@to4ko
Copy link
Author

to4ko commented Apr 29, 2024

2024-04-29 21:49:12.532 ERROR (MainThread) [aiounifi.interfaces.connectivity] Server handshake error connecting to UniFi websocket: '401, message='Invalid response status', url=URL('wss://192.168.1.1:443/proxy/network/wss/s/default/events')' 2024-04-29 21:49:12.532 ERROR (MainThread) [homeassistant.components.unifi] Websocket setup failed

@to4ko
Copy link
Author

to4ko commented Apr 29, 2024

while trying to add network integration back it hangs for a long time and as a result

https://pastebin.com/ZRnm05bx

@TheJulianJES TheJulianJES changed the title Unifi OS 4.0.3 UniFi OS 4.0.3 EA release breaks UniFi integrations Apr 29, 2024
@smarthomelawyer

This comment was marked as duplicate.

@udochrist
Copy link

having the same issue with this version of unifi ea in home assistant.

interestingly enough a home bridge connecting to the same unifi version does not have the issue with its plugin.
so i doubt it is solely based on the unifi ea version changing something but more on a specific implementation detail for the homeassistant integration.

@Kane610
Copy link
Member

Kane610 commented May 1, 2024

so i doubt it is solely based on the unifi ea version changing something but more on a specific implementation detail

I would wager that Homebridge doesn't use websocket. Looking at the little data shared so far it's the webso ket connection which h fails causing a reauthentication which in turn causes the too many Auth requests failure

@cknic
Copy link

cknic commented May 1, 2024

I did try the whole delete, restart and re-initialize protect. It does not work for me. It won't login. So that does not seem to be a universal solve for protect.

@johnmacfadyen
Copy link

I was able to restore Unifi Protect by creating a new local user and reauthenticating with that. No joy on the network component but at least my doorbell works again.

@techunleadit
Copy link

@johnmacfadyen blessed are you, I have tried everything and am without more access =(
I hope the developers can figure out where the catch is.

@to4ko If it helps, I can give access to a test UDM Pro

@nexeck
Copy link

nexeck commented May 2, 2024

I was able to restore Unifi Protect by creating a new local user and reauthenticating with that. No joy on the network component but at least my doorbell works again.

Thanks for the hint, the new local user worked for me, too.

FYI: Deleting the user and recreating it with the same name didn't work, not sure why. Maybe something cached on the HA side?

@home-assistant
Copy link

home-assistant bot commented May 2, 2024

@to4ko
Copy link
Author

to4ko commented May 3, 2024

@Kane610 Thanks for integration update! All working just fine!
one more thing - with asyncio debug turned on i see thisin log

WARNING (MainThread) [asyncio] Executing <Task pending name='Task-30867' coro=<UnifiWebsocket.start_websocket.<locals>._websocket_runner() running at /usr/src/homeassistant/homeassistant/components/unifi/hub/websocket.py:80> wait_for=<Future pending cb=[Task.task_wakeup()] created at /usr/local/lib/python3.12/asyncio/base_events.py:448>> took 0.631 seconds

not sure if this one should worry me or not but just in case :)

@github-actions github-actions bot locked and limited conversation to collaborators Jun 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants