2 relay: relay_kitchen and relay_bathroom
2 wall switch: wall_kitchen and wall_batroom
every relay is triggered by it's wall switch shortpress.
the wall switch are setted as pushbutton active low
the longpress is setted as active only on low
the scope is that i want that if i longpress the kitchen wall switch the bathroom relay will turn on, but without triggering the relay of kitchen.
this is my rules:
Code: Select all
On System#Boot do //When the ESP boots, do relay to OFF just to be sure
gpio,13,1 //kitchen
gpio,14,1 //bathroom
endon
on wall_kitchen_1#Switch do
if [sniff#kitchen]=0
Publish domoticz/in,{"command": "switchlight", "idx": 96, "switchcmd": "On" } // id of kitchenLight
endif
if [sniff#kitchen]=1
Publish domoticz/in,{"command": "switchlight", "idx": 96, "switchcmd": "Off" }
endif
endon
on wall_kitchen_1#Switch=10 do // longpress ->bathroom
if [sniff#bathroom]=0
Publish domoticz/in,{"command": "switchlight", "idx": 97, "switchcmd": "On" } / id of BathroomLight
endif
if [sniff#bathroom]=1
Publish domoticz/in,{"command": "switchlight", "idx": 97, "switchcmd": "Off" }
endif
endon
on sniff#kitchen=1 do gpio,13,0
on sniff#kitchen=0 do gpio,13,1
endon
on wall_bathroom_1#Switch do
if [sniff#bathroom]=0
Publish domoticz/in,{"command": "switchlight", "idx": 97, "switchcmd": "On" } // id of bathroomlight
endif
if [sniff#bathroom]=1
Publish domoticz/in,{"command": "switchlight", "idx": 97, "switchcmd": "Off" }
endif
endon
on sniff#bathroom=1 do gpio,14,0
on sniff#bathroom=0 do gpio,14,1
endon
thanks