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

Start a scene after there are movement during say 30 seconds


Question

Posted

Hi!

I guess this is super simple but i just can´t get out how to do it. Don´t have the coding skills more than i can understand the more simple and copy paste i some way.

 

I have a hallway where i also pass to get to the bathroom and bedroom. Now i have a scen that are lightning up the room when i open the door and then after a minute or two goes back to the earlier lampvalue. But what i want is to turn on that scen or light up the hallway when im in the hallway starting to get dress (after 30 seconds or somthing). But i don´t want it to turn on every time i pass to go to the other rooms.

11 answers to this question

Recommended Posts

  • 0
Posted (edited)

@csabe

 

Well, first of all I assumed that you are using fibaro motion sensor...

Please login or register to see this code.

This scene starts when your motion sensor ID is breached. The while loops checks for motion stop in every second. If there is no motion in any second within 30 seconds,  scene aborts.  On the contrary when the while loop can run for 30s, then if motion sensor is still breached, then you can run anything u want.

 

Hope my understanding is correct and this helps.

Edited by Sirhideo
  • 0
  • Inquirer
  • Posted

    Thanks!! @Sirhideo 

    But i don´t really get it to work, (i added an end in the end that i think are the right place).

     

    But when i just pass the motiondetector/halway, it will light up after 30 seconds even if i don´t have been close after that. And i never get the debug "no motion within 30 seconds" depending how i move or not.

     

    Christian

    • 0
    Posted (edited)

    @csabe

     

    Looks like I understand more what you mean... let me re-do the whole reply again...

     

    You have a hallway, in the hallway there are 2 rooms (A and B).

     

    You have different scenes (triggered by doorsensor) to control the light INSIDE those rooms.

     

    You want to turn on the light in ROOM (A) ONLY, TOGETHER WITH hallway if the motion sensor in the hallway has breached more than 30 seconds?

     

    If you walk through room A, your intention is to go room B, which you do not need the hallway light to be on?  So u are being dark in the hallway within the first 30 seconds, then light turn on ?

    Edited by Sirhideo
    • 0
  • Inquirer
  • Posted

    @Sirhideo Sorry maybe i was not to clear.

     

    alt 1. I move to the hallway and in to the Bedroom or Bathroom. (i dont want anything to happen, the light is as it is in the hallway)

     

    alt 2. I move to the hallway and start to put on my jacket. (then i want the light in hallway to turn on during the time im there (or i activate my scene i have right know to read the current value, turn it to 100 during 30 seconds and then change it back to the old value)

    To get this i guess the light in the hallway need to be off for 15 sec or something to understand that there are continues movement and something are really happening in the hallway and not just passing.

     

    Hope i could get the idé to words :-)

    And big thanks for helping out.

     

    Christian

    @Sirhideo

     

    You have a hallway, in the hallway there are 2 rooms (A and B).

    – Correct 

     

    You have different scenes (triggered by doorsensor) to control the light INSIDE those rooms.

    I just have a doorsensor on the front door (that just now trigger to turn on the lamp, but then i often is done if i go out :-) )

      

    You want to turn on the light in ROOM (A) ONLY, TOGETHER WITH hallway if the motion sensor in the hallway has breached more than 30 seconds?

    The lights in A & B can be as it is.

     

    If you walk through room A, your intention is to go room B, which you do not need the hallway light to be on?  So u are being dark in the hallway within the first 30 seconds, then light turn on ?

    Yes, correct. (When i arrive home i have a scen that are putting a little cozy light in the hallway so its never dark, but my plan is to do it brighter when im there.)

    • 0
    Posted (edited)

    @csabe

     

    Right ok, lets do 60 seconds testing first, too short time may involve motion sensor parameter change (how sensitive, how long to detect a motion that kind of thing), which I am not good at it but get the scene logically work first.

     

    Please login or register to see this code.

    You should see on debug screen to start counting... 1, counting..2 up to 60 seconds if u are in the hallway keep motioning. If not, this scene will abort.

     

    So after 60 seconds of movement, the while loop ends and run the last part, this part u should put your light scene etc there.

     

    In fact, in the hallway only motion sensor can understand there are continuously movement, not the light.  So either turn on the hallway light once there is a movement or not, is totally up to you.  If you want it to turn on, follow my comment inside while loop.  But please understand that the while loop keeps looping every seconds until counter reach 60, i.e. your start light code will also run every second.  make sure the scene or code is not too fancy like color change, or else it may become disco :)

     

    You may also put the turn on light scene above while loop, so that when motion sensor is triggerred (scene start), run the turn on light scene once.

     

    if fibaro:call(motionID, "value") == "1" then

       fibaro:starScene(xxx) -- your turn on hallway light scene with light brighter perhaps, or

       fibaro:call(lightID, "turnOn")

       fibaro:call(dimmer ...etc ....)

    end

     

    while ..... do....

     .....

    end

    Edited by Sirhideo
    • 0
  • Inquirer
  • Posted

    I can´t get it to start, i have "automatic" and added classic code from block before just do try aswell.

    if move and after that klick start then it starting to count.

     

    Please login or register to see this code.

    @Sirhideo

    • 0
    Posted (edited)

    @csabe

     

    What do u mean by can't get it to start? any message in debug window?

     

    Please login or register to see this code.

    Edited by Sirhideo
    • 0
  • Inquirer
  • Posted

    @Sirhideo Nothing happends when i move before the detector, but if i move and then push the start then it starting to count.

    • 0
    Posted

    @csabe

     

    make the declare section like below

     

    Please login or register to see this code.

    • 0
  • Inquirer
  • Posted

    @Sirhideo ahh... removed that, now something happend :-) i do some more testing.

     

    THANKS!!

    • 0
    Posted

    @csabe, nice, please let me know the result.

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