Feature Request: Binary Sensor for camera online status
Closed this issue · 6 comments
Having a binary sensor for the online status of a camera would be useful. I also noticed that occasionally the plugin will show a camera as online, even though it is currently offline. So updating the frequency of checking the online status of a camera might be useful as well.
Beta 2 is now out, which implements the Online Binary Sensor. I am listening for the event SecuritySpy sends when it detects a Camera goes On- or Offline, so the update is as fast as I get the data from SS.
I used the opportunity to re-write a lot of the code, to bring it more up to date with HA coding practice, so please also check other parts of the Integration for breaking stuff.
Let me know what you think.
Looks good. It did make a second copy of all of my cameras though, so I had to delete the config and reinstall it.
I tested it with a camera I have connected to a smart plug. If I turn it off, the online binary sensor quickly changes to Off correctly. If I turn it on, it quickly goes back to On correctly. But I've noticed that camera going offline in Security Spy, and the binary sensor not updating correctly. So I'm wondering if it's an issue with Security Spy being able to connect to the camera but receiving corrupted video or something, so Security Spy considers it online even though it's not. It does show OFFLINE next to its name in the SS web interface though.
Anyway, since I've tested it by physically turning power to the camera on and off, and your integration works correctly, I'm guessing that's an issue with SS and not the integration. Thanks again for these great integrations. The UnifiProtect plugin and this one are two of my favorites. I think you saw my post on Reddit yesterday with the package box/doorbell greeting.
Glad to hear that it works more or less as expected.
So I'm wondering if it's an issue with Security Spy being able to connect to the camera but receiving corrupted video or something, so Security Spy considers it online even though it's not
I am not getting this on the cheap ptz camera I bought. I can see in the SS display that the camera goes offline and the HA sensor goes off and then it tries to reconnect in SS and once that is complete, it will also go back to Online status in HA.
Also tried to reboot one of the UniFi cameras that are setup in SS via the UDMP, and that also works as expected.
It must be camera specific if the stream is corrupted or maybe a SS bug, I just can't simulate it here with the cameras I have.
I think you saw my post on Reddit yesterday with the package box/doorbell greeting
No I did not see that - I am actually never on Reddit, I find, that unless you are there a lot, it easy becomes information overload. But I would be happy to see what you wrote - can you post a link?
It did make a second copy of all of my cameras though
I decided to follow a more stringent practice in the naming of entities, so that they all follow the same pattern, and as such Cameras and other sensors got renamed, which is causing the need for delete/reinstall.
I will release V1.1.0 later today, with more specific upgrade instructions which is exactly what you did - Delete the Integration and add it again.
Thanks for your help in testing this out.
Release V1.1.0, so I will close this now.
This was the post I made on Reddit. I guess another developer who worked on your Unifi Protect integration commented. I assumed it was you.
Yes AngellusMortis is one of the two experienced guys, that really pushed all the progress in the last two months. Fantastic to have them with me on the project.