Device presence status is stuck using the Unifi integration in HA 0.106.2. It will update initially after a restart but will not refresh again.
configuration.yaml
I had the same issue and solved it by updating the UniFi controller to the latest version. See https://github.com/home-assistant/home-assistant/issues/31109#issuecomment-592795712
above comment doesn't fix for all apparently as I'm still having the issue and running latest unifi controller as well as 106.2
I need debug logs to understand why this doesn't work for all
unifi.zip
@Kane610 , running the latest Unifi Controller and HA version 106.2
I had to upgrade my unifi controller to get this to work - UniFi controller 5.12.35 works for me.
I'm running 5.12.35 and it's not working for me.
5.12.35 isn't working for me I can confirm this isn't being set to not_home.
Rolled back to .106.1 and still not updating.
Here are some logs, when I turn the wifi off on my ipad doesn't show any events under and its not setting the device as away, however when I turn the wifi back on i see entries in the log
wifi on
2020-02-29 10:32:11 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client device_tracker.mXXXs_ipad 88:e9:fe:10:86:09
2020-02-29 10:32:27 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client device_tracker.mXXXs_ipad 88:e9:fe:10:86:09
2020-02-29 10:32:29 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client device_tracker.mXXXs_ipad 88:e9:fe:10:86:09
2020-02-29 10:32:50 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client device_tracker.mXXXs_ipad 88:e9:fe:10:86:09
wifi off
No entries in the log, even after detection_time expires. (set to 20 seconds) also tried default of 300.
Thanks but I need proper logs, not a 4 line snippet. Like @mike9011, but I also need to see examples in the log when device connects and disconnects to the network
Can you guys also share your system setup, i.e. how you are running hass core and how you are running your controller, if it is behind reverse proxy, same/separate machine/cloud key, etc...
Ill have to get logs when I get a chance but my setup is one separate machines. Same network. Raspberry pi I both situations rubbing raspbian. Running core 0.106.2 one one and the one with unifi controller is running 5.12.35. previously worked I can't remember what version as had to purchase new SD card but like 0.104 or so unifi device tracking worked
5.12.35 is not working for me with 0.106.2, will provide som logs when i get back home tomorrow and have access to my computer again!
Here's my logs, not much useful in them, that's 4 hours worth and with devices connecting and disconnecting but no mention of them after the initial start up
home-assistant.log
I'm running Hass.io in Docker on a Ubuntu VM with the latest UniFi controller (5.12.35) as a Hass add-on and both my APs are running the latest firmware (4.0.80.10875). Have also turned off tracking of wired clients in the integration as this is mentioned in #30029
Controller is accessed by local IP from Hass
New log with aiounifi.api debugging enabled. Again no log entries after initial startup, it's like the integration stops responding.
same problem here :(
Same issue here aswell.
HA 106.2 in docker
Unifi 5.12.35 in docker
Different networks, accessed using local IP over IPsec
If I roll back to 105.5 it works as expected.
Like the description above, it seems like the integration stops resonding after the initial setup, nothing in the log files. After a few minutes, all devices is marked not_home
I had been experiencing this all day until I reverted to 0.105.
106.2 in LXC
Unifi 5.12.35 in LXC
I am using the web integration and I selected my SSID from the available list and restarted HA. When I did that the integration worked as expected for about 3-4 minutes and then set everyone to away.
Thanks but I need proper logs, not a 4 line snippet. Like @mike9011, but I also need to see examples in the log when device connects and disconnects to the network
Ok, in a few hours I should be able to get the logs.
Can you guys also share your system setup, i.e. how you are running hass core and how you are running your controller, if it is behind reverse proxy, same/separate machine/cloud key, etc...
Unifi 0.14.0, HA 106.2 not getting updates. All my devices are not home.
Thanks
I have the same problem:
I have a full Ubiquiti setup at home. Unifi APs, USG, two switches, and Cloud Key.
Latest firmware version for all. Running HassIO on Pi4. Presence detection works flawless with 0.105.5. Tried 0.106,1,2 - All devices show not_home. Uninstalled and reinstalled Unifi integration.
Went back to 0.105.5 until this is resolved.
Please let me know if I can provide further information, logs, etc.
Had to import unifi as custom component from github with checkout at this commit
https://github.com/home-assistant/home-assistant/commit/ed461a0ad85c272329746aa6ec284f1a9a90251d#diff-685ad66c5983a2746f6decd648c774fb
to have it working again.
this #32222 broke the client tracking apparently
Hi @Kane610 I'm able to give you my full and unfiltered logs. During log recording I've connected and disconnected a device to help the troubleshooting.
For security reasons, please let me send you the log file directly, without publishing here.
Thanks
Hi @Kane610 I'm able to give you my full and unfiltered logs. During log recording I've connected and disconnected a device to help the troubleshooting.
For security reasons, please let me send you the log file directly, without publishing here.
Thanks
Great. Do you think it can be shared by hass forums pm? or over discord
Hi @Kane610 I'm able to give you my full and unfiltered logs. During log recording I've connected and disconnected a device to help the troubleshooting.
For security reasons, please let me send you the log file directly, without publishing here.
ThanksGreat. Do you think it can be shared by hass forums pm? or over discord
Sure, you have a PM on hass forum :)
Had to import unifi as custom component from github with checkout at this commit
ed461a0#diff-685ad66c5983a2746f6decd648c774fb
to have it working again.
this #32222 broke the client tracking apparently
@subzero79 did you link to the right commit? The commit in #32222 points to this: https://github.com/home-assistant/home-assistant/pull/32222/commits/148f848bd346ee413b5604e48c379a7d5ea39e43
I've tried adding the UniFi component from 0.105.5 as a custom component but it doesn't like it
@stevehop the commit is the one before the 32222 pr. So I am pretty sure. I’ll check again when I get back home.
@stevehop and @blackskull182 in both your cases since you say there is a lot of activity going on with expectations of device connecting and disconnecting I'd say for some reason the web socket isn't set up properly,
@uhtredthebold so that would be the delay that keeps devices marked as home for default 300 seconds, so it might be in your case as well that the web socket signalling isn't working properly.
Could you guys run the library from the terminal? https://github.com/Kane610/aiounifi
python3 -m aiounifi ip user pass
And see if the signalling works better then?
@Kane610
Have run manually, after running it doesn't visibly register any connects/disconnects (see below)
bash-5.0# python3 -m aiounifi sitename test test123
sitename test test123 8443 default
Using selector: EpollSelector
Starting aioUniFi
[]
[]
[]
[]
[{'_id': '5d1c5d08efdf93017b9c2fe1',
'attr_hidden_id': 'default',
'attr_no_delete': True,
'desc': 'Not_in_use',
'name': 'default',
'role': 'readonly'},
{'_id': '5d1c5de4efdf93017b9c2ffc',
'desc': 'Default',
'name': 'uk5rs8fw',
'role': 'admin'}]
Websocket starting
state, starting
Websocket running
state, running
Could you guys run the library from the terminal? https://github.com/Kane610/aiounifi
python3 -m aiounifi ip user pass
And see if the signalling works better then?
If i run "-m aiounifi xxx.xxx.xxxx.xxx u p" i only get this:
Using proactor: IocpProactor
Starting aioUniFi
[]
[]
[]
[]
[{'_id': '5d44c5734cedfd0106b76905',
'attr_hidden_id': 'default',
'attr_no_delete': True,
'desc': 'Default',
'name': 'default',
'role': 'readonly'},
{'_id': '5d44c7144cedfd0106b76922',
'desc': 'Home',
'name': '4hh58mun',
'role': 'readonly'}]
Websocket starting
state, starting
Websocket running
state, running
Nothing happens when disconnect/connect.
You should get a lot of other data as well just updating data for different clients so for some reason the web socket isn't sending data back to aiounifi
You have emptied the initial lists right? because there should be a lot of data
My docker compose:
version: '2'
services:
unifi:
container_name: unifi
image: linuxserver/unifi-controller:latest
restart: unless-stopped
ports:
- 3478:3478/udp
- 10001:10001/udp
- 8080:8080
- 8081:8081
- 8443:8443
- 8843:8843
- 8880:8880
Having the same issue here where HA sees everything as offline.
In my case, aiounifi is seeing the transitions properly (simulated with a client force reconnect):
On Disconnect: "key":"EVT_WU_Disconnected","subsystem":"wlan"
On Connect: "key":"EVT_WU_Connected","subsystem":"wlan"
In addition, ever few seconds/minutes I'm receiving a large payload.
However, with HA set to debug logging though, after the initial configuration sync from Unifi, I'm not seeing any further updates come in from homeassistant.components.websocket_api nor aiounifi.api related to unifi.
What's interesting though is if I set the controller offline, I immediately receive updates in HA that the devices are unreachable.
You have emptied the initial lists right? because there should be a lot of data
No, I haven't emptied it.. this is the exact output I'm getting. Do I need to include a site name? Because my devices are not in the "default" site.
yes you need to specify site as well. The aiounifi version used by hass right now only manages web sockets on default site, something I missed initially but I have fixed it on master of aiounifi
@Kane610 : I pulled in the site changes that you made to aiounifi into the module used by HA and now I'm receiving the events correctly. WU_Disconnected/WU_Connected events are being shown as well as the periodic updates.
Monitoring progress of it but that might have been the overall issue - those not running on the "default" site aren't getting updates
EDIT: I also modified the default from "default" to my correct site ID.. haven't tested it w/out that
Just for the record: I experienced the same Unifi status problems with 0.106.2. As a matter of playing around I changed the IP address of the Unifi controller which "forced" me to delete the Unifi Controller integration (Configuration->Integrations) and create it again. Now I have everything working again. I did this 24 hours ago; everything is still running.
I'm running the Unifi Controller in a docker. I have my HA on it own Rpi 3+
Great, much better now, but unfortunately no logs/actions when i disconnect or connect a client.
Here is the complete logfile (~10 mins);
aiounifi.log
I'm running the Unifi Controller in a docker (Linuxserver version https://github.com/linuxserver/docker-unifi-controller) on the same machine as my Home Assistant.
@mike9011 are you running other site than default?
@mike9011 are you running other site than default?
Yes, I've used "-s [site id] " in the command.
@mike9011 and your running the code from the git repo? Or from pypi?
@Kane610 Yes i've downloaded the Master branch and ran the setup.
My docker compose:
version: '2' services: unifi: container_name: unifi image: linuxserver/unifi-controller:latest restart: unless-stopped ports: - 3478:3478/udp - 10001:10001/udp - 8080:8080 - 8081:8081 - 8443:8443 - 8843:8843 - 8880:8880
I run my Unifi Controller with this instead:
docker run -d --restart always --init -p 8080:8080 -p 8443:8443 -p 3478:3478/udp -p 10001:10001/udp -e TZ='Europe/Tallinn' -v unifi_data:/unifi --name unifi jacobalberty/unifi:stable
All working fine right now
so after the updated aiounifi with site support is integrated into HA, device tracking in non default sites should work again?
Issue is resolved for me in version 0.106.5! Thanks!
I can confirm resolved for me too 🙏
Thanks for verifying. I apologize for the issues of this release which could have been avoided...
0.106.5 looks good for me as well, thanks @Kane610 for fixing
Working now :+1:
0.106.5 did NOT solve it for me with Unifi Controller 5.12.35.
Devices are still considered home until i restart Home Assistant.
arch | x86_64
-- | --
dev | false
docker | false
hassio | false
os_name | Linux
python_version | 3.7.6
timezone | Europe/Stockholm
version | 0.106.5
virtualenv | true
@Silverridge can you share logs?
@Kane610 Absolutely, but nothing get written to the log...
What kind of logs would you like? home-assistant.log i presume? Would you like the Unifi-logs too?
Do you want me to turn on debuglogging for Unifi?
@Kane610 Absolutely, but nothing get written to the log...
What kind of logs would you like? home-assistant.log i presume? Would you like the Unifi-logs too?
Do you want me to turn on debuglogging for Unifi?
Precisely, Homeassistant debug log needs to be turned on, you can see how in the integration documentation. I only need home assistant side AFAIK. Lets start with that at least
Not working for me either. I see the same behavior as 0.106.2. Devices are never reported as home, even after restarting Home Assistant. I use Unifi LTS, so currently version 5.6.42.
Can I email logs to you so I don't have to redact them?
@Kane610 Ok, I will do a couple of tests and attach the logs once i get home. So you'll have them in a couple of hours.
@kmlucy share them through pm on hass forum
@Kane610 What is your username?
Robban. You mihht need to consider upgrading to latest unifi release. Let's see what the logs say
Just sent the logs. I don't feel the need to get the latest features and much prefer stability for network infrastructure. Unifi 5.6.42 works perfectly with 0.105, and I'm not inclined to update to the latest branch for compatibility when it previously worked.
@Kane610 Theres nothing in the logs regarding disconnects...
Added debug for unifi, restarted Home Assistant and disconnected a phone (60sek is the required interval for Unifi to consider a phone disconnected) and waited 90sec - nothing.
Connected to wifi again and waited 90sec, then disconnected again for 90 sec but nothing gets logged and the client is considered home all the time.
Below are the relevant lines regarding the device i disconnected and reconnected:
2020-03-04 16:37:30 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] New UniFi client HUAWEI_P20_Pro RX (xx:xx:xx:xx:xx:xx)
2020-03-04 16:37:30 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] New UniFi client HUAWEI_P20_Pro TX (xx:xx:xx:xx:xx:xx)
2020-03-04 16:37:31 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] New UniFi client HUAWEI_P20_Pro (xx:xx:xx:xx:xx:xx)
2020-03-04 16:37:46 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client sensor.huawei_p20_pro_rx xx:xx:xx:xx:xx:xx
2020-03-04 16:37:46 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client sensor.huawei_p20_pro_tx xx:xx:xx:xx:xx:xx
2020-03-04 16:37:46 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client device_tracker.huawei_p20_pro xx:xx:xx:xx:xx:xx
2020-03-04 16:40:21 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client sensor.huawei_p20_pro_rx xx:xx:xx:xx:xx:xx
2020-03-04 16:40:21 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client sensor.huawei_p20_pro_tx xx:xx:xx:xx:xx:xx
2020-03-04 16:40:21 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client device_tracker.huawei_p20_pro xx:xx:xx:xx:xx:xx
2020-03-04 16:40:52 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client sensor.huawei_p20_pro_rx xx:xx:xx:xx:xx:xx
2020-03-04 16:40:52 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client sensor.huawei_p20_pro_tx xx:xx:xx:xx:xx:xx
2020-03-04 16:40:52 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client device_tracker.huawei_p20_pro xx:xx:xx:xx:xx:xx
2020-03-04 16:41:35 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client sensor.huawei_p20_pro_rx xx:xx:xx:xx:xx:xx
2020-03-04 16:41:35 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client sensor.huawei_p20_pro_tx xx:xx:xx:xx:xx:xx
2020-03-04 16:41:35 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client device_tracker.huawei_p20_pro xx:xx:xx:xx:xx:xx
2020-03-04 16:42:11 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client sensor.huawei_p20_pro_rx xx:xx:xx:xx:xx:xx
2020-03-04 16:42:11 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client sensor.huawei_p20_pro_tx xx:xx:xx:xx:xx:xx
2020-03-04 16:42:11 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client device_tracker.huawei_p20_pro xx:xx:xx:xx:xx:xx
2020-03-04 16:42:51 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client sensor.huawei_p20_pro_rx xx:xx:xx:xx:xx:xx
2020-03-04 16:42:51 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client sensor.huawei_p20_pro_tx xx:xx:xx:xx:xx:xx
2020-03-04 16:42:51 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client device_tracker.huawei_p20_pro xx:xx:xx:xx:xx:xx
2020-03-04 16:43:25 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client sensor.huawei_p20_pro_rx xx:xx:xx:xx:xx:xx
2020-03-04 16:43:25 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client sensor.huawei_p20_pro_tx xx:xx:xx:xx:xx:xx
2020-03-04 16:43:25 DEBUG (MainThread) [homeassistant.components.unifi.unifi_client] Updating client device_tracker.huawei_p20_pro xx:xx:xx:xx:xx:xx
I redacted everything else since i got alot of clients connected and the log fills up pretty quick in debug mode.
I’ve upgraded to 0.106.5 and my devices will show “home” for 5 minutes and the change to “away” and stay in this state.
@Kane610 I did a little more research and realized that Ubiquiti uses the LTS label differently than I am accustomed to. The LTS branch is solely to support EOL equipment, and the latest branch is the stable branch. I've updated to 5.12.35 and my device trackers are now working properly with 0.106.5.
My setup is working perfectly with 0.106.5. Thank you for the quick fix @Kane610
Unfortunately the error seems to be intermittent.
Today everything is working as intended, yesterday it didn't work at all.
I'll recheck the connectivity-status-issue with more devices later today.
@WilldabeastHA: I had the same behavior within my installation. For me the solution was to upgrade to the newest version of Unifi Network Controller software. I didn't notice that they have switched the repositories for Ubuntu/Debian and the newer versions. So I didn't get any updates but thought I was up to date. After updating everything works just fine again.
@MyersGer what repository are you using for the unifi controller? I had updated mine to 5.12.35 from jacoblberty/unifi but had really bad connectivity issues with devices that never had an issue before so I rolled back to 5.10.25 and the connectivity issue went away. I’m usually good about being on the latest releases but this is non-negotiable as i need to have clean connectivity for all my devices ~50ish.
updated from 105.2 to 106.5 at night. at first, everything seemed to be fine but as soon as devices were in motion in the morning, the issue started to appear for me.
at the moment, it does look like devices are marked as away as soon as they switch from one AP to another AP.
Unifi version is 5.12.35
Logs please @GatoPharaoh
@WildbeastHA
I am using 5.12.35 using the repository mentioned in this howto: https://help.ubnt.com/hc/en-us/articles/220066768-UniFi-How-to-Install-and-Update-via-APT-on-Debian-or-Ubuntu
I didn't noticed any connectivity issues yet and it works with home-assistant (for me it does). But I didn't test what happens at the moment when one device switches to another AP. I will also have look at this.
Is this the same issue as this thread? I am having issues where devices that are away on restart do not show as away but rather unavailable and never report their status even after returning home.
https://community.home-assistant.io/t/unifi-devices-tracker-missing-on-restart/130926
I tried updating my controller software from stable (5.12.35) to the latest release candidate (5.12.66) in hopes it would fix this, but still had the same issues with 0.106.5. I rolled back to Unifi 5.12.35 and 0.105.5 and everything works great again. I've tried a lot of things with 0.106.x including disabling firewall rules, trying privileged containers in Proxmox, etc. Many of these were not acceptable as long term options, but trying to rule everything out and nothing worked except rolling back to Home Assistant 0.105.5. No matter what I tried, devices would report home initially, then after 10 or so minutes, everything would show up as not_home simultaneously.
@gregg098 logs?
@Nixon506E yes
Unfortunately I did not keep the logs since downgrading to 0.105.
@gregg098 logs?
@Nixon506E yes
You are Robban on the Home Assistant forums correct? Just sent you a pastebin link in a PM.
Lets see if this new PR helps improve your situation. I hope this is merged for next release and that you can try it out
@Silverridge those logs doesn't contain any data from aiounifi which is where the web socket events are printed
@Kane610 how can I help get this sorted out? I'm looking for some guidance. I'm using unifi controller and it has been very stable on 5.10 but with the new HA update you say it requires you to update to 5.12.35 for you to be able to track home/away. When I update to 5.12 the devices I want to track home/away (mobile phones) get poor signal strength in my office where it never did before and one of the phones will drop off the network causing it to show away every 10-15 minutes. I didn't change a single setting but now the presence detection doesn't work worth while and I don't get a strong enough signal in my office.
@WilldabeastHA sounds weird that updating the controller would affect the signal strength of your wifi, that would be your access points + firmware
@Kane610 i would agree with you and I’m just as surprised as you are. It wasn’t a firmware update to the AP, it was upgrading the controller. Someone mentioned that in the 5.12 release there are some “WIFI AI” settings that are enabled by default but I’ve changed them every way and it doesn’t seem to make a difference.
Lets see if this new PR helps improve your situation. I hope this is merged for next release and that you can try it out
Thanks for working on a fix. Any way to test this before the next release?
@gregg098 either for hass core repo or wait for the beta release
@gregg098 @Kane610 I've been deploying the dev versions of the container as a test environment. No luck with presences detection unless I’m on unifi controller 5.12 but then I have other issues with connectivity. Overall a bad scenario.
@WilldabeastHA have you found any similar issues on unifi forums?
@Kane610 I’ve been able to resolve one of my issues with mobile connectivity from a distance. In the 5.12 release of the unifi controller they auto enable a lot of beta features. By turning off “forcing high performance devices to 5G”, I was able to resolve my connectivity issues in my office. Currently with some of the changes I’ve made in the controller, it appears things are much more stable. I will be monitoring this over the next week or so. Thank you!
@WilldabeastHA that's great to hear, thanks for the feedback. Lets hope that was the last of the main issues
@Kane610 I just updated to Home Assistant 0.108.0.dev20200314 which has your fix, but I get the same results as before. Entities are home, then go not_home after a few minutes. Logs look the same as the ones I sent you previously.
@Kane610 I just updated to Home Assistant 0.108.0.dev20200314 which has your fix, but I get the same results as before. Entities are home, then go not_home after a few minutes. Logs look the same as the ones I sent you previously.
Same issue here where devices that are away during a restart never update from unavailable status. Can we get this reopened?
@Nixon506E Im running HA v 0.108.0.dev20200317 with the unifi controller v 5.12 and everything works great. The thing that made the difference for me to make it all work was upgrading to the latest unifi controller container. Hope that helps.
@WilldabeastHA I have been running 5.12.66 for the last week, everything works as long as all devices are present when home-assistant is restarted but if any are away those devices do not update
@Nixon506E I had the latest controller and even tried upgrading to a newer Beta/RC and saw no change. Reverting back to Hass .105.x worked everytime. I finally just removed Unifi and started using ping so that I could upgrade Hass and have a second presence detection method. Works OK as a workaround, but a stable Unifi component would be nice.
I am experiencing here a slightly different issue:
Clients on my guest wifi (with guest policies applied) will be set to away
randomly.
Only clients on my regular wifi are correctly shown as home/away.
Would love to receive a fix for that!
Try out the beta to see if it is fixed in 0.112
Good so far, @Kane610
Most helpful comment
Thanks for verifying. I apologize for the issues of this release which could have been avoided...