Hi everyone,
It’s time to share back what I learned here.
I have -in the past- tried several strategies to use lights that automatically trigger when movement is detected. Also, a lot has been written about this topic, for example:
- Tutorial - Advanced automatic light control with flows
- [Simple] Lights turning on/off based on motion - #33 by EvR
and many more.
All of these either use
- the CountDown App -or-
- the Timer App
This allows for a lot of flexibility. But it can be tricky to configure. The best thing that worked for me is turning on the light when motion is detected, and when no more motion is detected, starting a timer to turn it off after a certain delay.
Been there, done that etc… However recently someone made me aware of the Zone Activity support of Homey, and the fact that it understands when “no activity has been detected in xxxx minutes”.
I have a use case in my ground floor hallway with 3 smart lights, 4 doors, and 3 motion sensors. No my house is not that big, I just have a lot of corners in my ground floor hallway…
Here’s the user story:
AS A person
I WANT TO have the light switched on when movement is detected or if the door is opened, and automaticaly switched off after several minutes when movement is no longer detected and all doors are closed
SO I CAN have lights controlled automatically and power is saved when I am not around or forget to turn off the lights
All the doors, motion sensors and lights are in the same zone. As an extra requirement I want the ability to switch on/off the automatic behaviour; for example in case I need the light to stay on or off indefinitely.
For this to work, I started with a virtual device to control the automatic behaviour. I used a virtual device for this.
Next I created 2 flows to control the light.
The first flow turns the light on when activity (movement or door open) is detected in the zone:
As you can see, the flow respected the setting of the ‘autocontrol’ device. If that is off, the light will not turn on.
The second flow turns the light off after 5 minutes of inactivity (since all doors closed or movement):
With this approach, not all flexibility of the timer-/countdown-based flows can be achieved, but the amount of flows can be kept very low: Two flows: one for turning on, and one for turning off the lights.
In my example here I control an individual light, but it’s also possible to control all lights in a specific zone, so you don’t need to control each light individually.
That would look similar to:
Or you could use the < group > App and control certain device groups.
Hope this sharing helps All the best!