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

Scene that works in an interval


Question

Posted (edited)

Hi

I would like to make a scene that turn on the light at night between 23:30 and 05:00

Getting the motion sensor to turn on the light is no problem, but to set up the timer interval is giving me a headache. 

I’m new to lua programming ?

Anyone that could help with some code or ideas.

 

Regards

René

 

Edited by Cantel

5 answers to this question

Recommended Posts

  • 0
Posted

Good Morning
Here is a solution!

 

Please login or register to see this code.

Greetings to the neighboring country!
Frank

  • Like 1
  • 0
Posted

Hey Rene, another idea- you can make yourself a simple block scene to turn on the lights at the appointed time, and then another one to turn them off.

 

Then if you want, you can convert the block scenes to LUA scenes, to see how LUA works or to expand on the code to make more functionality. 

  • Like 1
  • 0
  • Inquirer
  • Posted

    Thanks for youre help I went with block idea, so I hopeful can get better at lua?

    • 0
    Posted

    Hi
    It does not matter !
    Remember my scene, you can count on it for example 25 minutes before sunrise or 15 minutes after sunset are no problem.

    Greetings Frank

     

    if calculate_minutes(TimeNow) >= calculate_minutes("sunrice") - calculate_minutes("00:25"then
    end
     
    if calculate_minutes(TimeNow) >= calculate_minutes("sunset") + calculate_minutes("00:15"then
    end
    • 0
    Posted

    Hi
    Here is another example of a time query.
    Since you are still new and have not yet built a lot with LUA, you can certainly use this.
    A time switch with different switching times for on and off.
    Somewhat unusual but very simple.

    Greetings Frank

     

    Please login or register to see this code.

     

    Please login or register to see this code.

     

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