i want to have a switch which when switched on (from the lovelace UI) will set a boolean to true and run a script, and when switched off - to set the boolean to false. i tried to create the following - i’m not sure if that’s the right way to achieve this:
switch:
- platform: template
switches:
ac1_auto_mode:
friendly_name: 'AC1 Auto Mode Set'
value_template: "{{ is_state('switch.source', 'on') }}"
turn_on:
- service: input_boolean.turn_on
data:
entity_id: input_boolean.ac1_auto_mode
- service: script.auto_ac1_init
data:
ac: 1
init: 1
turn_off:
- service: input_boolean.turn_off
data:
entity_id: input_boolean.ac1_auto_mode
i’m not sure how to set the “value_template” here. currently - when the switch is switched on, it returns to be off after a second.