Timer

Created Diff never expires
3 删除
总计
删除
单词
总计
删除
要继续使用此功能,请升级到
Diffchecker logo
Diffchecker Pro
29
3 添加
总计
添加
单词
总计
添加
要继续使用此功能,请升级到
Diffchecker logo
Diffchecker Pro
29
return {
return {
on = {
on = {
--timer = { 'every second' },
timer = { 'every second' },
devices = { 1 },
--devices = { 1 },
httpResponses = { 'lampStatus' }
httpResponses = { 'lampStatus' }
},
},
execute = function(domoticz, item)
execute = function(domoticz, item)
domoticz.log("Hallo?")
domoticz.log("Hallo?")
local lamp = domoticz.devices(384)
local lamp = domoticz.devices(384)
if (item.isDevice) then
if (item.isTimer) then


domoticz.openURL({
domoticz.openURL({
url = 'http://192.168.1.149/json/state/0',
url = 'http://192.168.1.149/json/state/0',
method = 'GET',
method = 'GET',
callback = 'lampStatus'
callback = 'lampStatus'
})
})
domoticz.log("test?")
domoticz.log("test?")
elseif (item.isHTTPResponse) then
elseif (item.isHTTPResponse) then
if (item.ok) then
if (item.ok) then
local currentStatus = item.json.on
local currentStatus = item.json.on
if(currentStatus == true) then
if(currentStatus == true) then
lamp.switchOn()
lamp.switchOn()
elseif(currentStatus == false) then
elseif(currentStatus == false) then
lamp.switchOff()
lamp.switchOff()
end
end
end
end
end
end
end
end
}
}