Piston not firing - review please


#24

Well, for what it’s worth, I try to make sure only one of my pistons executes when a presence sensor changes. This is because each piston with a lightning bolt next to a presence sensor, will execute from top to bottom when leaving OR arriving. Having more than one piston executing at each event means a higher chance of commands getting lost in all the commotion.

Personally, I would prefer only one piston executing at such events.


This can work, but the wording has to be specific.
(since both sensors will never exit/return at the same instant)

Personally, I would try to combine all your logic that you want to happen when someone arrives or leaves into one giant piston. With only one trigger, but as many conditions beneath as you like.


For those who want to tackle this by themselves, I normally recommend clients stall a few months before coding for presence sensors, since they can be some of the trickiest coding.

In my opinion, it really helps to have a solid grasp on webCoRE’s logic before diving in to a Presence piston.


#25

How about this, this will make your piston a bit longer but might help…
Here are possible scenearios:
a) One of you leaves everything will be same, no ACTION in the house.
b) Both of you together or seperately out. Lock the doors etc.

IF sensor 1 changes to AWAY (lets say you just left)
WAIT 5 minutes.
Check the other sensor (to see if home or not, if not)
Do this do that…

The wait is just to make sure ST HUB had enough time to register the sensors…

You can create another IF block just for the second sensor…

something like this:


#26

100% agree.
Presense sensors are very tricky.


#27

I can see that! Ok, thanks both of you. But I’m stubborn, and I want to learn, and I know the only way I’m going to learn is if I forge through it. Let me look at that example, and think this over, and come up with… Oh, something exciting! Forget cowbell, I need more bells and whistles!


#28

I’m still looking at this - what if I split this into two separate pistons? One for me "presence is ‘present’. And then a different piston for him? If we’re both away and both come home at the same time and one piston fires a few second/minute after the other - that won’t harm anything.

OR - Could I fit both of these on the same piston? "IF “present” then “lights”. Second “IF”: If “present2” then “lights”?

Would “Changes to” work in either of these scenarios, or stick to “present”?


#29

Huh. Ok. So what would be the actual trigger in my case?

I want action if BOTH of us leave.

I want NO action if ONE of us leaves and the other stays home.

I want action if ONE of us leaves and the other is NOT home.

I want action if either one of us or BOTH of us comes home.

I THINK I see how to create much of this - I’m not sure what the initial trigger should be.


#30

I am about to head out the door to work, but here is what I am thinking:

IF Sensor 1 or 2's presence change to present   <-- Trigger
Then 
    IF Sensor 1 or 2's presence is not present  <-- Condition
    Then 
        Do "Welcome Home" stuff  (Keep duration short, might be two back to back)
    ELSE
        Do "Everyone Home" stuff
END IF

IF All of Sensor 1 & 2's presence are not present  (Force subscription)
    Then do "Goodbye stuff"
END IF

Notice how each IF block is subscribed to the exact same devices & attributes.
(so really this piston has two triggers. Sensor 1 & 2’s presence)

Also, please be careful with the ELSE. If the wording is even slightly different, it will not work as expected.


#31

Thanks again! I’m going to try all this out. I need to run logs more. I noticed today that when we left, the house secured and stayed secured. When we came home, the house desecured (is that a word?), but then after we had been home 5 or 10 minutes… the “desecuring” happened again. Sigh. LOL I’m bound and determined to get this working!


#32

I admire your determination, I just wish you were learning with pistons that did not involve security or presence sensors…


#33

I understand. But I AM following up with looking at my dashboard every time, and getting alerts from a separate, non-Webcore/Smartthings source.


#34

HEE! Ok, so I’m looking at what you replied with in that other thread - I like!

He’s got a Pixel 3, I’ve got an iPhone Xs. Both of us connect through bluetooth to both our vehicles (a Jeep and a Ram). How would this work, please?


#35

My little trick uses Tasker, which works on Android devices. Tasker keeps track of events on the Android side, and then sends a command to execute a piston when the time is right. WebCoRE takes over from there.

(Tasker is to Android, what webCoRE is to SmartHomes… Mind-blowingly Powerful!)


#36

COOL! Is there an iPhone equivalent? I hope? :slight_smile:


#37

Not that I have found. Tasker utilizes Android’s open philosophy.
(and is actually one of the reasons I will never buy an iPhone)


#38

Ah ok gotcha. And honestly, my iPhone “presence” seems to work just fine and right away, while his Pixel 3 sometimes doesn’t register for up to 5 or 10 minutes.


#39

Well, before investing time in extra coding, Android has some advance options for GPS (Location) that might be tweaked to give him better results… (quicker results means a bit more battery drain)

If that doesn’t help, since his phone is the flaky one, you could put Tasker on his phone, and let either:

a) Disconnect from car’s bluetooth - or
b) Is Near the Home WiFi - or
c) Connects to Home WiFi

become the trigger in Tasker, and send a command to webCoRE for snappy execution.
(If his GPS is slow, then I would probably use method (b))


#40

So here’s what I’m going to do - I’m going to make TWO pistons. One will be for me “is present” “this happens”.

I’m still getting this piston firing when I drive away. I think this will solve it. And if we BOTH leave together, my “leaves” piston will fire and that’s it. And if we BOTH return - ONE of our pistons will fire, and then the OTHER piston will fire. Not a big deal, and if it’s annoying (not firing until after we’re home) I can always do a check on a door being locked, or light being on, or something.

The other will be for HIM “is present” “this happens”.

This will tell me for sure who’s phone is the delay. I’m fairly certain it’s his.

Should/Can I, instead of “is present” use “changes to present” in this case, since there’s only one device?


#41

I usually prefer “Changes to present” for a single device. This trigger remains ‘false’ 99.9% of the time, and only fires at the moment your GPS registers


#42

Ok, I’m doing it! :slight_smile: I’ve got logs on. LOL I don’t think I’m going anywhere until Monday, but my SO is going out Sunday, so we’ll see then.


#43

Yep, that was the fix - I created TWO separate pistons with “changes to present” and they’re working properly.