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

trigger once every minute in virtual device main loop


Question

Posted

Is there a way to trigger code every minute in a virtual device's main loop?

6 answers to this question

Recommended Posts

  • 0
Posted

Main loop will be trigged every 5 seconds so fair as I know

  • 0
Posted
Is there a way to trigger code every minute in a virtual device's main loop?

Its triggered every 3 seconds and afaik fibaro:sleep(57*1000) will be exactly every minute? But I'm not guru!

  • 0
  • Inquirer
  • Posted

    Thanx guys, but I was looking for something like

    Please login or register to see this code.

    The above code is to trigger events every 15 minutes. Somehow can't get it working when adapting it to 1 minute..

    Please login or register to see this image.

    /emoticons/default_icon_cry.gif" alt=":cry:" />

    I don't want to use a sleep function because there are other things in the main loop which need to be executed.

    • 0
    Posted

    Lambik, assign current time to local variable with os.time(), then check with an if instruction, whenever difference in current time and is greater than 60s, if so enter if, execute instructions and set local variable with current time.

    • 0
  • Inquirer
  • Posted
    current time to local variable with os.time()

    Is a local variable not reset every time the main loop is executed?

    • 0
    Posted

    Lambik, sorry, my mistake, of course the variable should not be marked as local, that way its state will be passed to another run of loop. Thank you for noticing that.

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