# Advanced Flow: Turn on Lights/Fan with motion then turn off if no motion

**URL:** https://community.homey.app/t/advanced-flow-turn-on-lights-fan-with-motion-then-turn-off-if-no-motion/122318
**Category:** Flows
**Tags:** z-wave, devices, flow, homey-pro, advancedflow
**Created:** [December 2, 2024, 12:05am UTC](https://community.homey.app/t/advanced-flow-turn-on-lights-fan-with-motion-then-turn-off-if-no-motion/122318 "2024-12-02T00:05:35Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![VipeNess](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/vipeness/32/79472_2.png) [@VipeNess](https://community.homey.app/u/VipeNess)
#### Post date: [December 2, 2024, 12:05am UTC](https://community.homey.app/t/advanced-flow-turn-on-lights-fan-with-motion-then-turn-off-if-no-motion/122318/1 "2024-12-02T00:05:35Z")

</div>

I’m needing assistance (very new) to Homey Pro. I built an advanced flow for a bathroom. I have a fan on/off switch, dimmer for the light and motion sensor in the bathroom. When the user walks into the bathroom, I want to turn the lights and fan on. While they are in the bathroom, the motion sensor will keep picking them up and know that the user is still in here. When it detects no more motion because the user left, to start a countdown and turn off the lights and fan after 1 minute.

So far, based on the flow I built below, it seems the lights and fan come on with no issue but at some point, it triggers the fan to randomly turn off or the lights, even with movement.

Here is what it looks like:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/9/b96d2b3004eb8535858d909ed9f60da7a0a73118.png)

Here is the settings from the motion sensor:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/e/ee17fece12b6557e0171444d20525b18db044764.png)

Any advice would be helpful!

---

<div class="post-metadata">

### Author: ![Wim\_Post](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wim_post/32/56793_2.png) [@Wim\_Post](https://community.homey.app/u/Wim_Post)
#### Post date: [December 2, 2024, 9:00am UTC](https://community.homey.app/t/advanced-flow-turn-on-lights-fan-with-motion-then-turn-off-if-no-motion/122318/2 "2024-12-02T09:00:02Z")

</div>

I would set the ‘blind’-time of the motion sensor to 30 seconds.  
And make the flow with two timers like this:

 ![Scherm­afbeelding 2024-12-02 om 10.20.49](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/f/4f59ac46feb30214d6ebd6c4993398b761cda5f3.jpeg)  
Let ‘spot 1’ be your lights and ‘spot 2’ your fan.  
The motionsensor can detect new movements after 30 seconds and will restart the timer of 5 minutes. So 5 minutes after the last movement the lights turn off and the timer ‘keep fan running’ starts. New movement will stop timer ‘keep fan running’.

---

<div class="post-metadata">

### Author: ![VipeNess](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/vipeness/32/79472_2.png) [@VipeNess](https://community.homey.app/u/VipeNess)
#### Post date: [December 10, 2024, 10:42pm UTC](https://community.homey.app/t/advanced-flow-turn-on-lights-fan-with-motion-then-turn-off-if-no-motion/122318/3 "2024-12-10T22:42:08Z")

</div>

> [@Wim\_Post](#):
>
> would set the ‘blind’-time of the motion sensor to 30 seconds.

I went into the sensor and under Advanced Settings, there isn’t a blind time option. Any ideas?

---

<div class="post-metadata">

### Author: ![Wim\_Post](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wim_post/32/56793_2.png) [@Wim\_Post](https://community.homey.app/u/Wim_Post)
#### Post date: [December 11, 2024, 7:07am UTC](https://community.homey.app/t/advanced-flow-turn-on-lights-fan-with-motion-then-turn-off-if-no-motion/122318/4 "2024-12-11T07:07:57Z")

</div>

I have an Aqara motionsensor and can’t set the motion off alarm shorter then 60 seconds:

 ![IMG_1831](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/c/9c7300f8177440ce6b1a43112c40f71f012eb5fd.jpeg)

What is is your time between alarm on and off?

---

<div class="post-metadata">

### Author: ![Jumeira](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jumeira/32/69412_2.png) [@Jumeira](https://community.homey.app/u/Jumeira)
#### Post date: [December 22, 2024, 9:17am UTC](https://community.homey.app/t/advanced-flow-turn-on-lights-fan-with-motion-then-turn-off-if-no-motion/122318/5 "2024-12-22T09:17:43Z")

</div>

I am doing the same flow as well, but a bit complicated and it work as charm.  
The only thing is missing is adding another flow to turn on the fan is the motion is active for more than 5 mins and turn it off if countdown ended with no motion is detected… the issue (where i seek help) is how to manage it when another flow is active with regards with humidity level?

 ![floow](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/6/36ffb8dd2d8c604af8f93d1e4f30c4c61eadd99f.jpeg)

---

<div class="post-metadata">

### Author: ![Wim\_Post](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wim_post/32/56793_2.png) [@Wim\_Post](https://community.homey.app/u/Wim_Post)
#### Post date: [December 22, 2024, 11:05am UTC](https://community.homey.app/t/advanced-flow-turn-on-lights-fan-with-motion-then-turn-off-if-no-motion/122318/6 "2024-12-22T11:05:43Z")

</div>

This would be my approach/;  
Let ‘plafond 1’ be your shower strip.  
Plafond 2 is your bathlights  
Plafond 3 is your fan.

The time between motionalarm on and motionalarm off is in my case 1 minute.  
So after 1 minute it can detect new motion and will restart the timer of 5 minutes.  
So when the timer ends there hasn’t been movement for at least 4 minutes.

 ![Scherm­afbeelding 2024-12-23 om 14.01.33](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/7/67fa2bb4c084596e623dce516639caf3ad72f7be.png)

When the timer ends the lights are turned off and the fan not untill the humidity is under 60.
