xannor / ha_reolink_rest

ReoLink REST/Web Camera Integration for Home Assistant
24 stars 3 forks source link

Enhancement Request: Add Light Control #40

Open SergeantPup opened 1 year ago

SergeantPup commented 1 year ago

In the native Reolink app, you have 3 options to control camera lights: by schedule per camera by motion per camera Manually pressing the flashlight indicator per camera in the app

To my knowledge, the only place you can control the light of the camera in real time is the flashlight icon in the app. It stands to reason that light control might be available via API. This request is to add light control - on/off to the cameras for this integration.

The lights are extremely bright and I now have 7 cameras. That's a considerable amount of outdoor light power if I'm able to control it in aggregate like in Home Assistant.

The primary reason I want this is so when an outdoor siren is triggered, it can turn on all camera lights (along with my household exterior lights) and start recording on all cameras.

Shooting for the moon would be asking for the siren control too but I'm not as confident that's available in the API.

xannor commented 1 year ago

Actually, floodlight control is in the api, and I am building it into the next release, the big holdup I am running into, aside from incessantly rewriting the code over and over, is currently the only event system is the onvif motion notifications, so I have no way, other than polling to tell when the lights are on or off. polling for a short while after UI commands is no issue, but detecting the state change of other reasons is an issue (such as via the app) The same goes for the IR LEDs and the power indicator (on models that have them.) but I wont add those until after I figure out a good approach for the floodlight. I am hoping their webhook stuff will handle other events and they will quickly backport it to all of their devices.

SergeantPup commented 1 year ago

I don't have a good suggestion for you there. I was thinking something like "assume after 5 minutes, the light is off" and always update the status to match but that won't work for non motion light scenarios like if they're scheduled in the app.

Maybe build it where HA has the assumed state that it can track and anything that triggers the light outside of that is just tough bananas because it can't track that. That's certainly acceptable for me because I'll only ever control lights through HA.

xannor commented 1 year ago

Its not that long, I actually poll a device around every 30 seconds (which is adjustable in the settings) so that poll time is the longest there should be between updates. I just would rather the device push changes instead, as that is the expectation people will have coming from the app (which can do pushes because it does not use the rest API but a more complete proprietary one.) But aside, I do plan to have the floodlights (not the device one but what the "ability" is called in the api) in my next release.