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

How to work with time in lua script


Question

Posted

What is the best method to work with time in LUA script on HC3?

 

What I want to achieve is that lights respond different during day then during night. So I want to determine the time and then use it in an if routine.

Does someone have an example?

 

Kind regards,

 

Mark

7 answers to this question

Recommended Posts

  • 0
Posted

I have a simple script to determine night or day (from trigger sunset and sunrise). It sets a global variable. The global variable I can use in other scripts. 
 

Is that what you mean?

  • 0
  • Inquirer
  • Posted

    I am interested in the script but what I am really looking for is determine the time of the Homecenter and use it in my LUA scripting.

    • 0
    Posted

    Please login or register to see this code.

     

    • Like 1
    • 0
  • Inquirer
  • Posted

    That works like a charm. Thanks!

    • 0
  • Inquirer
  • Posted

    @SmartHomeEddy can I still get your script as well?

    • 0
    Posted

    Just create a global variable:

     

    Please login or register to see this image.

    /monthly_2020_10/A8A9EEED-8035-406A-87F0-E177D721B56D.jpeg.25c45bd2a72d3cf28c022c5792a65a61.jpeg" />

     


    And two simple block scene do the rest:

     

    Please login or register to see this attachment.

         

    Please login or register to see this attachment.

     

     

     

    • 0
  • Inquirer
  • Posted

    got it. thanks!

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