Hi, I would appreciate any help from seasoned tinkerers.
here is my situation I have a sensor that monitors the turns of a door lock, this works flawless based on the states that HA is getting from the sensor. So according to the sensor when the lock is not moving I get the off state.
when lock goes from non-locked to unlocked I have one state change from off to on and rest at off
when lock goes from non-locked to locked I get 5 state changes from off to on and rest at off
when lock goes from locked to unlocked I get 7 state changes from off to on and rest at off
if somehow I can count the times that on state occurs within eg 40 seconds this will give me an accurate indicator of the lock status.
so to sum up if within 40 seconds I have only one state change from off to on then off the lock is unlocked. If I have 5 state changes within 40 seconds then the lock is locked. if I have 7 state changes within 40 seconds then the lock is unlocked.
Obviously the 40 seconds should elapse before it reports the final count else the 5 times will be always triggered before the 7.
this below shows the state changes that occur in order to identify this event as the door is locked (5 on state changes).
2:59:44 AM Door Window Sensor_158d0003ce43c0 is closed
2:59:44 AM Door Window Sensor_158d0003ce43c0 is opened
2:59:44 AM Door Window Sensor_158d0003ce43c0 is closed
2:59:43 AM Door Window Sensor_158d0003ce43c0 is opened
2:59:43 AM Door Window Sensor_158d0003ce43c0 is closed
2:59:42 AM Door Window Sensor_158d0003ce43c0 is opened
2:59:42 AM Door Window Sensor_158d0003ce43c0 is closed
2:59:42 AM Door Window Sensor_158d0003ce43c0 is opened
2:59:41 AM Door Window Sensor_158d0003ce43c0 is closed
2:59:41 AM Door Window Sensor_158d0003ce43c0 is opened
2:37:16 AM Door Window Sensor_158d0003ce43c0 is close
I hope everything makes sense, this should be doable just don’t know how. thank you for your help.