Piston not changing location mode based on presence sensors of two mobile phones


#1

1) Give a description of the problem
Custom piston used to set location mode.
So after the time for the piston to run is triggered. based on time of day and presence. Either the piston doesnt run on its own or the location mode does not change based on said conditions.

2) What is the expected behaviour?
-if both presence sensors are home and it’s after sunset (6:50PM). automatically set location to night home. This applies if one of the two presence sensors is home too. (So day home to night home);
-or if both presence sensors are away and it’s after sunset. automatically set location mode to night away. (So day away to night away, or day home to night away).

3) What is happening/not happening?
after sunset the piston does not change location mode to night home from day home (if both presence sensors are home – everyone is working from home due to COVID). So this causes my other piston (which turns on sets light level for outside lights based on civil twilight) not to function because location mode is neither night home or night away. So automatically the piston does not run.

One interesting note. If I manually click the ‘test’ button within the piston itself. The piston runs and the location mode is changed as expected.

I’d appreciate your help. Thanks.

**4) Post a Green Snapshot of the piston![image|45x37]
Piston snapshot as is with NO ‘test’ button pressed:

Piston snapshot after clicking ‘test’ button and trace enabled:

5) Attach logs after turning logging level to Full
Piston logs as is with NO ‘test’ button pressed:
6:44PM
644pm
7:33PM

Log for piston running after clicking the ‘test’ button:


#2

I have not looked at your logs, but at a quick glance, I think that lines 29-38 should drop the IF, and simply keep the WITH block there. This will turn line 27 into a trigger.

(although you also have to tweak your logic there, since every change does not mean welcome home!)


Alternatively, you can drop lines 25-27, by removing the ON EVENTS FROM
This will place lines 29-38 unindented to the far left.


TL;DR:

Line 27 & 30 are identical. You only want one.


#3

I will take a look at those lines you referenced.

So why does it appear to work correctly upon clicking the test button and doesnt trigger the right location mode on its own?


#4

The test button should never work with a true trigger.
(only conditions that are acting like a trigger)

A proper test is to actually do the thing with a lightning bolt next to it.


#5

By removing ‘ON EVENTS FROM’ deletes lines 24-47. And leaves lines 48-89 only. I’ll have to see if i can cut and paste lines 29-45.


#6

You can drag & drop the inner IF block, and then delete the empty “ON EVENTS FROM” block