I have a hardwired alarm system with lots of door contacts and PIRs, all of which are exposed as binary sensors in home assistant. I’d love to be able to use automations to trigger detection-based recordings on my Unifi Dream Machine when one of those binary sensors turns on. The smart detections in UFP are pretty good, but I still get way too many false triggers. It would be so much easier to skim the events list for a door camera if it only had clips of when the door was actually opened. (I suppose I could buy a bunch of Unifi sensors, but I’m not too enamored with them because they’re Bluetooth, and I still wouldn’t be able to use conditions in a home assistant automation.)
I read over the API and CLI documentation for pyunifiprotect on Github and there’s no obvious (to me, at least) way to POST an event, but it seems like maybe it wouldn’t be too difficult for someone who knows what they’re doing?
Not sure if it helps, but I have my in-garage camera switch from detection recording to continuous when the RATGDO sensor indicates the garage door is opening (and the reverse when it closes).
Under each camera in the Unifi Protect integration, there will be setting for “Recording Mode”, with the options of “Always”, “Never”, “Schedule” and “Detections” changing that option in HA will reflect the change in Protect almost instantly.
Here’s the sample YAML from my automation that changes the mode of the camera:
It’s inspired me to give some thought to taking a different approach since I can’t get Unifi Protect to do what I need it to do (which is record continuously and mark events when a physical sensor is triggered, instead of when video motion detection is triggered).
Unfortunately, it doesn’t seem possible to tell Unifi to register an event indeed. Also, there seems to be a bug in the Unifi app causing the recording not to be visible, while in the web app it is (it can only be found by a light blue bar that’s hardly noticeable).