Har en scen som uppdateras varannan minut och kör denna kod.
jag kan ju tycka att det är helt onödigt att den ska skicka tändkommandon när det redan är tänt
Då såg jag dantibergs lilla lua kod som jag ville få in men det går inte, hur jag en försöker så får jag något tokigt felmeddelande.
Någon som kan hjälpa mig med detta?
Min kod
Code: Select all
--[[
%% properties
%% globals
--]]
-- REFERENCE
-- zwaveforum.se, forum.fibaro.com
-- Thanks to Bamsefar, Daniel.Knight for good LUA functions code.
if (fibaro:countScenes() > 1) then fibaro:abort() end
local deviceIDs = { 248, 250, 252, 254, 45, 189 }
math.randomseed(os.time())
function randomOrder(table)
local new = {}
for j,x in pairs(table) do new[j] = x end
local res = {}
while (#new > #res) do
local index = math.random(1,#new)
if (new[index] > -1) then
res[#res+1] = new[index]
new[index] = -1
end
end
return res
end
for Device,device in pairs(randomOrder(deviceIDs)) do
fibaro:call(device, "turnOn")
fibaro:debug( Device .. " DeviceID: "..device)
fibaro:sleep(math.random(5000,12000))
fibaro:call(119, "pressButton", "1")--Endast för VD
end
Code: Select all
local lightstatus=tonumber(fibaro:getValue(Device, "value"));
if(lightstatus>0