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

LUA light script


Question

Posted (edited)
I am testing with some LUA scripting.
I have my own script for lighting in my hallway. In short:
 
- If Fibaro Sensor (21) sees movement
- Then start the script
- Then the lights must be to 99%
- After 7.5 min (450.000 milliseconds) then
- If SchemerJaNee (Dutch for dusk) = Yes, then dim to 20%
- If SchemerJaNee = No, then turn off
 
The scene works. Sometimes. But all the other scenes (mainly block scenes) aren't working anymore. I think my scene is messing up something, but I don't know what :-)
Can you help me with this??
 
 
DECLARATIONS
 

Please login or register to see this code.

 

ACTIONS

 

Please login or register to see this code.

 

 
 
 
Edited by Fabian78

16 answers to this question

Recommended Posts

  • 0
Posted

What if there is within the 7.5 minutes movement, should the timer reset?

  • 0
  • Inquirer
  • Posted (edited)
    Quote

    What if there is within the 7.5 minutes movement, should the timer reset?

     

    Yes, this would be the best.

    Edited by Fabian78
    • 0
    Posted

    Because this script will wait (sleep) 7.5 minuten and turn off the light (or dim). 

     

     

    • 0
  • Inquirer
  • Posted

    Ok, how do I solve this?

    • 0
    Posted (edited)

    With a loop like this code

     

    (Did some fast copy paste, didn't test anything)

     

    Please login or register to see this code.

    Please login or register to see this code.

    Please login or register to see this code.

    Please login or register to see this code.

    Please login or register to see this code.

    Edited by SmartHomeEddy
    • 0
  • Inquirer
  • Posted

    Thnx. I will test it tonight.

     

    • 0
    Posted

    Goodluck

     

    The essence is the while - do loop. It loops 7.5 minutes, but is there is movement, it resets the timer. 
     

    maybe test with one minute ?

    • 0
  • Inquirer
  • Posted
    Quote

    maybe test with one minute ?

     

    I think that will be a good idea.... ;-)

    • 0
  • Inquirer
  • Posted

    Is the Conditions/Triggers still necessary?

     

    Please login or register to see this code.

     

     

    • 0
    Posted

    Please try to use

    Please login or register to see this link.

    . Could be done very easily.

    In addition you can control your HCL from HC3.

    No more endless block scenes   ?

    • 0
    Posted
    2 minutes ago, cag014 said:

    Please try to use

    Please login or register to see this link.

    . Could be done very easily.

    In addition you can control your HCL from HC3.

    No more endless block scenes   ?

    I can assure it is true ?

    • 0
    Posted
    2 hours ago, Fabian78 said:

    Is the Conditions/Triggers still necessary?

     

    Please login or register to see this code.

     

     


    yes (and also fill in the motion ID in the motion variable in the action)

    • 0
  • Inquirer
  • Posted

    Yes. It's works!

    There was one error in the scene, but I made a correction.

     

    Thank you.

    • 0
    Posted
    1 hour ago, Fabian78 said:

    There was one error in the scene

     

    Only one, I am making progress ?

    • 0
    Posted

    Fabian78, 

    Please login or register to see this code.

    • 0
  • Inquirer
  • Posted

    Please login or register to see this code.

     

    On 1/7/2021 at 7:45 PM, jorge rintaro said:

    Fabian78, 

    Please login or register to see this code.

     

    I have only one problem...

    When entering a room, a takes sometimes a few seconds before the light goes on. Not always, but sometimes.

    How can I solve this?

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