I want to make a Virtual/Template toggle switch -
While turn on, It’ll remember its state of “On”. But there’s no physical device to on.
It’ll virtually remember.
While turn Off, It’ll remember its state of “Off”. But there’s no physical device to off.
It’ll virtually remember.
How to do that?
Here my code with some progress. It can’t remember its state. How to make the state working?
switch:
- platform: template
switches:
test_switch_1:
unique_id: test_switch_1
friendly_name: Test Switch
value_template: "{{ is_state('input_boolean.switch_state', 'on') }}"
turn_on:
- service: input_boolean.turn_on
data:
entity_id: input_boolean.switch_state
turn_off:
- service: input_boolean.turn_off
data:
entity_id: input_boolean.switch_state