local user = "admin"
local pwd = "********"
local excluded_id = {98, 127}
local max_events = 100
HC2 = Net.FHttp("127.0.0.1", 80)
HC2:setBasicAuthentication(user, pwd)
response = HC2:GET("/api/panels/event?last="..max_events.."&type=id")
local t = json.decode(response)
local j = 0
for i = 1, max_events do
local exclude = false
for k = 1, #excluded_id do
if excluded_id[k] == t[i].deviceID then
exclude = true
break
end
end
if (t[i].deviceType ~= "motion_sensor") or
exclude == true
then
-- pas interessant
else
local msg = fibaro:getRoomName(fibaro:getRoomID(t[i].deviceID)) .. " | " .. t[i].oldValue .. "->" .. t[i].newValue .. " | " .. os.date("%d/%m %H:%M", t[i].timestamp)
j = j + 1
pcall(function()
fibaro:call(fibaro:getSelfId(), "setProperty", "ui.Label"..j..".value", msg)
end)
if j >= 10 then break end
end
end
rectifiée cela. Il ne fonctionne pas.