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

Template use to set entity_id

$
0
0

@c0revin wrote:

Hi all,

I try to set some input_boolean to “on” when certain input_select option is activated, and I want the previously active input_boolean to be turned of.

I wrote the following code and it parses fine, but no input_booleans get turned on.

help appreciated!


- alias: some input_booleans - external update
  trigger:
    - platform: state
      entity_id: input_select.remote_activities
  condition:
    condition: template
    value_template: "{{ trigger.to_state.state != 'unknown' }}"
  action:
    - delay: '00:00:20'
    - service: input_boolean.turn_on
      data_template:
        entity_id: >
          {% if is_state(trigger.to_state), 'act 1' %}
            input_boolean.act1
          {% elif is_state(trigger.to_state), 'act 2' %}
            input_boolean.act2
          {% else %}
            input_boolean.dummy
          {% endif %}
    - service: input_boolean.turn_off
      data_template:
        entity_id: >   
          {% if is_state(trigger.from_state), 'act 1' %}
            input_boolean.act1
          {% elif is_state(trigger.from_state), 'act 2' %}
            input_boolean.act2
          {% else %}
            input_boolean.dummy
          {% endif %}

Posts: 12

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 95919

Trending Articles