hello guys
I have 2 sonoff switch t1 1 gun,i using mqtt to control the switch,
I like the 2 switch will control the same light
for example:
when i press switch no 1 the mqtt will send to switch no 2 to be off in case is on
when I press switch no 2 the mqtt will send to switch no 1 to be off in case is on
can I do that using mqtt ?
Hi @tamiryosef, I have a couple of sonoff Touch that control the same switch. One is connected to the lights and the other is just another switch to control the same light. It works perfectly but it is true that a couple of times has become crazy turning the lights on and off constanly (I have another 3 switch setup and is fun to see :)).
I miss the part of ensuring the other is on or off to avoid changing it and maybe avoid the loop.
# Control entry light
- alias: "Entry light 1"
trigger:
platform: state
entity_id: light.entry_light_1
action:
service_template: >
{% if trigger.to_state.state == "on" %}
light.turn_on
{% elif trigger.to_state.state == "off" %}
light.turn_off
{% endif %}
entity_id: light.entry_light_2
- alias: "Entry light 2"
trigger:
platform: state
entity_id: light.entry_light_2
action:
service_template: >
{% if trigger.to_state.state == "on" %}
light.turn_on
{% elif trigger.to_state.state == "off" %}
light.turn_off
{% endif %}
entity_id: light.entry_light_1