Can I write to "Matching Devices" in more than one instance?


#1

1) Give a description of the problem

I’m trying to rewrite my Life360 Departure Piston to register when two or more people leave together. This requires me to save matching devices to the same variable more than once. Is this allowed, or does the variable reset between writes?

2) What is the expected behaviour?

The device of the first person detected is written to “DevWhoLeft”, and the remaining devices are saved “DevWhoLeftWithMe” to detect within 10 seconds of the first person. If any of those devices’ presence change within that time period, they should be added to the first name, i.e. “Bob” changes to “Bob and Marie”

3) What is happening/not happening?

I just wrote this today and no one has left yet. I probably won’t be able to convince two people to leave home today on a lazy Sunday, so I’m hoping someone could look over the code and let me know if it seems workable.

**4) Post a Green Snapshot of the piston![image|45x37]


#2

That’s a good question that I don’t remember the answer to and the only way to find out is to try it out lol. If you don’t mind creating simulated presence sensors, that would be a good way to test out pistons. I have simulated devices created for all the devices I want to test so I don’t have to wait for the actual events to happen.


#3

Fantastic Idea! I’ll try that out. :smiley:


#4

Nope. The variable starts anew each time. Guess I’ll have to resort to some clever programming instead. Bummer.


#5

Did you try appending the other devices that left to your matching device variable?

OtherDeviceName + MatchingDeviceVariable


#6

There’s actually a couple of things I have to figure out. I know what you’re saying, and I’ve used that in several pistons. That’s the easy part (I was just hoping to bypass that aspect).

In addition to this, I have to figure out a way to prevent double-notifications. The piston fires whenever someone comes into the circle, but when I do “If A turns to present, look to see if B is present and notify them together”…but then I have to cancel the subsequent notification when B breaks the circle next. I’ve already PAUSED my first attempts, but new ideas are still jumping into my head, so we’ll see. I’ve been corresponding with BPTWorld and he’s given me some guidance as well.