Triggering automation from sensor state change

I have built two automations that are almost identical. One is triggered off of an input_boolean and it works. The other is triggered off of a sensor and it does not work (it is never triggered).

Here is the input boolean and sensor definitions from configuration.yaml

input_boolean:
  jeremy_home:
    name: 'Jeremy Home'
    initial: off

sensor:
  # my custom presence sensor for Jeremy and Nichole
  - platform: template
    sensors:
      jeremy_home_away:
        friendly_name: "Jeremy Home"
        value_template: "{% if is_state('input_boolean.jeremy_home', 'on') %}Home{% else %}Away{% endif %}"
      nichole_home_away:
        friendly_name: "Nichole Home"
        value_template: "{% if is_state('input_boolean.nichole_home', 'on') %}Home{% else %}Away{% endif %}"

This trigger does work:

    trigger:
      - platform: state
        entity_id: input_boolean.jeremy_home, input_boolean.nichole_home
        from: 'off'
        to: 'on'

This trigger does not work:

    trigger:
      - platform: state
        entity_id: sensor.jeremy_home_away, sensor.nichole_home_away
        from: 'away'
        to: 'home'

The obvious workaround for this specific case is to just use the input_boolean as the trigger. I would like to understand why the sensor trigger doesn’t work. Any ideas?

Have you tried

        from: 'Away'
        to: 'Home'

Case matters!

2 Likes

That worked. Thanks! Now that you have pointed it out, I can see the upper case characters in the STATES (<>) view.