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

Time Based Scenes


Question

Guest puma
Posted (edited)

I'm chasing some info on time based scenes. I have created a scene using my alarm sensors to trigger some lights however I want them to only happen at night say between 11pm & 5am.

 

How do I do that?

 

Please login or register to see this code.

 

Thanks

Edited by puma

7 answers to this question

Recommended Posts

  • 0
Posted

@puma

You can create a variable, "righttime"

 

then 2 scenes

11 pm, righttime on

5 am rightime off

 

main scene

if sensor breach AND righttime is on, lights on etc

  • 0
Guest puma
  • Inquirer
  • Posted
    10 hours ago, akatar said:

    @puma

    You can create a variable, "righttime"

     

    then 2 scenes

    11 pm, righttime on

    5 am rightime off

     

    main scene

    if sensor breach AND righttime is on, lights on etc

    Thanks I know how to do this with block scenes as in create a variable then two other scenes one to turn it on another to turn it off, however was hoping to do this in lua so that I can incorporate it into the one scene. 

     

    I'm trying to learn a bit more of lua I find it a little better than the block scenes.

    • 0
    Posted

    I don't own a hc2, but i guess you can make the blockscene, translate in to lua and adjust it as you want?

    • 0
    Posted

    BTW there is a great alarm scene for the HC2 over here:

     

    "If you want some action before notifications are send and sounders activated then you add code to function extraUserCodeBreachFirst(). If you want some action to be executed after notifications are sent and sounders activated then you add code to function extraUserCodeBreachLast(). When sensor goes back to safe state scene is activated again. It will not send any messages but will stop sounders and if you want some more action then you can add code to function extraUserCodeSafe()."

     

    I don't use a HC2, so you have to look for the small code "if time > 23:00 and time < 5:00 then" 

     

    But you probably make that code yourself with a block scene and converting to Lua. 

     

    And here is a lot of stuff concerning time and the HC2:

     

     

     

     

    • 0
    Guest puma
  • Inquirer
  • Posted

    So ended up getting it to work with the help from jgab 

     

    here is the code. The only thing that I wanted to maybe include was if the sensor was re triggered then it would reset the timer. I might play with it and see if I can get it to do that.

     

    Please login or register to see this code.

     

    • 0
    Posted

    Lots of examples on the forum for a simple loop to reset the timer. Look for “maxtime”. 

    • 0
    Guest puma
  • Inquirer
  • Posted

    Thanks I have a bit of an understanding on how they work I have another scene that uses them.

     

    The only difference with this one is that it uses an input from a VD rather than a device with an ID so I'm not 100% certain how to add it in.

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