Just tried a LUA script version of what I was looking for, but partially.
This is the LUA script:
Code: Select all
commandArray = {}
print ("All based event fired");
-- loop through all the devices
for deviceName,deviceValue in pairs(otherdevices) do
if (deviceName=='switch1') then
if deviceValue == "On" then
print("Device is On")
commandArray['OpenURL'] = "http://192.168.1.xx/control?cmd=GPIO,12,0"
elseif deviceValue == "Off" then
print("Device is Off")
commandArray['OpenURL'] = "http://192.168.1.xx/control?cmd=GPIO,12,1"
end
end
end
What I would like to do, if possible, is to manage two relays with the same command, in my case relay1 ON and relay 2 OFF when switch1 is On and the opposite when it's Off.
I cannot pass two CommandArray with OpenURL because the second will overwrite the first (if it works).
How can I do it?
In any case, the same thing done with Blockly, as in the previous post, doesn't work. Strange!!!
I get an error
Error: Error opening url: "http://192.168.1.xx/control?cmd=GPIO
it's missing the comma after GPIO and everything after the comma.
Is there a different way to pass the "," into an http string?
Can someone help?
Thanks
EDIT:
Done it.
The issue was the comma in the url.
Just replaced the commas with %2c and now with Blockly works also with two consecutives OpenURL commands.
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat