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
Question
Guest b95_lun
I have created a script to turn on a dimmer if movement is detected by PIR. The light should be turned on for 5 minutes after detected movement and if new movement detected during this period the coundown timer should restart at 5 minutes.
I two issues
1. Aeon-Labs PIR is set for a timeout period of 2 minues before OFF state is sent after being triggered (Parameter 3 = 120). This is very random in HC2 sometimes it takes 2 minutes but quite often it takes longer time.
2. In the script the elseif statement is never triggered. I want it to be triggered if an instance of the scene is already running (i.e. One while loop for the timer is running) and then I just want to set the timer back to 5 minutes and end the last instance. I want to have the first instance as the only controller of the timer.
Could anyone have a look on my script to see if I have made some misstake in the lua code?
Please login or register to see this code.
Here is the debug from it and see that a new movement is triggered at 08:41:48 but it never enters the elseif.
As well the last fibaro:debug statement is never executed
[DEBUG] 08:39:24: start, timer = 0 lights = 0 ,triggerValue = 0
[DEBUG] 08:39:36: start, timer = 0 lights = 0 ,triggerValue = 1
[DEBUG] 08:39:36: Loop - timer = 4
[DEBUG] 08:40:36: Loop - timer = 3
[DEBUG] 08:41:35: start, timer = 3 lights = 20 ,triggerValue = 0
[DEBUG] 08:41:36: Loop - timer = 2
[DEBUG] 08:41:48: start, timer = 2 lights = 20 ,triggerValue = 1
[DEBUG] 08:42:36: Loop - timer = 1
[DEBUG] 08:43:36: Loop - timer = 0
[DEBUG] 08:44:59: start, timer = 0 lights = 0 ,triggerValue = 0
Link to comment
Share on other sites
8 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.