I have added zoneminder camera events to a binary sensor using:
- platform: trend
sensors:
lrcamalarm_event:
entity_id: sensor.livingroom_alarm_events
sample_duration: 30
The idea is to note if an event has occurred on the camera per zoneminder config in which case the trend sensor goes to on state. The issue i have is that I’d like to then have the trend go back off after a period of rest. As-is it stays in on state. Is there a setting for this, or do i simply need to create an automation to do this? Something like, if the sensor does not increase in 60seconds turn state to off? Anyone have a hint as to how i’d go about doing that?
In this use-case, the events state is set to an integer as set by zoneminder. So if there are 5 events currently in my zoneminder setup, and the livingroom camera sets off another event, the event state will increase to 6. What i’d like to do is use that to trigger an automation, and then do so again if the event increases to 7 after a 60 second cool down. The further issue is what if during that 60 second period events go to 7 or 8. So after cool down I’d need to read the current state, and set a new trigger point to state+1. This is a bit above my current level of expertise, though if anyone has an example of how to do that, or anything they could point me to im sure i could figure it out with relative ease.
Long story short, however, the trend sensor seems to be a good fit as it should just go to off status after a period of rest and then it would trigger should the state change - exaclty as i wish. I just did not understand the documentation enough to know if there was a configuration possibility for that. I tried
sample_duration: 30
as shown in my code above, but obviously this is not the piece i seek.
Thank you!
John