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

Time difference


Guest Lode

Question

Guest Lode
Posted

Hi,

I have the following code that should do something between 23.00h and 05.00h but it doensn't work.

I think it has something to do because 05.00h is the next day.

Please login or register to see this code.

7 answers to this question

Recommended Posts

  • 0
Posted
and (string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) and
seems missing condition operator like "==" etc.
and (math.floor(os.time()/60)-math.floor(1365541200/60))%60 == 0
i think you can remove that safety ...

replace or operator with and operator to check between 23H00 and 05H00

you can try something like that: (not tested)

Please login or register to see this code.

  • 0
Guest Lode
  • Inquirer
  • Posted

    Hi Krikroff,

    Thx again.

    I tested it but it doens't work.

    When i try something like..... between 13.00h and 23.00h it works.

    I think comparing 23.00h and 05.00h (next day) is not correct.

    • 0
    Posted

    Lode, I think you should split the if statement like

    Please login or register to see this code.

    • 0
    Posted

    Lode, can you post your complete code ? and i try to debug it for you

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    • 0
    Guest Lode
  • Inquirer
  • Posted

    Hi Gilbert, Krikroff,

    Thx again.

    Gilbert, i will try that tonight, i have to go to the dentist now

    Please login or register to see this image.

    /emoticons/default_icon_mad.gif" alt=":-x" />

    Please login or register to see this image.

    /emoticons/default_icon_mad.gif" alt=":-x" />

    Krikroff, that was the complete code, there is nothing more.

    Greetzzz

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    • 0
    Posted

    ok you can do that :

    Please login or register to see this code.

    it work very well for me

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" /> hope this help you and tell me if it works for you.

    I put always

    Please login or register to see this code.

    to monitor script ignition, it help a little for debug etc. It's also good to break all conditions: step by step. You can remove all fibaro:debug("") inside the code after script validation ... good luck.

    • 0
    Guest Lode
  • Inquirer
  • Posted

    Krikroff,

    Thanks for putting all that effort in finding a solution for me

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    It works but after device 22 is triggered there is a delay before the lamp turns on.

    I'll tell you what i exactly need......

    From sunset until 23.00h a lamp (id 27) is on at my slidegate.

    That scene runs fine.

    But suppose i come home (drunk

    Please login or register to see this image.

    /emoticons/default_icon_razz.gif" alt=":-P" />) between 23:00h and 05.00h and i open the slidegate, the lamp has to turn on immediately for three minutes when i open the gate.

    I have a universal sensor attached to the gate...breached by

    if (tonumber(fibaro:getValue(22, "value")) > 0)

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