Use * to select all entities in a trigger

Hi All,

Im want to make scripts bit nicer and shorter is it allow to change this script into the second one. Will this work?

YAML Lint gives “Valid YAML”

- alias: "Scene - Evening"
  trigger:

    - platform: time_pattern 
      minutes: "/1"

    - platform: state
      entity_id: sun.sun

    - platform: state
      entity_id: binary_sensor.sensor_manual_family_home

    - entity_id: sensor.harmony
      platform: state
      to: "off"

    - platform: state
      entity_id: input_boolean.scene_evening

    - platform: state
      entity_id: input_boolean.scene_appletv

    - platform: state
      entity_id: input_boolean.scene_tv

    - platform: state
      entity_id: input_boolean.scene_kodi
    
    - platform: state
      entity_id: input_boolean.scene_goodnight

  condition:
    - condition: state
      entity_id: sun.sun
      state: "below_horizon"

    - condition: state
      entity_id: input_boolean.scene_evening
      state: "off"

    - condition: state
      entity_id: input_boolean.scene_goodnight
      state: "off"

    - condition: state
      entity_id: sensor.harmony
      state: "off"

    - condition: state 
      entity_id: binary_sensor.sensor_manual_family_home
      state: "on"

  action:

into this:

- alias: "Scene - Evening"
  trigger:

    - platform: time_pattern 
      minutes: "/1"

    - platform: state
      entity_id: sun.sun

    - platform: state
      entity_id: binary_sensor.sensor_manual_family_home

    - entity_id: sensor.harmony
      platform: state
      to: "off"

    - platform: state
      entity_id: input_boolean.scene_*

  condition:
    - condition: state
      entity_id: sun.sun
      state: "below_horizon"

    - condition: state
      entity_id: input_boolean.scene_evening
      state: "off"

    - condition: state
      entity_id: input_boolean.scene_goodnight
      state: "off"

    - condition: state
      entity_id: sensor.harmony
      state: "off"

    - condition: state 
      entity_id: binary_sensor.sensor_manual_family_home
      state: "on"

  action:

No, that is not valid syntax. Put the input booleans in a group and trigger off that.

1 Like

Oh thats a good one. I’ll go test that one. Thanks for the solution!