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

Count Down


TANE
 Share

Question

For occupation detection I need some kind of counter that will count down the time.

When there is motion or a door sensor is triggered timer is set to 60 minutes.

This will set the occupation to YES.

When no other sensor is triggered in 60 minutes occupation will be set to NO

I have about 15 sensors and maybe later some virtual devices like the ping command to my phone. All the sensors must be able to set the time to 60 minutes when triggered.

Can this be build in Blocks or do I need LUA?

Link to comment
Share on other sites

17 answers to this question

Recommended Posts

  • 0
Guest deraaij
For occupation detection I need some kind of counter that will count down the time.

When there is motion or a door sensor is triggered timer is set to 60 minutes.

This will set the occupation to YES.

When no other sensor is triggered in 60 minutes occupation will be set to NO

I have about 15 sensors and maybe later some virtual devices like the ping command to my phone. All the sensors must be able to set the time to 60 minutes when triggered.

Can this be build in Blocks or do I need LUA?

Can be done without LUA.

Make a scene which deducts 1 every minute from a global. And scene's which set the global to 60 when triggered. And a scene which switches YES and NO based on previous value and time (0 or >0)

Link to comment
Share on other sites

  • 0
  • Inquirer
  • When running the next scene it will countdown in few seconds to zero

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    Timer function.

    Please login or register to see this code.

    [ Added: 2013-03-13, 08:01 ]

    Last post was not so good, this is better (i think)

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
    Guest deraaij
    When running the next scene it will countdown in few seconds to zero

    If you don't want to use lua, this works for me:

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • When running the next scene it will countdown in few seconds to zero

    If you don't want to use lua, this works for me:

    @Mark,

    Your block example works fine...but it will run 24h a day...I have only added extra condition to stop when Occupation is 0.

    I think the problem is that HC2 is not understanding the double condition.

    [ Added: 2013-03-13, 21:14 ]

    Timer function.

    Please login or register to see this code.

    [ Added: 2013-03-13, 08:01 ]

    Last post was not so good, this is better (i think)

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    Please login or register to see this code.

    @ Jonny

    Thanks going to test your script...look good to mee.

    Link to comment
    Share on other sites

    • 0
    Guest deraaij

    I think it is becasue you global is used as trigger as well. Please a different variable for the timer and for the occupation. I think it will work.

    Link to comment
    Share on other sites

    • 0
    Guest jrkalf

    Enver, Mark, Jonny,

    Been reading a bit up to your conversation and it should be possible in 2 scene scripts. LUA being the most efficient way in my opinion to write it in.

    I'm making the very obvious untrue assumption that the motion sensors are device ID's 1001, 1002, 1003 and 1004.

    Basically, this script will continually check if one of the motion devices are triggered. If so, set the global variable Occupation to 1. And resets the Occupation timer you want to 60 minutes!!

    Please login or register to see this code.

    Next up is just the script that Jonny wrote with perhaps a small modifaction. I haven't tested it, I should really get that done with a motion sensor in my house.

    Check if the occupation flag is set to 1. If so, start a timer to run down to zero and set the occupation flag to 0.

    If the occupation timer is set to something else then 1, then wait a full minute before checking it again to be 1 and starting another timer.

    Please login or register to see this code.

    There's probably a major hole in it somewhere, I hope a lua guru can correct me on this

    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
  • Inquirer
  • I think it is becasue you global is used as trigger as well. Please a different variable for the timer and for the occupation. I think it will work.

    @Mark,

    Some extra conditions no succes in blocks.. see picture

    In think I have to look for LUA

    @ Jelle

    This is the result of convert...i bit to much...

    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" />

    Please login or register to see this code.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
    Guest jrkalf

    Enver,

    It shouldn't be hard to deduce that into something a lot smaller. A downside to using the blocks system would be comparable as writing a webpage using Microsoft Word... it generates a lot overhead

    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" />

    Your last picture I can't directly relate back to the initial question in the top posting.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • The last one was for just making two different conditions hope was that this will work..

    Very Basic.

    When there is motion downstairs set Occupation to 60 minutes.

    When there is no motion in 60 minutes this means there is no one downstair so that I can turn of some lights and devices.

    If you manually turn off the lights the Occupation time will be set to 0

    SuspendDb is just a extra condition so that the time is not directly set to 60 minutes when you walk to hallway..Suspend will give you few minutes so that you can go upstairs without directly triggering the Occupation.

    Scene 1

    If motion and Suspend = "No"

    then

    set Occupation to 60 minutes

    Scene 2

    IF Occupation > 0 and Suspend ="No"

    Do while

    Occupation= Occupation-1

    Scene 3

    IF Occupation >0 and Time of the Day ="Night" and Lights ="off"

    then

    Turn on the lights

    Scene 3

    IF Occupation =0 and and Lights ="on"

    then

    Turn Off the lights

    Link to comment
    Share on other sites

    • 0
    Guest jrkalf

    This idea of yours looks nice. I have to get my head around it trying to get it into code. I like the idea.

    here's a script for your SuspendDB part. I've added another global variable named SuspendDBTimer. If you have multiple devices that's allowed to "reset" the timer on the SuspendDB, you can use it to reset the timer to the appropriate time.

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi Jelle,

    back to your script..the other ones did not work...

    Will try to work this out...

    Link to comment
    Share on other sites

    • 0
    Guest jrkalf

    Looking at your specific wishes, you'll have to branch off into several scene scripts. This isn't something you can master into one global script.

    1 script will control your suspendDB timer

    1 script will controll your occupation timer

    1 script to controll your occupation variable based on the movement registered by the motion sensors.

    Now with the last script it's key to know the following. Do you want seperate motion detection by all your motion sensors or just any motion is enough to trigger the occupation timer? Reason for this question is ofcourse the option to send out seperate notifications based on which motion sensor is triggered. And ofcourse you want the motion sensor downstairs seperated from the general pool as it shouldn't be allowed to trigger the occupation sensor, unless it registers movement for more then 5 minutes.

    Jelle

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi Jelle,

    You are correct.

    At the moment it's not working since only the first condition is checked.

    See reported bugs 3.517

    Names of the variables and description

    - Suspend ( need this for suspending the scenes for X minutes. this will give you the chance to walk out the detection zone.)

    - OccupationTime When one of the sensor is triggered time will be set to X minutes

    - Occupation (Y/N) I think we don't need this. When the OccupationTime >0 then there is Occupation.

    Current problems:

    - In block scenes double conditions are not working

    - OccupationTime will not countdown correct..

    - Zwave Pir Sensor are to often creating false alarm. (Aeon 4-1)

    Link to comment
    Share on other sites

    • 0
    Guest jrkalf
    Hi Jelle,

    You are correct.

    At the moment it's not working since only the first condition is checked.

    See reported bugs 3.517

    Names of the variables and description

    - Suspend ( need this for suspending the scenes for X minutes. this will give you the chance to walk out the detection zone.)

    - OccupationTime When one of the sensor is triggered time will be set to X minutes

    - Occupation (Y/N) I think we don't need this. When the OccupationTime >0 then there is Occupation.

    Current problems:

    - In block scenes double conditions are not working

    - OccupationTime will not countdown correct..

    - Zwave Pir Sensor are to often creating false alarm. (Aeon 4-1)

    Weird, somehow the "double" conditions in the block scenes are working for my TV-off scene I wrote for my son

    Please login or register to see this image.

    /emoticons/default_wink.png" alt=";)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> And it does send a nice notification.

    OccupationTime did work in the previous version for me. I'll have to check it with the curernt version. Seems the Devs love ripping LUA to death and beyond. They've failed to implement important bits and ripped out the most important bit for cross connecting the device with other devices. (Still haven't been able to hook up my FHT stuff

    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 have any PIR's myself. Perhaps somewhere this year, after having the kitchen done.

    I'll see what code I can come up with this week. I have a bit of time to work on it.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Update:

    Sometime things are less complected if you think out of the box.

    I forget that there is a extra option called Arm / Disarm.

    If you don't want that lights turn on just Disram the sensor..

    Truning the lights ON in my scene will also Disram the sensor.

    Truning the Lights Off will Arm the sensor after X minutes.

    If the condition is true and if breached and armed and Lux < 25

    then the lights on scene will be run

    CountDown part is the next one...to have the WAF factor back

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
    Guest dsilletti
    Update:

    Sometime things are less complected if you think out of the box.

    I forget that there is a extra option called Arm / Disarm.

    If you don't want that lights turn on just Disram the sensor..

    Truning the lights ON in my scene will also Disram the sensor.

    Truning the Lights Off will Arm the sensor after X minutes.

    If the condition is true and if breached and armed and Lux < 25

    then the lights on scene will be run

    CountDown part is the next one...to have the WAF factor back

    Very smart idea!

    I will implement asap

    Domenico

    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.

     Share

    ×
    ×
    • Create New...