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

Variable for entity_id in trigger

$
0
0

Is it possible to use a variable for the entity_id in triggers?
For instance:

  - id: auto_to_on
    platform: state
    entity_id: binary_sensor.backyard_hue_sensor_motion
    from: 'off'
    to: 'on'
  - id: auto_to_dim
    platform: state
    entity_id: binary_sensor.backyard_hue_sensor_motion
    from: 'on'
    to: 'off'
    for: '00:02:00'
  - id: auto_to_off
    platform: state
    entity_id: binary_sensor.backyard_hue_sensor_motion
    from: 'on'
    to: 'off'
    for: '00:02:30'

be something like

  variables:
    sensor: binary_sensor.backyard_hue_sensor_motion

  trigger:
  - id: auto_to_on
    platform: state
    entity_id: "{{ sensor }}"
    from: 'off'
    to: 'on'
  - id: auto_to_dim
    platform: state
    entity_id: "{{ sensor }}"
    from: 'on'
    to: 'off'
    for: '00:02:00'
  - id: auto_to_off
    platform: state
    entity_id: "{{ sensor }}"
    from: 'on'
    to: 'off'
    for: '00:02:30'

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 105524

Trending Articles



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