Hi,
For now I have implement an input boolean for make a dummy switch.
But I need to make one or more for my usage.
How I can implement multiple switch with different name ?
this is my one switch code
input_boolean:
alarm_door:
switch:
- platform: template
switches:
dummy:
value_template: "{{ is_state('input_boolean.alarm_door', 'on') }}"
turn_on:
- service: input_boolean.turn_on
entity_id: input_boolean.alarm_door
- service: input_boolean.turn_off
entity_id: input_boolean.alarm_door
turn_off:
- service: input_boolean.turn_off
entity_id: input_boolean.alarm_door
thanks a lot
Hi there if you are asking about creating more than one template switches. You can try like this.
switch:
- platform: template
switches:
dummy_switch1:
value_template: "{{ is_state('input_boolean.alarm_door', 'on') }}"
turn_on:
- service: input_boolean.turn_on
entity_id: input_boolean.alarm_door
- service: input_boolean.turn_off
entity_id: input_boolean.alarm_door
turn_off:
- service: input_boolean.turn_off
entity_id: input_boolean.alarm_door
dummy_switch2:
value_template: "{{ is_state('sensor.skylight', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.skylight_open
turn_off:
service: switch.turn_off
data:
entity_id: switch.skylight_close
dummy_switch3:
value_template: "{{ is_state('input_boolean.alarm_door', 'on') }}"
turn_on:
- service: input_boolean.turn_on
entity_id: input_boolean.alarm_door
- service: input_boolean.turn_off
entity_id: input_boolean.alarm_door
turn_off:
- service: input_boolean.turn_off
entity_id: input_boolean.alarm_door
In my code I have an input boolean,
can I have 3 input boolean with 3 different name who’s link to switches ?
eg:
input boolean alarm_door => dummy1
input boolean arrival => dummy2
input boolean go_out=> dummy3
yes. you can try something like this.
input_boolean:
alarm_door:
arrival:
go_out:
switch:
- platform: template
switches:
dummy1:
value_template: "{{ is_state('input_boolean.alarm_door', 'on') }}"
turn_on:
- service: input_boolean.turn_on
entity_id: input_boolean.alarm_door
- service: input_boolean.turn_off
entity_id: input_boolean.alarm_door
turn_off:
- service: input_boolean.turn_off
entity_id: input_boolean.alarm_door
dummy2:
value_template: "{{ is_state('input_boolean.arrival', 'on') }}"
turn_on:
- service: input_boolean.turn_on
entity_id: input_boolean.arrival
- service: input_boolean.turn_off
entity_id: input_boolean.arrival
turn_off:
- service: input_boolean.turn_off
entity_id: input_boolean.arrival
dummy3:
value_template: "{{ is_state('input_boolean.go_out', 'on') }}"
turn_on:
- service: input_boolean.turn_on
entity_id: input_boolean.go_out
- service: input_boolean.turn_off
entity_id: input_boolean.go_out
turn_off:
- service: input_boolean.turn_off
entity_id: input_boolean.go_out