Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 96121

Automation. Trigger if sensor NOT updated AFTER input_boolean. Surely there's a better way than this!

$
0
0

@klogg wrote:

I have a really simple requirement so I probably can’t see the woods for the trees…

When an input_boolean changes state I need to be notified if a sensor doesn’t also change state after, but within, a very small (almost zero) number of seconds.

I have this which I can’t believe is the best way to achieve it (and to be honest I haven’t tested it anyway so it might not even work!)

What am I missing to make this better?

  - alias: Warning
    trigger: 
      - platform: state
        entity_id:
          - input_boolean.some_boolean
          - input_boolean.some_other_boolean

    action:
      - wait_template: >
          {{ as_timestamp(states.sensor.my_sensor.last_changed) - 
             as_timestamp(trigger.now) < 10 }}
        timeout:
          seconds: 12

      - condition: template >
          {{ as_timestamp(states.sensor.my_sensor.last_changed) - 
             as_timestamp(trigger.now) > 10 }}

      - service: notify.blah_blah

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 96121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>