Domoticz - two switches, one actuator
I had a problem with Domoticz and switches.
I've ESP8266 module (with ESP Easy v.120) and relay (SSR) - it's very simple to get it work using web interface.
I would like to have some kind of switch not to have use phone to turn on the light. My solution it's not so simple I think it can be done better.
My ESPEasy module has address 192.168.1.7, SSR is connected to GPIO12 and touch sensot is connected to GPIO14. It has configured "Protocol" as "Domoticz HTTP". The "touch" switch is defined in ESPEasy as:
- Device: "Switch input"
- IDX / Var: 10 (Idx from Domoticz)
- 1st GPIO: GPIO14
- Type: "Switch"
- Switch Button Type: "Normal switch"
- Send Data: On
I didn't define relay connected to GPIO12 - it is set directly from domoticz as described below.
My domoticz has address 192.168.1.8. I defined "dummy" hardware with two "switches":
- "light" - it has defined "On action": http://192.168.1.7/tools?cmd=GPIO%2C12%2C0 and "Off action": http://192.168.1.7/tools?cmd=GPIO%2C12%2C1
- "touch" - without any settings
Next I've defined new "Event" ("Lua", "Device"):
commandArray = {} if (devicechanged['touch']=='Off') then if (otherdevices['light']=='Off') then -- print ("wlaczam"); commandArray['light']='On' else -- print ("wylaczam"); commandArray['light']='Off' end end return commandArray
Remember to set "Event active" checkbox.
Now I can use both web interface and physical switch to turn on/off the light.
Komentarze
Log in or create a user account to comment.