This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

[Solved] Turning lights off automatically (but not on)

k1sk1s Member
edited April 2018 in Questions & Help
Hi 
I've got Aeotec multisensor PIRs and Fibaro relays and dimmers which I understand Homey can talk to to switch lights on and off based on whether movement is detected.  What I'm not sure about is whether is rule can be constructed in Homey to only turn lights off if no movement is detected without first having turned them on with motion, as follows:

1- Somebody goes into a room and manually turns on the light 
2- After e.g. 30 minutes nobody is detected in the room, the lights go out
3- If after 30 minutes there is somebody in the room, the lights stay on (not switch back on manually or by waving)
4- If having turned on the light manually, the user turns them off again, they stay off until manually turned on again 

So for example, if somebody goes in to a room, switches the light on manually and then off again to e..g. watch a film, they stay off.  Whereas if they go into the room, turn the light on but then leave the room, after 30 minutes the lights go off.

Can it be done?

EDIT:

The solution is in post https://forum.athom.com/discussion/comment/70978/#Comment_70978, and then we can set the duration after the last motion is detected as shown at the bottom of this post: https://forum.athom.com/discussion/comment/71027/#Comment_71027

Comments

  • RocodamelsheRocodamelshe Member
    edited March 2018
    Sure!
    The way i like to do it it with Countdown app.
    Make a timer in settings/countdown and call it "U-name-it" , so whatever u like.
    Then make 3 flows:
    First is to stop the timer when there is movement.



    Next will be to start the timer.



    Last will be to turn of the lights when hourglass in empty. This is 30 minutes after last movement!




  • k1sk1s Member
    Thanks!
  • First try it!
  • yemoHyemoH Member
    When you have multiple motion sensors, you might want to look into the app Sets.
  • k1sk1s Member
    edited April 2018
    First try it!
    lol, you were right - I couldn't get it to work.  Maybe because I didn't accurately translate/guess the Dutch in the examples you kindly posted (or in the others on the forum) or because I haven't yet understood how Flows work or the appropriate logic. 

    I made a timer called Storage Room Lights off.  First question: do I need a uniquely named timer for each light/room?

    I assume  the thing on the left under 'when' in your first picture a motion sensor? 
    Google translate says "de bewegingsmelder gaat aan"  means "the motion detector goes on".   I have Aeotec MultiSensor 6,  so assuming the correct option/card "The motion alarm turned on".

    Assuming "zandloper leeg" => "hourglass empty" is the same as "Timer reaches zero (0)" in the English version of the Countdown app, so my 3 Flows look like this:





    My sensor is set to cancel the motion alarm after 120 seconds, so presumably the logic here is to wait 2 minutes after the last  motion is detected, then start a countdown (in may case another 3 minutes), then in that period if the motion is detected start (or should it be reset) the timer, then turn the lights off after the 3 minutes with no motion?  I don't have a reset option so, would it be the 'Adjust' option like this:




    Another question: if the lights aren't already on, is the last step (turning off) just ignored, or should a condition be put on the first one (e.g. something like "when...the Storage Room light is on and the Motion alarm is turned off"?

  • k1s said:

      First question: do I need a uniquely named timer for each light/room?
    U can call it whatever u like. U can also use the time for multiple lamps, whatever suits u best.


    k1s said:


    I assume  the thing on the left under 'when' in your first picture a motion sensor? 

    Correct!

    k1s said:


    Assuming "zandloper leeg" => "hourglass empty" is the same as "Timer reaches zero (0)" in the English version of the Countdown app
    Also correct

    k1s said:
    , so my 3 Flows look like this:






    Very nice. Only missing the "Turn the lights on"



    k1s said:

    My sensor is set to cancel the motion alarm after 120 seconds, so presumably the logic here is to wait 2 minutes after the last  motion is detected, then start a countdown (in may case another 3 minutes), then in that period if the motion is detected start (or should it be reset) the timer, then turn the lights off after the 3 minutes with no motion?
    Also correct.

    k1s said:



    Last flow is not needed. Timer is running in ur first card so no need to adjust it or reset it.


  • k1sk1s Member
    Sorry edited in another question while you were responding:

    If the lights aren't already on, is the last step (turning off) just ignored?

    or should a condition be put on the first one (e.g. something like "when...the Storage Room light is on and the Motion alarm is turned off"?

  • U can build in a condition if u like but when lights are off it's just a command to turn them off. Not needed but also not a problem.
  • k1sk1s Member
    Thanks,
    Another question [sorry].  Is the countdown timer necessary only because there is a limitation to the 'Motion alarm cancellation' setting for the motion sensor?  

    IN my MultiSensor 6 settings, against this option, the info says: "Time before motion alarm is turned off since last motion detected event. Range: 10 - 255 =seconds 256 - 3600 = minutes when divided by 60"  I've no idea what the means for the maximum & minimum range, but presumably I could just set that to the time delay after the last motion and not have to use a countdown timer - is that right?
  • k1sk1s Member
    I thought this might do it in one flow:

    It doesn't work, but why not?


  • Has to work, but your motion turned of can take up to 1 minute after the last motion was detected.
    Ore maybe one of the other flows are in conflict.
  • k1sk1s Member
    It seems to work only if I remove the middle card about checking of the light is on.  I wonder if "Is turned on" actually is an event not a state.  Is there a convention about this?  (Have to say, a s new to this, I find it all very confusing, and the official support very superficial)
  • And the community so helpful. Is it actualy turned on?
  • k1sk1s Member
    edited April 2018
    If I turn the light on, then this seems to work, with sensor is set to cancel the motion alarm after 120 seconds



    ...but I'm not 100% sure whether the motion (and 120 seconds) are reset during the cancellation period if new motion is detected

    EDIT: According to my tests the "Motion Alarm Cancellation period" for Aeotec Multisensor 6 does indeed seem to reset if it detects new movement after the first motion alarm is triggered, so this flow seems to do the trick by itself.
  • I don't know how this works with you're sensor, but the Xiaomi ones do this.
    So if motion is detected while still being active, the internal timer resets.
  • k1sk1s Member
    Still confused:  Is "Is tuned on" a state or an event?  i.e. is the flow checking if the light is on all the time its running or checking if the light was switched on?
  • Depends in what column you use it.
    A card in the when column acts as a trigger (a change like going on or going off).
    When used in the and/or column, it acts as a state (activity is on or activity is off)
  • k1sk1s Member
    Depends in what column you use it.
    A card in the when column acts as a trigger (a change like going on or going off).
    When used in the and/or column, it acts as a state (activity is on or activity is off)
    That makes sense, but then I would expect this flow to turn the lights off as soon as they are turned on:

    ...but it doesn't....not always

    This room is a WC with the switch on the outside. 

    If I turn on the light using switch, with the door closed, it turns the light off straight away.  Because the the motion alarm is on the off state, I suppose. 

    If I turn the light on and enter the room, the motion alarm is on, and then goes off after I leave, but the light doesn't turn off when the motion alarm return to the off state.  So it looks like the "And" isn't monitoring the state, but is simply looking at the state when the 'When.." happens.

    But when I turned the flow the other way round like this:

    , this time the 'And' does seem to be a monitoring the state.  With flow like this. I turn on the light at the switch outside, enter the room and the motion alarm is triggered, and begins is cancellation period (30 seconds in my test).  I leave the room at 20 seconds and ten seconds later the lights go off.  I repeat the test but this time stay in the room for 3 minutes.  The lights stay on all the time, until 30s after I leave the room.  This is the behaviour I was looking for, but I wish the flow conditions were easier to understand/more consistent.

    So it seems, at least with this equipment (Aeotec Multisensor 6 + Fibaro Double Switch 2), all we need is a single flow like the one in my earlier post, above: https://forum.athom.com/discussion/comment/70978/#Comment_70978, and then we can set the duration after the last motion is detected using the "Motion Alarm Cancellation" setting in the Aeotec Multisensor settings, here:

    ...or set a delay before turning the light off in the 'then' section of the flow:





Sign In or Register to comment.