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

Automation help : condition to check if state hasn't changed

$
0
0

Greetings,

I have this automation code:

alias: Relay1S ON Fail Alert
description: ""
triggers:
  - trigger: state
    entity_id:
      - input_boolean.head_office_presence_indicator
    to: "on"
conditions: []
actions:
  - choose:
      - conditions:
          - condition: state
            entity_id: sensor.relay1s
            state: "OFF"
            for:
              hours: 0
              minutes: 1
              seconds: 0
        sequence:
          - action: notify.gmail
            metadata: {}
            data:
              message: Relay 1S ON Fail
              title: Relay1S ON Fail
mode: single

I want an email alert if sensor.relay1s is OFF a minute after input_boolean.head_office_presence_indicator turns on. I’m not sure if the above code would accomplish this - I’m guessing the action will trigger only when sensor.relay1s CHANGES TO OFF and STAYS OFF for a min. This is not what I’m looking for - I want to be notified if it’s OFF after 1 min, regardless of it changing to OFF. Here’s an another attempt to accomplish the same:

actions:
  - sequence:
      - delay:
          hours: 0
          minutes: 1
          seconds: 0
          milliseconds: 0
      - choose:
          - conditions:
              - condition: state
                entity_id: sensor.relay1s
                state: "OFF"
            sequence:
              - action: notify.gmail
                metadata: {}
                data:
                  message: Relay1S ON Fail
                  title: Relay1S ON Fail
mode: single

The 2nd code waits for a min. and then checks to see if sensor.relay1S is OFF - should the sensor change to OFF again in this case? Will the action fire if it was OFF prior and hasn’t changed since?

Hope this makes sense. I’m not sure which version of the code to use for this and if any changes need to be made.

Thanks.

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 106627

Trending Articles



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