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


  • 0

Scene triggered by time not starting


Question

Guest
Posted

Dear all,

 

Can someone please have a look at the below.

I have tried out the triggering "if" sentence in a virtual device debug screen and it is working.

As a scene however, nothing happens...

 

Thanks!

 

--[[
%% autostart
%% properties
%% globals
WakeupActive
--]]
 
local sourceTrigger = fibaro:getSourceTrigger();
function tempFunc()
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
local hour = fibaro:getGlobal('WakeupHour')
local minute = fibaro:getGlobal('WakeupMinute')  
if (
 ( string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min)) == (tonumber(hour)..":"..tonumber(minute)) 
and
 ( tonumber(fibaro:getGlobalValue("WakeupActive")) == tonumber("1") )
)
then
fibaro:call(145, "turnOn");
fibaro:call(147, "turnOn");
fibaro:call(57, "turnOn");
fibaro:call(61, "turnOn");
fibaro:call(111, "turnOn");
fibaro:call(81, "turnOn");
fibaro:call(75, "turnOn");
fibaro:call(182, "setSlider", "15", "9");
fibaro:call(182, "pressButton", "7");
fibaro:call(168, "setSlider", "15", "10");
fibaro:call(168, "pressButton", "7");
end
 
setTimeout(tempFunc, 60*1000)
end
if (sourceTrigger["type"] == "autostart") then
tempFunc()
else
 
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
 ( (currentDate.wday == -1) )
and
 ( tonumber(fibaro:getGlobalValue("WakeupActive")) == tonumber("1") )
or
startSource["type"] == "other"
)
then
fibaro:call(145, "turnOn");
fibaro:call(147, "turnOn");
fibaro:call(57, "turnOn");
fibaro:call(61, "turnOn");
fibaro:call(111, "turnOn");
fibaro:call(81, "turnOn");
fibaro:call(75, "turnOn");
fibaro:call(182, "setSlider", "15", "9");
fibaro:call(182, "pressButton", "7");
fibaro:call(168, "setSlider", "15", "10");
fibaro:call(168, "pressButton", "7");
end
 
end

2 answers to this question

Recommended Posts

  • 0
Posted

I't supposed to trigger when you change global variable "WakeupActive". How did you test? I'll tell you a little secret: it won't trigger if you change the variable via the variables panel. But it does fire when you call "setGlobal" (

Please login or register to see this link.

) from another script.

  • 0
Guest
  • Inquirer
  • Posted

    Hi,

     

    It is supposed to trigger at the exact time set in the global variables WakeupHour & WakeupMinute IF WakeupActive is set to 1.

    I use a virtual device to set the 2 time variable and the wakeupactive variable. (All 3 variables are set with a setGlobal command.)

     

     

    I did test by using fibaro:debug and output the os time, the time set in the variables (from above: string.format("%02d", currentDate.min)) == (tonumber(hour)..":"..tonumber(minute)) and also an if sentence checking the line: if (

     ( string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min)) == (tonumber(hour)..":"..tonumber(minute)) 
    and
     ( tonumber(fibaro:getGlobalValue("WakeupActive")) == tonumber("1") )
    )
     
     
    It then did print the time of both until they matched and then gave me the result from the if sentence that wakeup was "triggered"...
     
    Tor H.

    Join the conversation

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

    Guest
    Answer this question...

    ×   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.

    ×
    ×
    • Create New...