"on" condition for multiple entities

I want to send a notification if one of the smoke detecors state is “on”
But I have to match only for the state “on” not “off”
This is my not working condition :grinning:

alias: Brandmelder
description: ''
trigger:
  - platform: state
    entity_id:
      - binary_sensor.smoke_buero
      - binary_sensor.smoke_paul
      - binary_sensor.smoke_philipp
      - binary_sensor.smoke_pool
      - binary_sensor.smoke_sz
      - binary_sensor.smoke_stiegenhaus
      - binary_sensor.smoke_stueberl
      - binary_sensor.smoke_wz
      - binary_sensor.smoke_waschkueche
condition:
  - condition: template
    value_template: "{{ trigger.platform.state == 'on' }}"
action:
  - service: notify.pushover
    data:
      message: Es brennt auf {{ trigger.from_state.attributes.friendly_name }}
      title: ACHTUNG
mode: single

Any Idea how to match for the state “on” ?

alias: Brandmelder
description: ''
trigger:
  - platform: state
    entity_id:
      - binary_sensor.smoke_buero
      - binary_sensor.smoke_paul
      - binary_sensor.smoke_philipp
      - binary_sensor.smoke_pool
      - binary_sensor.smoke_sz
      - binary_sensor.smoke_stiegenhaus
      - binary_sensor.smoke_stueberl
      - binary_sensor.smoke_wz
      - binary_sensor.smoke_waschkueche
    to: 'on'
    from: 'off'
action:
  - service: notify.pushover
    data:
      message: Es brennt auf {{ trigger.from_state.attributes.friendly_name }}
      title: ACHTUNG
mode: single

or create a group of entities and trigger on that.

2 Likes

You just need to make a small adjustment to your condition template:

condition:
  - condition: template
    value_template: "{{ trigger.to_state.state == 'on' }}"
1 Like

That’s true but why keep it as a condition that will fire for any state change rather than trigger off the actual triggering criteria. THis would make the debugging module less effective as well. But yes you can do it via the condition.

1 Like