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

Home away variable


Question

Posted

Hi.

Does anyone have some lua code that can sense if anyone is home through motion sensors (lets say if someone has not moved last 30 minutes or so) and set a variable to home or away?

 

Much appreciated.

Br

R

4 answers to this question

Recommended Posts

  • 0
Posted

Best wayto do this is code it in blocks and change over to LUA-code and make the necessary adjustments.

 

I have two scenes that do is:

 

1) First scene starts a countdown from the moment 6 different sensors show no motion: after 30 minutes the variable is set to "little movement" after 45 minutes the variable is set tot "no movement" and a second variable is set to "away"

 

2) Second scene stops the first scene and kills it (fibaro:killScenes() ) if one of the six sensors detects movement after all.

 

As said; the best way to learn this is to program it in blocks and then see what kind of Lua comes out of that after 'changing' the block scene to LUA-scene.

  • 0
  • Inquirer
  • Posted

    Thanks.

    If the second scene kills the first scene how do you detect "away" later then?

    • 0
    Posted

    Thanks.

    If the second scene kills the first scene how do you detect "away" later then?

    The point is that the second scene not only kills the first scene but sets the 'movement' variable back to 'normal' and the other variable back to 'home'. So if the full cycle of 45 minutes is allowed to proceed we will end with two changed variables, one that says 'no movement' and one that says 'away'. And the (change in the) status of these variables triggers a waterfall of other scenes which will shut some things off, others on, arm alarms if necessary, let the camera's make pictures if outside sensors are triggered etc...

     

    If the full cycle of 30 or 45 minutes is broken by one of the sensors detecting movement, then the countdown stops and only starts again when all six sensors report 'no movement' in their area.

    • 0
    Guest eileff
    Posted

    How would this Home Away Variable detect that someone is there, if they are say asleep? There is not to much motion to detect while sleeping. 

     

    Br,

    E

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