Hi Guy's
I have a problem with a scene , i am on the latest Beta Firmware and I get
Out of memory | Scene: Global Check
Number of instances of scene has been reduced to high memory usage.
What is wrong with this scene ?
--[[
%% autostart
%% properties
%% globals
Night
--]]
--kill any extra instances of the same scene
if fibaro:countScenes() > 1 then
fibaro:abort()
end
--Loop
while true do
--Settings
local ExecuteTimer = 700; -- Execute Every N-th second
local GlobalVariablesDevice = 182; -- ID of helperdevice for GlobalVars!
local AbsenceTime = 10; -- 10 minutes
local SunriseTime = 30; -- 30 minutes after sunrise
local SunsetTime = 30; -- 30 minutes before sunrise
local UserInactivity = 10; -- 10 minutes delay after switchoff
--Setup local variables
local CurrentDate = os.date("*t");
--Announce start
fibaro:debug(" -|- Start: "..os.date("%Y-%m-%d %H:%M:%S",os.time()))
-- SunriseTime
SunriseHour = os.time{year=CurrentDate.year, month=CurrentDate.month, day=CurrentDate.day, hour=string.sub(fibaro:getValue(1, 'sunriseHour'), 1 , 2), min=string.sub(fibaro:getValue(1, 'sunriseHour'), 4)}+SunriseTime*60;
fibaro:debug(" -|- SunriseTime: "..os.date("%Y-%m-%d %H:%M:%S",SunriseHour));
-- SunsetTime
SunsetHour = os.time{year=CurrentDate.year, month=CurrentDate.month, day=CurrentDate.day, hour=string.sub(fibaro:getValue(1, 'sunsetHour'), 1 , 2), min=string.sub(fibaro:getValue(1, 'sunsetHour'), 4)}-SunsetTime*60;
fibaro:debug(" -|- SunsetTime: "..os.date("%Y-%m-%d %H:%M:%S",SunsetHour));
-- Night or day?
if (os.time() > SunsetHour or os.time() < SunriseHour) then
fibaro:debug(" -|- Night: It's night!");
if tonumber(fibaro:getGlobalValue("Night")) == 0 then
fibaro:setGlobal("Night", 1);
end
else
fibaro:debug(" -|- Night: It's day!");
if tonumber(fibaro:getGlobalValue("Night")) == 1 then
fibaro:setGlobal("Night", 0);
end
end
--Announce end
fibaro:debug(" -|- End: "..os.date("%Y-%m-%d %H:%M:%S",os.time()))
--Sleep XX seconds
fibaro:sleep(ExecuteTimer*5000);
end
Thanks in advance for help