Hi, I'm rather new to LUA programming, but learning every day.
I have created several scenes that are working well, also with using variables and so on.
However, everytime I want to have a scene starting at a certain time, I cannot do it in LUA as then it simply does not work somehow.
Maybe there is something simple thatI forget, but after quite some time puzzling myself, I thought to post it here.
I created a block scene and tested the functionality. It works as expected.
Then I change the scene to LUA without actually modifying anything else and after that the scene is not working anymore. The reason to put it in LUA is to simply add more funtionality afterwards.
The LUA script is like below. Can someone help me out here? Thank you very much in advance!
Edwin
--[[
%% properties
%% events
%% globals
--]]
local sourceTrigger = fibaro:getSourceTrigger();
function tempFunc()
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
( ((currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "06:50") )
)
then
fibaro:call(108, "setValue", "20"); -- keuken spoelbak
fibaro:call(108, "turnOn"); -- keuken spoelbak
fibaro:call(101, "setValue", "15"); -- eetkamer verlichting eettafel
fibaro:call(101, "turnOn"); -- eetkamer verlichting eettafel
fibaro:call(93, "turnOn"); -- woonkamer wandlamp trapkast
fibaro:call(148, "turnOn"); -- woonkamer wandlamp links
fibaro:call(149, "turnOn"); -- woonkamer wandlamp rechts
fibaro:call(91, "turnOn"); -- eetkamer wandlamp links
fibaro:call(92, "turnOn"); -- eetkamer wandlamp rechts
fibaro:call(127, "setBrightness", "2"); -- keuken kastjes
fibaro:call(120, "setBrightness", "2"); -- keuken vloer
fibaro:debug("verlichting aangeschakeld")
end
setTimeout(tempFunc, 60*1000)
end
if (sourceTrigger["type"] == "autostart") then
tempFunc()
else
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
startSource["type"] == "other"
)
then
fibaro:call(108, "setValue", "20"); -- keuken spoelbak
fibaro:call(108, "turnOn"); -- keuken spoelbak
fibaro:call(101, "setValue", "15"); -- eetkamer verlichting eettafel
fibaro:call(101, "turnOn"); -- eetkamer verlichting eettafel
fibaro:call(93, "turnOn"); -- woonkamer wandlamp trapkast
fibaro:call(148, "turnOn"); -- woonkamer wandlamp links
fibaro:call(149, "turnOn"); -- woonkamer wandlamp rechts
fibaro:call(91, "turnOn"); -- eetkamer wandlamp links
fibaro:call(92, "turnOn"); -- eetkamer wandlamp rechts
fibaro:call(127, "setBrightness", "2"); -- keuken kastjes
fibaro:call(120, "setBrightness", "2"); -- keuken vloer
fibaro:debug("verlichting aangeschakeld")
end
end