I have a ventilation system i can control with an ESPEasy device, by sending URLs to it.
In Domoticz i have a multiselector switch and a LUA script like this:
Code: Select all
commandArray = {}
if devicechanged['Ventilation'] == 'Off' then
print ("Ventilation switched to Off")
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,13,1' --switch off High
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,12,1' --switch off Normal
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,14,1' --switch off Low
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,16,1' --switch off unit
elseif devicechanged['Ventilation'] == 'Low' then
print ("Ventilation switched to Low")
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,16,0' --switch on unit
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,13,1' --switch off High
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,12,1' --switch off Normal
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,14,0' --switch on Low
elseif devicechanged['Ventilation'] == 'Normal' then
print ("Ventilation switched to Normal")
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,16,0' --switch on unit
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,13,1' --switch off High
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,14,1' --switch off Low
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,12,0' --switch on Normal
elseif devicechanged['Ventilation'] == 'High' then
print ("Ventilation switched to High")
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,16,0' --switch on unit
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,12,1' --switch off Normal
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,14,1' --switch off Low
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,13,0' --switch on High
elseif devicechanged['Ventilation'] == 'Auto' then
print ("Ventilation switched to Auto")
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,16,0' --switch on unit
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,13,1' --switch off High
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,12,1' --switch off Normal
commandArray['OpenURL']='http://ventilation/control?cmd=GPIO,14,1' --switch off Low
end
return commandArray
Thanks