Jump to content

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


lua script, doesn,t get triggerd


Thistle
 Share

Recommended Posts

Tried to combine two converted blok scenes to one, but now it wont trigger...

Any suggestions ?

-------------------------------------------------------------------------------------------------------------------------

--[[ 
%% autostart
%% properties
%% weather
%% events
%% globals
--]]

local sourceTrigger = fibaro:getSourceTrigger();
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
 ( ((currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "04:00") )
or
 ( ((currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "15:00") )
)
then
    fibaro:setGlobal("reclameverl", "1");
    fibaro:debug("var reclverl set to 1")
    fibaro:sleep(60*1000)
elseif (
 ( ((currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "09:00") )
or
 ( ((currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "18:00") )
)
then
    fibaro:setGlobal("reclameverl", "0");
    fibaro:debug("var reclverl set to 0")
    fibaro:sleep(60*1000)
end

----------------------------------------------------------------------------------------------------------------------------------------------------

 

I,m hoping someone can give me a hint....

Gary

Please login or register to see this attachment.

Link to comment
Share on other sites

You have not trigger in scene's header

--[[ 
%% autostart
%% properties
%% weather
%% events
%% globals
--]]

What you're trying to do?

Edited by cag014
Link to comment
Share on other sites

  • Topic Author
  • I,m trying to set and unset a variable depending on the time and day

    Edited by Thistle
    Link to comment
    Share on other sites

    In this case you need to loop the scene or you can create virtual device using main loop (is looped by the system)

    To loop scene please use setTimeout() function  see

    Please login or register to see this link.

    Please set "Run Scene" to Automatic as well

     

    Edited by cag014
    Link to comment
    Share on other sites

  • Topic Author
  • Thanks a lot, these examples help me a lot

    eventually got it working... 

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

     Share

    ×
    ×
    • Create New...