Variable as trigger OR .checkFirst() in json?
Posted: Friday 24 May 2019 13:34
Hi, I cant get around how to solve my need. I want to update a dummy switch in domoticz from a shelly device and vice versa.
I have to find a way to avoid loop. I have two options that I have tried.
1: A variable that is changed from the shelly this works just fine.
Then to update the switch I tried this event but cant get it to update the switch (or I think it is the trigger that never happen)
2: the second way is probably better, less complex and that is to update the dummy switch directly with json. The problem I have here is that I have not fund any equvivilent to the dzvent .checkFirst() in json and without it the looping starts.
I have used and that works but I run in to loop. Is there anything like ??
I know that I can use MQTT but I wolud like to use the shelly cloud as well but the memory in the shelly only allows one of them.
Please you all clever people out there, point me in the right direction!
I have to find a way to avoid loop. I have two options that I have tried.
1: A variable that is changed from the shelly
Code: Select all
/json.htm?type=command¶m=updateuservariable&vname=Shelly_kallaren&vtype=integer&vvalue=0
Then to update the switch I tried this event but cant get it to update the switch (or I think it is the trigger that never happen)
Code: Select all
return {
on = {
variables = {
'Shelly_kallaren'
}
},
execute = function(domoticz, item, triggerInfo)
if uservariables['Shelly_kallaren'] == '1' then
domoticz.devices(451).switchOn().checkFirst()
elseif uservariables['Shelly_kallaren'] == '0' then
device.Shelly_kallaren.switchOff().checkFirst()
end
end
}
I have used
Code: Select all
http://192.168.3.10:8080/json.htm?type=command¶m=switchlight&idx=451&switchcmd=Off
Code: Select all
http://192.168.3.10:8080/json.htm?type=command¶m=switchlight&idx=451&switchcmd=Off.checkFirst()
I know that I can use MQTT but I wolud like to use the shelly cloud as well but the memory in the shelly only allows one of them.
Please you all clever people out there, point me in the right direction!