Welcome to Smart Home Forum by FIBARO
Dear Guest,
as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.
As a member you can:
- Start new topics and reply to others
- Follow topics and users to get email updates
- Get your own profile page and make new friends
- Send personal messages
- ... and learn a lot about our system!
Regards,
Smart Home Forum by FIBARO Team

Question
EdZ 0
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
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.