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

From Dusk till Dawn?


Question

Posted

Sounds weird, since there are some "time of day" posts here but isn't there a simple way of turning a light on when it's dark and vice versa? I found the Fibaro Motion Sensors too slow to report the current light intensity and since there is a basic way in general of just calculating the time the sun goes down there must be a really simple way in the HC2, but I'm blind... Could someone help me please?

Best regards

Rolf

5 answers to this question

Recommended Posts

  • 0
Posted

you have timer that is "sunset" and "sunrise" that should go on your location. then you can say at sunset lights on. You can also adjust the lux monitoring on the sensor to update more often giving you better readouts.

  • 0
Posted

Easy mate,

Make two scenes and create a predefined global called isNightOrDay with two variables in it 'Night' and 'Day'.

Then in scene one (blocks if you like, LUA if you can), call it Day Scene, do it to check on EVERY day of the week and basically say that when time=sunrise set global to 'Day'

Scene 2 do the same but for sunset then global to 'Night.

Once you've done that it works easy as in every scene you have you just check the variable.

So, if isNightOrDay = Night then 'turnOn' whatever lights you want. Simples

Please login or register to see this image.

/emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

HTH, Dave

Please login or register to see this image.

/emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

Day example:

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

local sourceTrigger = fibaro:getSourceTrigger();

if (sourceTrigger["type"] == "autostart") then

while true do

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) == fibaro:getValue(1, "sunriseHour")) )

)

then

fibaro:setGlobal("isDayOrNight", "Day");

end

fibaro:sleep(60*1000);

end

else

local currentDate = os.date("*t");

local startSource = fibaro:getSourceTrigger();

if (

startSource["type"] == "other"

)

then

fibaro:setGlobal("isDayOrNight", "Day");

end

end

  • 0
  • Inquirer
  • Posted

    Oh hell, I was so stuck in interval based timers that I missed this one! Thanks a lot, now got it. You don't want to see how much I programmed around that including adjusting my scripts manually every week to set the new sunrise time

    Please login or register to see this image.

    /emoticons/default_icon_razz.gif" alt=":-P" />. I knew I had a knot in my brain

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    • 0
    Guest Charly
    Posted

    You can shorten the if .. then a lot because you use it every day.

    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) == fibaro:getValue(1, "sunriseHour")) )

    )

    then

    change to

    if (

    ( ( string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == fibaro:getValue(1, "sunriseHour")) )

    )

    then

    • 0
    Posted

    Been working on 1 scene to put all time of day variables in one here. You can use this one.

    Please login or register to see this link.

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