A complex flow (set of flows) is failing and I want to debug it. How can I do that?
This is the setup:
When vibration alarm starts: set variable mailbox.open to Yes (after 10 seconds)
When vibration alarm stops: set variable mailbox.open to No (immediately)
When motion sensor alarm starts: set hall.movement to Yes (immediately)
When motion sensor alarm stops: set hall.movement to No (after 1 minute)
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?)
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
The “Vibration/Tilt/Drop Alarm Cancellation” times are all set to 30 seconds, so that should be OK?
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)
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).
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:
When vibration alarm starts THEN start flow2 after 10 seconds
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
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)
When vibration alarm starts THEN start flow2 after 10 seconds
When this flow is started AND motion alarm is off THEN notify me of new mail
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
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.
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…
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).
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.