Hello,
I have the below scenario.
“I have 2 switches to control an appliance. Once is connected to the appliance & the other one is just powered. I want both the switches to be able control the device. If I press one switch, the status of the other switch must toggle”
I have the below script in automation.YAML
- id: '1536762580941'
alias: 2 way light
trigger:
- entity_id: switch.sonoff
from: 'ON'
platform: state
to: 'OFF'
- entity_id: switch.sonoff
from: 'OFF'
platform: state
to: 'ON'
condition:
- condition: state
entity_id: switch.sonoff
state: 'ON'
- condition: state
entity_id: switch.sonoff
state: 'OFF'
action:
- alias: ''
data:
entity_id: switch.sonoff2
service: switch.toggle
- id: '1536765220099'
alias: 2 way light 1
trigger:
- entity_id: switch.sonoff2
from: 'ON'
platform: state
to: 'OFF'
- entity_id: switch.sonoff2
from: 'OFF'
platform: state
to: 'ON'
condition:
- condition: state
entity_id: switch.sonoff2
state: 'ON'
- condition: state
entity_id: switch.sonoff2
state: 'OFF'
action:
- data:
entity_id: switch.sonoff
service: switch.toggle
I’m not able to see the switch details as they are not present in the configuration.yaml file as I have added auto discovery for them.
However, this automation is not working. If I trigger it manually, the status of both the switches gets toggles. But, it’s not happening automatically. Can anyone please help me?