Skip to content

Help with relay decoupling and rules #22398

Discussion options

You must be logged in to vote

Rule 1:
When disconnecting from MQTT, connect the relay to the switch, activate rule 2 and deactivate rule 3
When connecting to MQTT, disconnect the relay from the switch, deactivate rule 2, activate rule 3 and leave the relay always on

Rule1 
ON Mqtt#disconnected==1 DO Backlog SetOption114 0; Rule2 1; Rule3 0 ENDON
ON Mqtt#connected==1 DO Backlog SetOption114 1; Rule2 0; Rule3 1; power1 1 ENDON

Rule 2:
The switch will control the relay, enabling the lamp to be turned on and off

Rule2 
ON switch1#state DO power1 2 ENDON

Rule 3:
The switch will send a message to the mqtt topic, enabling the lamp to be controlled via mqtt

Rule3 
ON switch1#state DO publish zigbee2mqtt/Varanda/center/set t…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by walberjunior
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant