Hello, I want to make a 4-way switch using 3 physical light switch but only one of them is wired to the actual light (switch.2nd_livingroom_2_right). I followed this thread (Trouble with two 3-way smart switches in Home Assistant - #13 by finity) for 3-way switch, but it doesn’t seem to work with my setup. Here is my current light.yaml file:
- platform: template
lights:
front_staircase_3_way:
friendly_name: Front Staircase 3 Way
availability_template: >-
{% if not is_state('switch.2nd_livingroom_2_right', 'unavaiable') %}
true
{% endif %}
value_template: >-
{% if (is_state('switch.2nd_livingroom_2_right', 'on')
and is_state('switch.1st_livingroom1_2_right', 'on')
and is_state('switch.front_door_2_left', 'on'))
or (is_state('switch.2nd_livingroom_2_right', 'off')
and is_state('switch.1st_livingroom1_2_right', 'off')
and is_state('switch.front_door_2_left', 'off')) %}
on
{% else %}
off
{% endif %}
turn_on:
service: switch.turn_on
entity_id:
- switch.2nd_livingroom_2_right
- switch.1st_livingroom1_2_right
- switch.front_door_2_left
turn_off:
service: switch.turn_off
entity_id:
- switch.2nd_livingroom_2_right
It works if I turn on and turn off the created light entity itself, but not always working when I flip the actual switch. Thanks before.
So, I have 3 switches, one of them is wired to the light, and the other two is not wired to the light, just live and neutral wire for power. So, I want to simulate 4 way switch in home assistant using template light. The situation I want is:
if the light is off and I press one of the switch, home assistant would turn on the switch that is connected to the light.
if the light is on and I press one of the switch, home assistant would turn off the switch that is connected to the light.
Thanks for replying, sorry my post wasn’t clear enough. Hope you can help me, my brain is hurt from thinking how to get this working
Yes, I only show the light template. Did I misunderstood something here? I want to use Template Light for the switch so I don’t need to create automation. I was thinking I can use the value_template of the light to turn on/off the switch by using the turn_on and turn_off actions in the template.
Yeah, I ended up with an automation to call light.toggle to the switch that is connected to the light whenever switches that are not connected to the light change state. Seems like this is the only right way for this. Thanks for the valuable information