Open jkfranks9 opened 1 month ago
HI,
Thanks for the report. Which HA version are you running?
HA OS: Core 2024.10.3, Supervisor 2024.10.2, OS 13.2. But this started a few updates ago, not sure exactly what I was running then.
hey,
Bad news / good news... This weekend I got some time to look into the problem, and to look into the code of other integrations trying to find the solution. To my surprise I just discovered that the oficial Ubiquity Network integration can do the same things as mine now. I wrote mine sometime ago because the oficial integration was focused on presence detection but now it can do much more. So, the bad news, I'm willing to deprecate the unifics integration in favor of the oficial integration. I also should write how to configure the Ubiquity Network integration because there's a little catch (by default one kind of sensor comes disabled).
Thank you for digging into this! I also use the official UniFi Network integration, but never noticed that it provides the same counts you do. I enabled the various clients
sensors and everything is there in slightly different form, so that will work for me.
Thanks again for providing your integration. I've used it ever since I discovered it.
At random intervals Unifics gets a permission denied error when updating clients. I don't know why this happens because it runs fine most of the time. But the code takes an exception when this happens, and the following things occur:
It might be tempting to say fix whatever is causing the permission denied error, but how such an error is handled should definitely be cleaner. I don't know what Unifics is doing that is causing HA to grind to a halt for over a minute, but maybe it has something to do with the various async problems that have been reported, and fixed, previously. Just a guess.
I think Unifics should test for an
errorCode
return in theclients
variable when executing the loop at line 197 in sensor.py, and handle the error with a message instead of taking an exception. I think it's worth investigating what else is going on that causes the long delay, but perhaps just handling the error would avoid (mask) that particular problem.I did remove Unifics for over 24 hours and did not see any problems at all. With Unifics running, I see this error several times a day. It does recover quickly, but is nevertheless an annoyance.
Here is an annotated log snippet: