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

Question: How to disable the motion sleeping time?


tiCeR

Question

Hey FIBARO Community,

 

i started to code my own scenes in lua some days ago and finally finished some automated parts. The script is working well but there is a part i don't know how to fix. I will comment inline so please read the whole topic.

 

1. Define the motion (ID 102) after the properties to tell the script to act if the value of motion changes

Please login or register to see this code.

2. Define all ID's i want to use in this script 

Please login or register to see this code.

3. Time in seconds the lamp should be activated

Please login or register to see this code.

4. Write the motion value to a variable and convert it from string to integer to be able to work with it later

Please login or register to see this code.

5. Check if this scene is already active and stop if its true

Please login or register to see this code.

6. If motion is activated (value is > 0), activate the lamp

Please login or register to see this code.

7. Set the current time to the variable timer and as long as the current time minus the 'timer' is smaller then the 'starttimer' that was set on top, let the script sleep. If there is still movement reset the timer to hold the lamp activated.

Please login or register to see this code.

8. If the difference in seconds is higher then defined on top, disable the lamp again

Please login or register to see this code.

9. End the if and kill the scene

Please login or register to see this code.

Okay this is the script and its working well but?

 

This is right -> If i activate the lamp on the switch the lamp stays activated and works. 

This fails -> If i disable the lamp on the switch the motion sensor does not activate the lamp again if i walk into it.

 

It looks like the motion sensor still sleeps and i need to wait like 30 seconds before it is working again. I already tried to change some parameters (2,6) on the motion settings but nothing helps me out here. I want that the motion always works and checks and starts the scene also when i disabled the lamp with the switch some seconds before.

 

I already tried to write another scene that kills the motion scene from above when i turn the switch because i was thinking its still running and can't run twice but it feels for me that the motion needs like 30 - 40 seconds to get back to working.

 

I really hope you can help me out here.

 

Greetings,
tiCeR

Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 0
  • Inquirer
  • Sorry topic was fail posted before i was done with writing. I edited the first comment now and the question is included.

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    Link to comment
    Share on other sites

    • 0

    Every motion sensor has a blind time after being triggered. Have a look at the parameters. I've set my Aeon MultiSensors to 6 s.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Every motion sensor has a blind time after being triggered. Have a look at the parameters. I've set my Aeon MultiSensors to 6 s.

     

    I already set that blind time to 1s and the problem is still the same. If i disable the lamp with the switch and walk into the motion sensor it does not activate the lamp again. If i move out of the motion and wait for 30 -40 seconds and get back in the light gets enabled.

    Link to comment
    Share on other sites

    • 0

    I might be wrong but I think the minimum is 2 or 4 seconds. I am not certain that info is in the manual. Anyway, did you wake up the sensor so it gets the new parameter? Maybe write a small scene with only the sensor as a trigger and a debug statement with the value. It can help you to confirm that you get triggers when you expect them.

    Link to comment
    Share on other sites

    • 0

    Is it possible that your script is still running?

    I think it is like this:

    Your script recognizes your movement and enables light.

    You are still moving while you toggle the switch to disable light.

    The light is off but the script is still running and waits for about 10 seconds to quit finally.

     

    Just insert some debug output in your main loop and you should see this output in the debug window.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Is it possible that your script is still running?

    I think it is like this:

    Your script recognizes your movement and enables light.

    You are still moving while you toggle the switch to disable light.

    The light is off but the script is still running and waits for about 10 seconds to quit finally.

     

    Just insert some debug output in your main loop and you should see this output in the debug window.

     

    That was the part i was thinking about first but i created a second scene for the switch that always kills the motion scene when it gets changed.

    That way i should have stopped the scene and it directly should be back to check if someone moves or not?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I might be wrong but I think the minimum is 2 or 4 seconds. I am not certain that info is in the manual. Anyway, did you wake up the sensor so it gets the new parameter? Maybe write a small scene with only the sensor as a trigger and a debug statement with the value. It can help you to confirm that you get triggers when you expect them.

     

    Oh okay i will try it with 2 and 4 seconds when back home and see if that helps. What do you mean by wake up the sensor?

    Link to comment
    Share on other sites

    • 0

    If you change a parameter on a battery device, you have to go there and click or long press or triple click, it is in the manual, so it wakes up and pulls the changes from the HC2. Or wait until it wakes up by itself. For a multisensor, that can take 4080 seconds.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • If you change a parameter on a battery device, you have to go there and click or long press or triple click, it is in the manual, so it wakes up and pulls the changes from the HC2. Or wait until it wakes up by itself. For a multisensor, that can take 4080 seconds.

     

    Okay i will let you know if i got it managed after work. Thanks for you help.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Okay i set the parameter now to 2 seconds and it seems to be a bit faster.

     

    But it still is not available directly after i turned the light off with the switch.

     

    My plan was to kill the active motion scene from above to let it run again but as i notice on the rest api it tells that the scene is not killable?

     

    I really hope to find a solution for this

    Please login or register to see this image.

    /emoticons/default_sad.png" alt=":(" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    Link to comment
    Share on other sites

    • 0

    Okay i set the parameter now to 2 seconds and it seems to be a bit faster.

     

    But it still is not available directly after i turned the light off with the switch.

     

    My plan was to kill the active motion scene from above to let it run again but as i notice on the rest api it tells that the scene is not killable?

     

    I really hope to find a solution for this

    Please login or register to see this image.

    /emoticons/default_sad.png" alt=":(" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    I don't understand... Might have something to do with unusual low caffeine levels in my blood... What do you mean by "available"? And what is "immediately"? Seconds? Minutes?

    I'll probably understand if you post some steps to reproduce the issue, like...

    - You walk in the room.

    - The light turns on.

    - You switch the light off.

    - You stay still for 2 seconds, then you move.

    - You expect the light to turn on, but it doesn't.

    You don't need REST to kill a scene... Or did I miss something? Use fibaro:killScenes(sceneID) to kill all scenes with that ID. Call it from your own scene to abort all instances. Scene ID is on the "general" tab, but you knew that already. Maybe put a debug statement before this, and also before the abort() you already have, so you notice when it happens.

    I have some scripts that work in tandem that way. One script does the timing on the light. The other script uses the motion detection to turn the light/timer(s) on-off. I would like to share it, but unfortunately these scripts are not very readable, I would have to turn them into some "educational example". Unfortunately, I have a few other problems to solve first.

    The MultiSensor devices are faster when included and running on USB power. It make as much as 2 seconds. Human beings detect things that are 0.5 seconds faster so it is noticeable. The different behavior probably has to do with power saving, but that is speculation. I've always felt, but not measured, that an FGMS is faster. Also notice that a MultiSensor detects motion faster, when it has just done so (on batteries). It's like it stays faster for several minutes (sorry, no exact timing), then goes back into some power save mode. Did you notice this?

    Do you own an alarm system? It might be compatible with the Fibaro Universal Binary Sensor. This sensor sends status with less than 0.5 seconds of delay, so it depends only on the performance of the PIR of your alarm system.

    Link to comment
    Share on other sites

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