Dear Community,
i created a template switch and it does what it is supposed to do, but i don’t understand what value_template actually does. Is it a kind of a condition, does it set a state?
Could somebody clear this up for me please? I read the documentation but it’s still unclear to me.
Template Switch Official Documentation
These two template switches im using currently:
#Switch Vacuum Homekit
- platform: template
switches:
homekit_vacuum_downstairs:
friendly_name: "Roomba Downstairs"
value_template: '{{ is_state("vacuum.roomba_downstairs", "cleaning") }}'
turn_on:
- service: vacuum.start
data:
entity_id: vacuum.roomba_downstairs
- service: counter.increment
data:
entity_id: counter.counter_roomba_downstairs
turn_off:
- service: vacuum.return_to_base
data:
entity_id: vacuum.roomba_downstairs
- delay:
seconds: 1
- service: vacuum.return_to_base
data:
entity_id: vacuum.roomba_downstairs
#Main sound system
- platform: template
switches:
amp:
friendly_name: "Amp"
value_template: '{{ is_state("switch.amp", "on") }}'
turn_on:
service: switch.turn_on
data:
entity_id:
- switch.socket_cinema_main
- switch.socket_cinema_sub_left
- switch.socket_cinema_sub_right
turn_off:
service: switch.turn_off
data:
entity_id:
- switch.socket_cinema_main
- switch.socket_cinema_sub_left
- switch.socket_cinema_sub_right