Set status of a switch
Posted: Friday 26 February 2016 21:01
I have a device that needs two presses on the switch to get the correct status (on or off) displayed (see this topic http://domoticz.com/forum/viewtopic.php?f=6&t=4748). If you don't want to read through it: if the switch is Off and you press it, the switch turns on but the status remains Off. After pressing again, the status changes to On (and the switch stays on).
I'm trying to work around this issue, by adding another switch command (on or off) when the switch is pressed, using the followin lua script:
And a similar script for the Off command.
The issue is: running this command triggers an additional On command (it switches on the switch a second time), but it doesn't trigger an additional status change of the switch (so it does the exact opposite of what I want).
The strange thing is: when I run the command in a browser, it actually does exactly what I want: it sets the correct status of the switch.
Any other ideas on how to "trick" a switch to think it's On or Off, or any insights in what I'm doing wrong?
I'm trying to work around this issue, by adding another switch command (on or off) when the switch is pressed, using the followin lua script:
Code: Select all
commandArray = {}
if (devicechanged['Lamp 1'] == 'On') then
commandArray[1]={['OpenURL']='192.168.2.201:8084/json.htm?type=command¶m=switchlight&idx=24&switchcmd=On' }
end
return commandArray
The issue is: running this command triggers an additional On command (it switches on the switch a second time), but it doesn't trigger an additional status change of the switch (so it does the exact opposite of what I want).
The strange thing is: when I run the command in a browser, it actually does exactly what I want: it sets the correct status of the switch.
Any other ideas on how to "trick" a switch to think it's On or Off, or any insights in what I'm doing wrong?