Multiple Trigger comparisons ANDed together warning


#1

1) Give a description of the problem
I have a psiton that controls the turning off and turning on lights based on the presence of either mine or my wife’s iPhone presence. I’m using Life360 to get this information. But in my code I noticed on the comparison of both iPhones that I am receiving a warning. Am I doing this right with multiple triggers?

2) What is the expected behaviour?
If both me and my wife leave our house together I want the piston to turn off any lights that are left on.

3) What is happening/not happening?
Getting a warning on the compare of both iPhones.

**4) Post a Green Snapshot of the piston!

5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

I think you want an OR there.

Multiple events do not happen at the same time. So both of those devices changing at the same time is impossible

ie one will change, then the next will change.

See:


#3

I have to disagree with you that multiple events happening at the same time. Both of our iPhones are tied to Life360. If we both jump in one of our cars and go out to dinner then both iPhone presences will change to not present after we exit the GeoCircle of Life360.

That is why I’m attempting to compare both iPhone presence state. If both of us leave then turn the lights off. And on the flip side if both of us arrive back home after dark turn some of our lights on.


#4

In webcore the simultaneous presence change will not happen as everything is timestamped, one of the presence will always depart/arrive first.


#5

I have a similar requirement to this and handle it using bool variables for each person.
e.g
if phone1 leaves
then
set away1=true
if away2 = true
then
do stuff
end-if
end-if
if phone2 leaves
then
set away2=true
if away1 = true
then
do stuff
end-if
end-if


#6

That isn’t what the changes condition means.

Wayne's presence changes to not present only evaluates to true if the following are all true:

  • The event that fired the piston was from the device
    Wayne and the attribute presence.
  • The attribute value in the event must be not present.
  • When the condition was last evaluated the attribute must have been present so there was a change.

So as you can see, only one of your changes conditions can be true at once.

The last point above explains the warning. The changes condition needs to be evaluated every time the event it tests occurs in order to know if there has been a change. If the first condition in an AND group is false the second one is not usually evaluated.

If this is just a short piston with no other triggers you may be able to use presence is not present instead of changes.


#7

I’d avoid doing that. It will just end up confusing you. But to make things easier, you can just select the two devices in the one trigger line and it will automatically make them ORs for you. Then you can have a condition to check if only one or both are away in one line too.

This is an example using 3 switches. I only want the action to happen if all 3 switches are off. So, first I trigger if any of them change to off:

Then I add a condition that all 3 switches are off:

which ends up looking like this:
image

As you can see, the piston has one trigger for any of the three devices and only one condition to check if they are all off.