Location mode changes trigger not triggering


#1

1) Give a description of the problem
I’m trying to use location mode changing as a trigger for pistons (multiple people in the house makes Home vs Away logic complex enough to abstract other pistons behind location mode), but my piston which triggers on location change is not executing. I’ve confirmed that my Arrival and Departure pistons which set the location mode to Home or Away executed.

2) What is the expected behavior?
A piston which sets location mode will trigger another piston which triggers on location mode changes.

3) What is happening/not happening?
The piston which triggers on location mode changes is not executing.

**4) Post a Green Snapshot of the piston
Departure piston (sets location mode to away):

Arrival piston (sets location mode to home):

Piston which triggers on location mode changes (not working):

5) Attach any logs
I don’t have full logs for everything but I do have the piston states and execution times for the pistons.

Departure piston:
Piston state: Everyone left at 11:25 A.M.
Last executed: 1/29/2019, 11:39:17 AM

Arrival piston:
Piston state: David arrived at 11:39 A.M.
Last executed: 1/29/2019, 11:39:17 AM

1/29/2019, 11:39:17 AM +789ms
+185ms	║David arrived at 11:39 A.M.
+333ms	║11:39 AM is not between 4:35 PM and 8:09 AM

Piston which triggers on location mode change:
Last executed: never


#2

It’s odd that both your departure and arrival pistons have the same last execution time. That may have caused a problem or confusion on mode changes. I would suggest you combine the departure/arrival pistons into one like this:

If any of presence sensor 1 or 2 change.    <-- trigger
then
   if all of presence sensor 1 and 2 are not present.    <-- condition
   then
     away
   endif
   if any of presence sensor 1 or 2 is present.       <-- condition
   then
     home
   endif
endif

this will avoid potential conflicts or errant running of one of the above pistons.


#3

Thanks for the suggestion! Seems reasonable and I’ve been wanting to refactor those pistons anyway to remove all the light switching in favor of one that triggers on the location mode change and let the arrival/departure be “pure”.

EDIT: Here’s what I came up with and will test next time I leave the house (not 100% confident the log statement will work):