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

why this weird behaviour of my scene?


Question

Guest reiniertc
Posted

I've written a small script that turns on the lights at a specific time when my alarm is set to "armed".

The script works, but not as expected.

 

here's the code:

Please login or register to see this code.

what happens, is that the lights turn on at every xx:49 and off again at every xx:10.

I have no clue what I'm doing wrong.

Does anyone see my mistake in the script?

 

 

2 answers to this question

Recommended Posts

  • 0
Guest reiniertc
  • Inquirer
  • Posted

    thanks! I wonder how I failed to see that myself. Glad I asked

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

     

    I will try your suggestion, seems much easier

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

    • 0
    Posted

    I've written a small script that turns on the lights at a specific time when my alarm is set to "armed".

    The script works, but not as expected.

     

     

    what happens, is that the lights turn on at every xx:49 and off again at every xx:10.

    I have no clue what I'm doing wrong.

    Does anyone see my mistake in the script?

    It works exactly per your code (49 minutes on and then off for 10 minutes).

    To clarify the problem let's assume that the time is now 17:00. According to your code the minutes comparison returns "false"  state,

    Please login or register to see this code.

    so the light turn off till 17:10. This will happen every hour between xx:00 till xx:10

    May I suggest to convert the string to simple number - 16:45 = 1645 and 22:49 =2249 in this case you just need to verify that the current time (for example 17:00=1700) is bigger/equal than 1645 and less/equal than 2249. 

    See code changes as an example

    Please login or register to see this code.

    Do the same for the second time slot.

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