# Switch to presence

**URL:** <https://discourse.nodered.org/t/switch-to-presence/28109>\
**Category:** General\
**Created:** [10 June 2020 12:40 UTC](https://discourse.nodered.org/t/switch-to-presence/28109 "2020-06-10T12:40:02Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vlak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vlak/32/26888_2.png) [@Vlak](https://discourse.nodered.org/u/Vlak)\
**Post date:** [10 June 2020 12:40 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/1 "2020-06-10T12:40:03Z")

</div>

Dear people, I want to create a flow using a device tracker.  
I want to have a cover closed when I'm not home at a certain time. And I want this same cover to stay open when I am at home.  
I don't expect this to be very difficult, but I can't figure it out. can someone help me

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [10 June 2020 15:09 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/2 "2020-06-10T15:09:42Z")

</div>

The difficult part is knowing when you are at home. How do you propose to do that?

---

<div class="post-metadata">

**Author:** ![Vlak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vlak/32/26888_2.png) [@Vlak](https://discourse.nodered.org/u/Vlak)\
**Post date:** [10 June 2020 17:03 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/3 "2020-06-10T17:03:44Z")

</div>

i am using node red in combination with hassio. and true the ping service I check whether residents are at home. I have to say that this is quite reliable. I want to make conditions with this information to, for example, entities.  
do you have any idea how to make the flow?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [10 June 2020 18:56 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/4 "2020-06-10T18:56:18Z")

</div>

> [@Vlak](#):
>
> I want to make conditions with this information to, for example, entities.

I don't understand what that means.

---

<div class="post-metadata">

**Author:** ![Vlak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vlak/32/26888_2.png) [@Vlak](https://discourse.nodered.org/u/Vlak)\
**Post date:** [10 June 2020 19:00 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/5 "2020-06-10T19:00:37Z")

</div>

apologies for my poor english.  
i will give the example what i want to switch.  
when I'm not at home I want my shutters to close at a certain time. when I am at home I want them to stay open as long as I close them myself via the remote control

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [10 June 2020 20:10 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/6 "2020-06-10T20:10:15Z")

</div>

You indicated that you already have the flow that tells you whether you are at home or not, is that correct.  
Do you know how to open and close the shutters?

---

<div class="post-metadata">

**Author:** ![Vlak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vlak/32/26888_2.png) [@Vlak](https://discourse.nodered.org/u/Vlak)\
**Post date:** [10 June 2020 20:15 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/7 "2020-06-10T20:15:55Z")

</div>

that is correct, I have 2 working flows

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [10 June 2020 20:46 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/8 "2020-06-10T20:46:13Z")

</div>

So what exactly don't you know how to do?

---

<div class="post-metadata">

**Author:** ![Vlak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vlak/32/26888_2.png) [@Vlak](https://discourse.nodered.org/u/Vlak)\
**Post date:** [10 June 2020 20:49 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/9 "2020-06-10T20:49:53Z")

</div>

I have a flow that causes the cover to close at 2pm. what does the flow look like that ensures that when i get home the cover does not respond to the timer, but just stays open and if i don't get home the next day the cover just closes

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [10 June 2020 21:07 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/10 "2020-06-10T21:07:49Z")

</div>

The first thing you need to do is to get the timer event and the presence state into one message so then you can decide what should be done. Have a look in the node-red cookbook at the example flow on Joining Streams. You can use that technique to achieve both conditions in one message.

---

<div class="post-metadata">

**Author:** ![Vlak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vlak/32/26888_2.png) [@Vlak](https://discourse.nodered.org/u/Vlak)\
**Post date:** [10 June 2020 21:17 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/11 "2020-06-10T21:17:32Z")

</div>

can you give an example what this flow should look like?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [11 June 2020 06:10 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/12 "2020-06-11T06:10:27Z")

</div>

There is one in the cookbook post that I suggested.

---

<div class="post-metadata">

**Author:** ![Vlak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vlak/32/26888_2.png) [@Vlak](https://discourse.nodered.org/u/Vlak)\
**Post date:** [11 June 2020 08:01 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/13 "2020-06-11T08:01:58Z")

</div>

![Node red](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/b/eb9987988b6ea2fe9da91559cb54a549f0df717d.jpeg)  
dear Collin what I want to create is the following. I just made a copy of my working flows. The top one is a working presence detection. the bottom one is a working flow for closing the roller shutter. the shutter is closed by means of a remote control or on time. i want to combine the top with the bottom. So all the presence detection of the upper flow indicates that someone is at home, the roller shutter should not close at the set times, but simply remain open. I understand the joining flow but I have no idea how it will help me with a solution. And with the Cookbook I don't get much wiser from this either. could you or someone else show a flow how i could build it.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [11 June 2020 08:43 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/14 "2020-06-11T08:43:35Z")

</div>

Add a debug node showing what comes out of the blue node in the top left hand corner and others showing what is going into the blue ones on the right.  
Also tell us what types those nodes are.

---

<div class="post-metadata">

**Author:** ![Vlak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vlak/32/26888_2.png) [@Vlak](https://discourse.nodered.org/u/Vlak)\
**Post date:** [11 June 2020 11:33 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/15 "2020-06-11T11:33:58Z")

</div>

From the node in the top left corner, there comes from "Home" or "Not Home".  
from the nodes right there comes out roller shutter up or roller shutter down.  
the nodes are all for home assistant  
the top left is an event state node and the top right are call service nodes.s.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [11 June 2020 12:39 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/16 "2020-06-11T12:39:41Z")

</div>

It is better to show us exactly what you get. Then there is no confusion. For example, you said roller shutter down but is that a string or what? You said that comes out of the node, we need to know what goes into it.

---

<div class="post-metadata">

**Author:** ![didiergithub](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/didiergithub/32/24063_2.png) [@didiergithub](https://discourse.nodered.org/u/didiergithub)\
**Post date:** [16 June 2020 18:59 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/17 "2020-06-16T18:59:39Z")

</div>

Hi Vlak, you could try with this node-red-contrib-simple-gate. You put the gate between your timers and your shutters and you set it to close when at home and to open when not at home.

---

<div class="post-metadata">

**Author:** ![Vlak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vlak/32/26888_2.png) [@Vlak](https://discourse.nodered.org/u/Vlak)\
**Post date:** [17 June 2020 09:30 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/18 "2020-06-17T09:30:22Z")

</div>

Thanks didiergithub, for your respons,  
can you explain how to fill in the node. I want it to switch on time only when I am home then it should not switch.

 ![node](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/2/3243af641e30b244201d7b3fdf27197df55d4a87.jpeg)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 August 2020 09:30 UTC](https://discourse.nodered.org/t/switch-to-presence/28109/19 "2020-08-16T09:30:29Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
