Finns det risk att jag sänker HC2:an om jag har flera script igång? bör jag sätta någon timer så det inte kör hela tiden?
Code: Select all
--[[
%% autostart
%% properties
36 value
%% globals
--]]
--[[
A scene to check what percentage the dimmer module
is set to and if not as specified in "percent" then change to "percent"
--]]
--kill any extra instances of the same scene
if (fibaro:countScenes() > 1) then fibaro:abort() end;
----- Change to to your choice -----
local ID = 36; -- set to your dimmer´s device ID, dont forget to change line 4 also!
local percent = 80; -- set to dimmer percentage
----- RUN CODE - do not alter -----
fibaro:debug("Checking dimmer level of unit " ..ID );
local val = (fibaro:getValue(ID, "value"));
fibaro:debug("Level = " ..val );
if tonumber(val) == percent then
fibaro:debug("Level OK, nothing to do...");
else
fibaro:call(ID, "setValue", percent);
fibaro:debug("Dimmer changed to 80%");
end