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
}
}