# Help needed with a presence flow based on a motion sensor

**URL:** <https://community.homey.app/t/help-needed-with-a-presence-flow-based-on-a-motion-sensor/26001>\
**Category:** Flows\
**Created:** [February 17, 2020, 9:43am UTC](https://community.homey.app/t/help-needed-with-a-presence-flow-based-on-a-motion-sensor/26001 "2020-02-17T09:43:39Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martijn](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijn/32/12430_2.png) [@Martijn](https://community.homey.app/u/Martijn)\
**Post date:** [February 17, 2020, 9:43am UTC](https://community.homey.app/t/help-needed-with-a-presence-flow-based-on-a-motion-sensor/26001/1 "2020-02-17T09:43:39Z")

</div>

Hello all,

I’m trying to create a flow for the time someone is present in my house. I have a Fibaro motion sensor in the room I want to monitor. Before I just checked my insights and then (pre 2.0) you could perfectly see the motion diagram and there you go. But since 2.0 that’s gone (I still don’t know why because it’s the main feature to read in a motion sensor) and now I want to create a flow for this.

Basicly it should do the following;

when the motion sensor is inactive for more than 20 minutes mark a start time  
when the motion sensor is again inactive for more then 20 minutes mark an end time  
Report the total time between the two marks by message on phone.  
Flow ends.

What could be a smart flow for this?  
Tia,

Martijn

---

<div class="post-metadata">

**Author:** ![PetervdK](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/petervdk/32/20669_2.png) [@PetervdK](https://community.homey.app/u/PetervdK)\
**Post date:** [February 17, 2020, 10:22am UTC](https://community.homey.app/t/help-needed-with-a-presence-flow-based-on-a-motion-sensor/26001/2 "2020-02-17T10:22:34Z")

</div>

Erm, would the result not be always 20 minutes if no motion is registered?  
And nothing happens when there is motion registered?

---

<div class="post-metadata">

**Author:** ![Martijn](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijn/32/12430_2.png) [@Martijn](https://community.homey.app/u/Martijn)\
**Post date:** [February 17, 2020, 10:37am UTC](https://community.homey.app/t/help-needed-with-a-presence-flow-based-on-a-motion-sensor/26001/3 "2020-02-17T10:37:54Z")

</div>

True, and that’s exactly where I run into.

Let’s say, we leave the house before 0930. Between 1000-1030 someone enters. Then the flow should notice this by a lenght of time there wasn’t activity. Assuming that the person moves a bit the motion sensor keeps seeing this. And ends when there is a pauze greater then 20 mins, assuming the person has left the house.

---

<div class="post-metadata">

**Author:** ![PetervdK](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/petervdk/32/20669_2.png) [@PetervdK](https://community.homey.app/u/PetervdK)\
**Post date:** [February 17, 2020, 11:57am UTC](https://community.homey.app/t/help-needed-with-a-presence-flow-based-on-a-motion-sensor/26001/4 "2020-02-17T11:57:07Z")

</div>

Hmm, i think then you have to use the “motion alarm turned off” card with a timer or variables.

Something with

- if the motion alarm turned off, start timer
- if motion detected and timer \> 20 then notify and stop timer else do nothing

Also i seem to remember there was already a topic about this but then with switching on and off some lights…

---

<div class="post-metadata">

**Author:** ![Marcel\_Ubels](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_ubels/32/18860_2.png) [@Marcel\_Ubels](https://community.homey.app/u/Marcel_Ubels)\
**Post date:** [February 17, 2020, 2:30pm UTC](https://community.homey.app/t/help-needed-with-a-presence-flow-based-on-a-motion-sensor/26001/5 "2020-02-17T14:30:13Z")

</div>

Something like; WHEN motion sensor turns on, THEN Stop 24-hour Timer, Stop 8 hour Timer(10 sec delay). WHEN motion sensor turns off, THEN start 24-hour Timer(86400 sec).  
WHEN 24-hour Timer value changes, AND Logic(24-hour timer) is less then 85200, THEN Start 8-hour Timer.  
WHEN motion sensor turns on, AND 8-hour Timer is running, THEN mobile send a push message Motion detected: Total off {{28800-tag 8-hour Timer}} seconds

---

<div class="post-metadata">

**Author:** ![M\_a\_r\_c\_o](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/m_a_r_c_o/32/146_2.png) [@M\_a\_r\_c\_o](https://community.homey.app/u/M_a_r_c_o)\
**Post date:** [February 18, 2020, 8:53am UTC](https://community.homey.app/t/help-needed-with-a-presence-flow-based-on-a-motion-sensor/26001/6 "2020-02-18T08:53:43Z")

</div>

Using countdown app? I have bad experience using the motion off, but good experience with the motion on.

- IF motion detected AND countdown =-1 THEN set countdown to 20 minutes AND notify (Someone came home) ELSE set countdown to 20 minutes
- IF countdown = -1 [AND no motion] THEN notify (Nobody at home), LOG(No more motion detected)

---

<div class="post-metadata">

**Author:** ![Frank\_van\_de\_Schuur](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/frank_van_de_schuur/32/35882_2.png) [@Frank\_van\_de\_Schuur](https://community.homey.app/u/Frank_van_de_Schuur)\
**Post date:** [February 18, 2020, 11:56am UTC](https://community.homey.app/t/help-needed-with-a-presence-flow-based-on-a-motion-sensor/26001/7 "2020-02-18T11:56:57Z")

</div>

Yep, I’m using the countdown app as well, and I’m also very satisfied with it

---

<div class="post-metadata">

**Author:** ![Simen\_Ringstad](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/simen_ringstad/32/12518_2.png) [@Simen\_Ringstad](https://community.homey.app/u/Simen_Ringstad)\
**Post date:** [February 21, 2020, 5:25pm UTC](https://community.homey.app/t/help-needed-with-a-presence-flow-based-on-a-motion-sensor/26001/8 "2020-02-21T17:25:26Z")

</div>

I have something similar set up and I think you should consider to disable the flow that triggers the action and sets the countdown, while the countdown is running. One reason was that countdown reset its value back to start everytime movement happened , another was that Homey had to process a pile of requests from the IR sensor every time movement was discovered (alot because people seems to move their body all the time:-)

---

<div class="post-metadata">

**Author:** ![Martijn](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijn/32/12430_2.png) [@Martijn](https://community.homey.app/u/Martijn)\
**Post date:** [February 27, 2020, 11:09pm UTC](https://community.homey.app/t/help-needed-with-a-presence-flow-based-on-a-motion-sensor/26001/9 "2020-02-27T23:09:29Z")

</div>

Thanks for the help but I can’t get it to work. I’m trying to convert your input to flows but I can’t find the right syntax. And I can’t find the ELSE option?

Would anybody be so kind to post a screenshot from such a flow?

---

<div class="post-metadata">

**Author:** ![PetervdK](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/petervdk/32/20669_2.png) [@PetervdK](https://community.homey.app/u/PetervdK)\
**Post date:** [February 28, 2020, 5:43am UTC](https://community.homey.app/t/help-needed-with-a-presence-flow-based-on-a-motion-sensor/26001/10 "2020-02-28T05:43:49Z")

</div>

[https://community.homey.app/search?q=where%20is%20the%20else%20part](https://community.homey.app/search?q=where%20is%20the%20else%20part)

First result:

> [@Getting Started - The 'or' and 'else' parts of a flow](https://community.homey.app/t/getting-started-the-or-and-else-parts-of-a-flow/20059):
>
> Hi again! I hope you all enjoyed the first tutorial. This tutorial continues where the first one left off. In this tutorial, you will learn: to use the ‘or’ card to use the ‘else’ card This tutorial is a bit shorter than the first. Let’s start with the same flow: Now, this flow makes me unhappy. As you might remember, Grumpy is watching her show. She doesn’t bother to greet me. And Homey doesn’t say anything, because this flow stops when it concludes that the chromecast is playing.…

---

<div class="post-metadata">

**Author:** ![Martijn](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijn/32/12430_2.png) [@Martijn](https://community.homey.app/u/Martijn)\
**Post date:** [March 12, 2020, 6:34pm UTC](https://community.homey.app/t/help-needed-with-a-presence-flow-based-on-a-motion-sensor/26001/11 "2020-03-12T18:34:01Z")

</div>

@M_a_r_c_o Now I have this, is this correct? I don’t fully understand how the countdown works…

[https://homey.app/f/J1Q-f3](https://homey.app/f/J1Q-f3)

and a second flow

[https://homey.app/f/Jbw1g3](https://homey.app/f/Jbw1g3)
