azogue/eventsensor

expire status after x seconds

Closed this issue · 3 comments

Using eventsensor to track motion sensor events from my netatmo camera.
Currently the state stays in the last detected motion.

Similar to MQTT sensor, is it possible to expire the status after a while?

This so the state goes back to off after e.g. 10 seconds.

I've worked around this via a binary sensor that turns off after a timeout you can specify:

binary_sensor:
  - platform: template
    sensors:
      netatmo_camera_garage_animal_detected:
        friendly_name: "Netatmo Camera Garage Tier erkannt"
        value_template: >-
          {% set foo = states('sensor.current_time_24hstring') %}
          {{ is_state('sensor.netatmo_camera_garage_animal', 'animal') and as_timestamp(now()) - as_timestamp(state_attr('sensor.netatmo_camera_garage_animal', 'time_fired')) <= states('input_number.netatmo_events_cooldown_time') | int }}

image
image
Works like a charm ;-) And also due to being binary sensors they show their state if you use the camera feed in a picture glance.

yes that could be used as a workaround. Was hoping not to need an extra sensor.

Hi @Fabenissimo, @wivaku
Maybe for this kind of scenarios the recent (and much-more-and-better-maintained) implementation in HA Core for Trigger-based binary template sensors from HA v2021.5.0 is a better solution ;-)

I don't think I'd have the time to implement this feature, and looking to the HA Core evolution, looks like soon this custom integration could be archived, which is always a good thing, so I'm closing this issue, along with #25