# How to debug flow(s)?

**URL:** https://community.homey.app/t/how-to-debug-flow-s/41883
**Category:** Questions & Help
**Created:** [January 27, 2021, 4:55pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883 "2021-01-27T16:55:31Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![prosumer](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/prosumer/32/166478_2.png) [@prosumer](https://community.homey.app/u/prosumer)
#### Post date: [January 27, 2021, 4:55pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/1 "2021-01-27T16:55:31Z")

</div>

A complex flow (set of flows) is failing and I want to debug it. How can I do that?

This is the setup:

1. When vibration alarm starts: set variable `mailbox.open` to _Yes_ (after 10 seconds)
2. When vibration alarm stops: set variable `mailbox.open` to _No_ (immediately)
3. When motion sensor alarm starts: set `hall.movement` to _Yes_ (immediately)
4. When motion sensor alarm stops: set `hall.movement` to _No_ (after 1 minute)
5. When `mailbox.open` changes and `hall.movement` is _No_ and `mailbox.open` is _Yes_ then notify me of new mail

In the history logging of the vibration sensor I can see that there’s an alarm whenever mail is delivered (or when I open/close the door that the mailbox is part of). However, sometimes I won’t get the mail notification (while I have not been in the hall for hours; `hall.movement` should be _No_), so I want to debug this setup.

It would be great if I could see the history of variables (at what time they change to which value), but that’s not possible, or is it? (How?)

Any tips on how to debug/improve my flow(s)?

---

<div class="post-metadata">

### Author: ![Adrian\_Rockall](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/adrian_rockall/32/13209_2.png) [@Adrian\_Rockall](https://community.homey.app/u/Adrian_Rockall)
#### Post date: [January 27, 2021, 5:06pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/2 "2021-01-27T17:06:41Z")

</div>

Have you seen the `Timeline - Create a notification with` flow action?  
With that you can write the variables, etc, to the timeline.

There are also some apps that can help:

> **[Simple (Sys) Log](https://homey.app/en-gb/app/nl.nielsdeklerk.log/Simple-(Sys)-Log/)**
>
> Use this app for Simple (Sys) Logging.

---

<div class="post-metadata">

### Author: ![peltsi51](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peltsi51/32/12564_2.png) [@peltsi51](https://community.homey.app/u/peltsi51)
#### Post date: [January 27, 2021, 5:34pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/4 "2021-01-27T17:34:50Z")

</div>

One option is to use numeric variables as boolean variables. 1=yes 0=no. That way you can trace the operation in insight into some extent

---

<div class="post-metadata">

### Author: ![FKey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fkey/32/14793_2.png) [@FKey](https://community.homey.app/u/FKey)
#### Post date: [January 27, 2021, 7:20pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/5 "2021-01-27T19:20:18Z")

</div>

Not a tip to log (Thinks the ones above are great, I also use papertrails).

But this flow can go wrong in several ways:  
Case1:  
Are you sure your vibration alarm does not stop earlier then 10 sec?

0sec: vibration alarm starts  
5sec: vibration alarm stops  
5sec: mailbox.open is set to No (but it was still No, so no change)  
10sec: mailbox.open is set to yes  
Line 5 will sent the mail…  
But remember your mailbox.open will not be set to no. That trigger has passed

So what happens at the next mail…  
0sec: vibration alarm starts  
10sec: mailbox.open is set to yes (but it was still yes, so nochange)  
15sec: vibration alarm stops  
15sec: mailbox.open is set to No  
Line 5 will never run… for this mail

The next time your mail will be sent, but the next… might not

Case2:  
Are you sure the vibration alarm does not change to stop after exactly 10 sec?

What could happen  
0sec: vibration alarm starts  
10sec: mailbox.open is set to yes  
10sec: vibration alarm stops  
10sec: mailbox.open is set to No  
Line 5 will not sent the mail…

Chances are small but it can happen…

_Why the 10sec? It messes up your timings…_  
Loose it

---

<div class="post-metadata">

### Author: ![prosumer](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/prosumer/32/166478_2.png) [@prosumer](https://community.homey.app/u/prosumer)
#### Post date: [January 27, 2021, 8:54pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/6 "2021-01-27T20:54:55Z")

</div>

> [@FKey](#):
>
> Are you sure your vibration alarm does not stop earlier then 10 sec?

The “Vibration/Tilt/Drop Alarm Cancellation” times are all set to 30 seconds, so that should be OK?

> [@FKey](#):
>
> _Why the 10sec? It messes up your timings…_

That is my attempt to catch this use case: when I enter my house through that front door I will first trigger the vibration sensor on the mailbox and only then the motion sensor will detect motion (of either the front door or me stepping in). I hope 10 seconds is enough to catch this use case and stay under the 30 seconds cancellation time.

Suggestions how to better implement this are more then welcome!

The complexity is because I want to achieve this:

- notification when mail is delivered
- no notification when I open the door to leave the house
- no notification when I open the door to enter the house

These sensors are used:

- Aqara vibration sensor (might trigger alarm in all 3 use cases)
- Hue indoor motion sensor (triggers alarm when opening/closing the door)

---

<div class="post-metadata">

### Author: ![prosumer](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/prosumer/32/166478_2.png) [@prosumer](https://community.homey.app/u/prosumer)
#### Post date: [January 27, 2021, 9:05pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/7 "2021-01-27T21:05:31Z")

</div>

Have to admit I did not think of using the timeline (I only log when there is mail), but I’m afraid logging all flows might clutter up the timeline.

I will start experimenting with _Simple LOG_ and might move to _PaperTrails Log_ if I need more advanced stuff (or just to learn more about SysLog servers, which might be interesting anyway).

---

<div class="post-metadata">

### Author: ![FKey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fkey/32/14793_2.png) [@FKey](https://community.homey.app/u/FKey)
#### Post date: [January 27, 2021, 10:09pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/8 "2021-01-27T22:09:00Z")

</div>

> [@prosumer](#):
>
> Suggestions how to better implement this are more then welcome

Split up flow #5  
5. When `mailbox.open` changes Then start flow number 6 after 10 seconds  
6. When this flow is started and `hall.movement` is _No_ and `mailbox.open` is _Yes_ then notify me of new mail

Correction:  
Much better to split flow 1 up. You dont want mailbox.open to give a false warning:

1. When vibration alarm starts THEN start flow2 after 10 seconds
2. When this flow is started AND `hall.movement` is _No_ THEN set variable `mailbox.open` to _Yes_ (after 10 seconds)  
And flow5 does not need the AND anymore
3. 
  1. When `mailbox.open` changes and `mailbox.open` is _Yes_ then notify me of new mail

Update: you could even remove the variables (if you motion alarm stays active for 30sec too)

1. When vibration alarm starts THEN start flow2 after 10 seconds
2. When this flow is started AND motion alarm is off THEN notify me of new mail

---

<div class="post-metadata">

### Author: ![FKey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fkey/32/14793_2.png) [@FKey](https://community.homey.app/u/FKey)
#### Post date: [January 27, 2021, 10:32pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/9 "2021-01-27T22:32:56Z")

</div>

> [@prosumer](#):
>
> It would be great if I could see the history of variables (at what time they change to which value), but that’s not possible, or is it? (How?)

If you created the variable in homey logic. They are traced in the [homey insights](https://insights.homey.app/)

---

<div class="post-metadata">

### Author: ![Edwin\_D](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/edwin_d/32/136417_2.png) [@Edwin\_D](https://community.homey.app/u/Edwin_D)
#### Post date: [January 27, 2021, 10:44pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/10 "2021-01-27T22:44:39Z")

</div>

Standard Logic variables are traced just the same through insights. But just numerical ones, both for Better Logic and default logic. So 0/1 will be visible, false/true will not. Fun fact, the old insights will smooth graph curves and/or take averages, If I look at the graphs, it seems at times I have 1.3 doors open 😂

---

<div class="post-metadata">

### Author: ![FKey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fkey/32/14793_2.png) [@FKey](https://community.homey.app/u/FKey)
#### Post date: [January 28, 2021, 6:48am UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/11 "2021-01-28T06:48:46Z")

</div>

> [@Edwin\_D](#):
>
> Fun fact, _the old insights_ will smooth graph curves and/or take averages,

What do you mean by old?  
Does it mean insights in the [new homey web](https://my.homey.app/) view shows different data then [the old insights app](https://insights.homey.app/).

Did not notice that yet

---

<div class="post-metadata">

### Author: ![Edwin\_D](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/edwin_d/32/136417_2.png) [@Edwin\_D](https://community.homey.app/u/Edwin_D)
#### Post date: [January 28, 2021, 7:40am UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/12 "2021-01-28T07:40:23Z")

</div>

The data is the same, but the graph library seems different, and you can combine graphs.

---

<div class="post-metadata">

### Author: ![prosumer](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/prosumer/32/166478_2.png) [@prosumer](https://community.homey.app/u/prosumer)
#### Post date: [January 28, 2021, 9:35am UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/13 "2021-01-28T09:35:01Z")

</div>

> [@FKey](#):
>
> if you motion alarm stays active for 30sec too

Unfortunately that one seems to have a random cancellation time; sometimes only 10 seconds.

(Hence the variable that I only “reset” after a minute)

I’m afraid I’m not sure I understand your improvement suggestions (yet?); not sure what the entire set should look like.

> [@FKey](#):
>
> If you created the variable in homey logic. They are traced in the [homey insights](https://insights.homey.app/)

This is the first time I use variables. And only booleans so far. Apparently Boolean variables are not shown in Insights, so I jumped to the wrong conclusion that variables are not shown there at all…

---

<div class="post-metadata">

### Author: ![FKey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fkey/32/14793_2.png) [@FKey](https://community.homey.app/u/FKey)
#### Post date: [January 28, 2021, 1:41pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/14 "2021-01-28T13:41:22Z")

</div>

> [@prosumer](#):
>
> I’m afraid I’m not sure I understand your improvement suggestions (yet?);

Do you know the card to start a flow?  
In When section: ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/e/1eb8084baa27bee4c7ba31a984730616eb491e32.png)  
.  
In Then section: ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/1/81e1736480c8e0d4a6298ad150548a5a51ba8247.png)

---

<div class="post-metadata">

### Author: ![prosumer](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/prosumer/32/166478_2.png) [@prosumer](https://community.homey.app/u/prosumer)
#### Post date: [January 28, 2021, 2:47pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/15 "2021-01-28T14:47:10Z")

</div>

Yes I know that card.

I’m a bit confused because you gave several suggestions (thanks for that!) and I don’t know which of my flows need to be combined with your suggestions (if any).

---

<div class="post-metadata">

### Author: ![FKey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fkey/32/14793_2.png) [@FKey](https://community.homey.app/u/FKey)
#### Post date: [January 28, 2021, 6:08pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/16 "2021-01-28T18:08:57Z")

</div>

Since its unclear after how much time motionsensor cancels keep these flows

1. When vibration alarm starts THEN after 10 sec start flow 5  
X . When vibration alarm stops. You can remove this flow
2. When motion sensor alarm starts: set `hall.movement` to _Yes_ (immediately)
3. When motion sensor alarm stops: set `hall.movement` to _No_ (after 1 minute)
4. When This flow is started and `hall.movement` is _No_ THEN notify me of new mail

Add papertrails cards to every THEN section to be able to trace

---

<div class="post-metadata">

### Author: ![prosumer](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/prosumer/32/166478_2.png) [@prosumer](https://community.homey.app/u/prosumer)
#### Post date: [January 28, 2021, 7:24pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/17 "2021-01-28T19:24:04Z")

</div>

Thanks!

I already added “Simple Log” cards to every THEN section in my original flows to (first) figure out what I’m doing wrong. Once done I can try your simpler (so less error prone?) flow setup.

(to be continued?)

---

<div class="post-metadata">

### Author: ![Eric\_B](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/eric_b/32/10238_2.png) [@Eric\_B](https://community.homey.app/u/Eric_B)
#### Post date: [January 29, 2021, 4:50pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/18 "2021-01-29T16:50:23Z")

</div>

Maybe use a door/window sensor on your mailbox in stead of a vibration sensor?  
That sensor will not be triggered bij opening the door…

---

<div class="post-metadata">

### Author: ![prosumer](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/prosumer/32/166478_2.png) [@prosumer](https://community.homey.app/u/prosumer)
#### Post date: [January 29, 2021, 8:05pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/19 "2021-01-29T20:05:29Z")

</div>

> [@Eric\_B](#):
>
> Maybe use a door/window sensor on your mailbox in stead of a vibration sensor?

[I know](https://community.homey.app/t/aqara-xiaomi-smart-home-zigbee-app-v0-8-0-test-v1-2-3/156/2743)…

But I have the current sensors already available, so want to see whether they are sufficient to make it work (and have some fun tinkering/learning).

---

<div class="post-metadata">

### Author: ![Eric\_B](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/eric_b/32/10238_2.png) [@Eric\_B](https://community.homey.app/u/Eric_B)
#### Post date: [January 30, 2021, 1:57pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/20 "2021-01-30T13:57:03Z")

</div>

I know the feeling…but after trying almost everything I sometimes go for the easy solution…  
And buy a sensor for a few euro’s 😉

---

<div class="post-metadata">

### Author: ![prosumer](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/prosumer/32/166478_2.png) [@prosumer](https://community.homey.app/u/prosumer)
#### Post date: [February 2, 2021, 8:18pm UTC](https://community.homey.app/t/how-to-debug-flow-s/41883/21 "2021-02-02T20:18:28Z")

</div>

Decided to try PaperTrails since I want to learn more about syslog anyway.

How can I set the custom app name?

I thought the `$` was for that, so I tried: `$mailbox Mail!` as message and expected:

```auto
Feb 2 21:03:53 homey mailbox Mail!

```

Instead I got:

```auto
Feb 2 21:03:53 homey Mail!

```

(I’m using rsyslog with RFC5424 instead of the default RFC3164; is that correct?)

[Next page](https://community.homey.app/t/how-to-debug-flow-s/41883.md?page=2)
