I’m creating this post because I couldn’t find a Unifi Protect topic by @guim31 If it already exists, please just move it.
In Home Assistant, I have an automation that I can’t recreate in Gladys. We have facade lighting, and I turn it on based on the brightness values provided by my Unifi cameras. However, the integration doesn’t provide these properties. Maybe this could be added?
Unfortunately, the official Protect API (the „Integration API“ with API key that this integration uses) does not provide a brightness value for the cameras: Neither in lux nor day/night status. Home Assistant reads it via the internal Protect API with username and password, and I deliberately do not use that.
What the integration does have: the brightness of the UniFi sensors (e.g. UP-Sense) in lux. If you have one, you can switch your facade lighting in a scene via it. Otherwise, it also works via the sunset (trigger „Sunset“ of the house).
I understand. May I ask why there isn’t an option with a username/password combination? At least optionally? That would allow for significantly more values. I checked again, the cameras don’t provide lux values, but a normal binary value isDark true/false.
I already tested sunrise and sunset. Unfortunately, it works extremely unreliable because it is based on times. Brightness is always correct I will test it again here specifically.
Version 1.1.0 (Update via Gladys): There is now an optional username and password for a local account of the console in the configuration. This gives each camera the function „Dark“ (on/off), which reads isDark every minute. After saving, the „Discover“ tab offers „Refresh“ for the cameras.
A few notes:
A local account without two-factor authentication, ideally a dedicated one just for Gladys with read-only permissions on Protect.
Without these fields, nothing changes, everything continues to run via the API key.
This is the internal, undocumented API: A Protect update can break it. I don’t have a Protect console, so you’re the first real test. „Test connection“ shows on how many cameras the night detection is read.