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

All Unifi entities / devices show as "Away" #96095

Closed
philippefs35 opened this issue Jul 7, 2023 · 14 comments
Closed

All Unifi entities / devices show as "Away" #96095

philippefs35 opened this issue Jul 7, 2023 · 14 comments

Comments

@philippefs35
Copy link

The problem

All of the entities reported by the Unifi integration show as "Away" even though they are connected

Example:
image

What version of Home Assistant Core has the issue?

core-2023.7.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

UniFi Network

Link to integration documentation on our website

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

Diagnostics information

config_entry-unifi-be1987dbea0c1a6b4bc507d77b80b8cb.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Jul 7, 2023

Hey there @Kane610, mind taking a look at this issue as it has been labeled with an integration (unifi) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of unifi can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign unifi Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


unifi documentation
unifi source
(message by IssueLinks)

@thekillerpt
Copy link

I have the same issue,
when integration starts all devices are located correctly,
after 5mn (or whatever is set to define that the devices are away) all devices become away

was working well before , in a previous home assistant + unifi app version

@stefanroelofs
Copy link
Contributor

I had the same issue. All devices were shown as 'away'.

I then tried to remove the Unifi integration and add it again and now the setup will not connect anymore:

2023-07-14 08:29:46.927 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiounifi/controller.py", line 178, in request
    response: list[dict[str, Any]] = await self._request(
                                     ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiounifi/controller.py", line 217, in _request
    raise LoginRequired(f"Call {url} received 401 Unauthorized")
aiounifi.errors.LoginRequired: Call https://192.168.1.224:8443/api/self/sites received 401 Unauthorized

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiounifi/controller.py", line 178, in request
    response: list[dict[str, Any]] = await self._request(
                                     ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiounifi/controller.py", line 217, in _request
    raise LoginRequired(f"Call {url} received 401 Unauthorized")
aiounifi.errors.LoginRequired: Call https://192.168.1.224:8443/api/self/sites received 401 Unauthorized

I run UniFi Network Application 7.4.162

@Kane610
Copy link
Member

Kane610 commented Aug 1, 2023

What is your operating environment for the Unifi Network app? Since its working for many other users I'd wager its something in your environment.

@stefanroelofs
Copy link
Contributor

stefanroelofs commented Aug 1, 2023 via email

@Kane610
Copy link
Member

Kane610 commented Aug 2, 2023

Can you share have you tried restarting the container? It seems when users have different types of issues a restart resolves it

@stefanroelofs
Copy link
Contributor

It seems that a restart of the container fixed the issues. Thanks!
Unifi integration now installs fine, and also the device tracker for my phone switches from Home to Away.
Thanks again.

@the01
Copy link

the01 commented Aug 5, 2023

This seems to be related to #89473

For me, it stopped working a few weeks (months?) back, though I didn't immediately notice. Might have been after a HA update, but the controller remained on the same version.
I run the controller in a docker container on the network and updated it in the last couple days. I also tried deleting and re-adding the hub. The devices are found just fine, but the "away" state never changes.
Anything else I could try?

@Kane610
Copy link
Member

Kane610 commented Aug 8, 2023

@the01 Have you tried restarting your controller?

If restarting the controller doesn't help you can enable debug logging for the integration and share the log.

@the01
Copy link

the01 commented Aug 9, 2023

Yes, restarting was part of the controller update as I'm running in a docker container.
Just to be sure I did so again, but no change (afterwards I reloaded the integration to cover all bases and also no improvement)
I will check the log later, but is there anything specific to look out for (except for errors obviously)? Is 5 minutes of normal operation enough or better a reload?
Last time I had a look there was very detailed information on all the devices on my network, so if I can't spot anything myself, I'm going to want to anonymize it a bit first

@Kane610
Copy link
Member

Kane610 commented Aug 9, 2023

I will check the log later, but is there anything specific to look out for (except for errors obviously)?

Checking that web socket is set up correctly, that new data is flowing over web socket,.

6 minutes of debug log from start up would be great. If you want to limit exposure you can send me the log over discord or ha forums.

@the01
Copy link

the01 commented Aug 9, 2023

Soooo..turns out the issue was time drift on the VM running the controller -.-

When checking the debug log, i validated some of the time stamps in the data and they were ~45min off. I could have sworn I checked this previously, but yeah...

Sorry for the noise and thank you for the help!

@Kane610
Copy link
Member

Kane610 commented Aug 9, 2023

Thanks for validating! Would be nice to be able to catch that time diff in the api somehow.

OP hasn't been active since creating the issue and the other issues have been resolved so closing this.

@Kane610 Kane610 closed this as completed Aug 9, 2023
@the01
Copy link

the01 commented Aug 9, 2023

Thanks for validating! Would be nice to be able to catch that time diff in the api somehow.

OP hasn't been active since creating the issue and the other issues have been resolved so closing this.

I think it would be possible to detect via the Date header in the api response (at least I see it in the debug log)

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

No branches or pull requests

5 participants