Use input_boolean for switch state writed in input_text

Hi, i have input_text.switch_text = switch.sonoff and when i use

automation:
- alias: Automazioni test
  id: Automazioni test
  trigger:

  - platform: state
    entity_id:
      - input_boolean.switch_test
      - switch.sonoff
    from: 'on'
    to: 'off'
    id: switch_off

  - platform: state
    entity_id:
      - input_boolean.switch_test
      - switch.sonoff
    from: 'off'
    to: 'on'
    id: switch_on

this work…if use:



automation:
- alias: Automazioni test
  id: Automazioni test
  trigger:

  - platform: state
    entity_id:
      - input_boolean.switch_test
      - "{{ states('input_text.switch_text') }}"
    from: 'on'
    to: 'off'
    id: switch_off

  - platform: state
    entity_id:
      - input_boolean.switch_test
      - "{{ states('input_text.switch_text') }}"
    from: 'off'
    to: 'on'
    id: switch_on

not work…the state of switch not change

You can’t use a template in a state trigger for the entity_id. You can create a template trigger though and use the value of the switch state there.

1 Like

Unfortunately, u can’t have dynamic entity state tracking “natively”. But it’s possible with a bit of hacking/compromises:

1 Like