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

[IMPORTANT] How to use %% timer and is there a replacement for fibaro:sleep


Sankotronic

Question

Hello all!

 

Worst thing with developing for Fibaro is lack of any knowledge database. Please, don't jump immediately and mention e-learning, manuals or developer site because there you can find only some basic information, usually not complete! So, for me, this forum is still the best knowledge base that can be found for Fibaro thanks to experienced members that have no problem with sharing knowledge. I believe I don't need to mention them by name because we all know who they are! I thank them thousand times!!!!

 

So, I just don't like to use fibaro:sleep any more since ti is not flexible and it doesn't count time that is needed for code to be executed. Due to not precise repeating of Main scene FTBE time for wake up at 06:20h was missed this morning and Angelina didn't wake us up:

Please login or register to see this attachment.

 

To continue developing next version of Main scene FTBE and all other software I just need HELP to find out if there is a better way to control code execution to avoid such mishits in future.

 

QUESTIONS

 

1) What is %% timer used for in scene header and how to use this feature?

2) How to achieve that code is repeated at exactly same time intervals regardless of amount of code executed?

 

Any advice in this matter is highly needed and appreciated!

Yours truly Sankotronic

  • Like 1
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I found this : 

Please login or register to see this link.

 and this: 

Please login or register to see this link.

 which is above my comperension 

But sure you already read that.

Link to comment
Share on other sites

  • 0

The way to do it is to use setTimeout

Please login or register to see this code.

Here os.clock is used for some possible better resolution but os.time works too. 

Alternatively, assuming that setTimeout takes a very small amount of time...

Please login or register to see this code.

Also look at this old example that schedules functions at hours/sunsets

 The

Please login or register to see this link.

doesn't drift and allows to schedule functions/events on relative or absolute time in the future and saves me a lot of headache these days...

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Hi @jgab,

     

    Thank you for suggestion. I had something similar in my head, but I wanted to know if there is even better or simpler way to do it. 

    I'm still processing your event model and I find it very interesting. If you don't mind I'd like to use some of your code snippets?

     

    But I still want to find out how to use %% timer in scenes? Maybe @A.Socha or @T.Konopka can enlighten me on that matter?

     

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