SmartThings Community

[DEPRECATED Thread: visit community.webcore.co for assistance] webCoRE - Piston Design Help (ask your fellow members for assistance)

matching brackets? if you post the piston, i can check it.

Here you go. Thanks!

checking …

actually on second thought may be everything is all right and you are not seeing anything in edit mode because you are using $currentEventValue which only works at run time?

so, have you tried running it and looking at the result? :slight_smile:

I wondered that but in run mode I get the Java error in the log I posted and the piston does not update (Piston state shows the last time it worked successfully with the value statement rather than the expression.

oops. yeah see that. let me run it myself.

Could someone explain TCP more clearly to me? I’ve read and re-read the wiki multiple times and it just doesn’t appear to work the way I understand it to. In my example, below, if both sensors change at the same time, only one of them does the “something”. The other starts to evaluate, gets a semaphore timeout, and doesn’t do the “something”. I’ve tried ASYNC as well with the same results.

IF
Sensor 1 changes
THEN (TCP = NEVER CANCEL)
Do something

IF
Sensor 2 changes
THEN (TCP = NEVER CANCEL)
Do Something

@Nezmo just cast the $currentEventValue before comparing. i used int( ) because it was shorter than typing decimal( ) :slight_smile:

Thank you!

I must admit, I get confused when to use integer. Within a value statement it wasn’t needed.

@sockmonkey its complicated. which basically means - i dont understand it either. :slight_smile: but, i will try the best i can.

if you look at the help text for TCP the following line is probably the most important. in a normal execution with no wait task there is no need to cancel any tasks. when there is a wait task the TCP value controls wether the wait task and any tasks following the wait task will be cancelled or not cancelled.

When a task execution is delayed by any means (i.e. a Wait task)

does that help?

you are welcome. you are not alone :slight_smile:

1 Like

@bangali if that is the case, then I’m probably barking up the wrong tree with TCP. I want both IF statements to evaluate without one cancelling the other. Is that possible?

I was assuming that “delayed by any means” would include a semaphore which is why I was trying the TCP route.

How do you put the expression in right after the DO? Mine keeps saying with location. I don’t understand how to enter it the way you have it.

Just click add a task.


Then you can select a location task.

@sockmonkey sure evaluating both if conditions should happen normally. if you will post a snapshot of the piston, be easier to comment on it.

Never mind I got it. I have run into this confusion before. When in edit mode it says with location, but once you save it the with location goes away. I don’t know why I can’t seem to remember that. Getting old I guess.

1 Like

@bangali It’s actually this darn “welcome home” piston. I’m still using it as an opportunity to learn how / why things work as they do. I’ve posted snapshots a few times in the past week and haven’t gotten any response, so I thought I’d try to tackle each piece on my home.

Here’s a snippet, though. If both sensors change to present at the same time, only one variable gets set. What I want to understand is why, and how / if there’s a way to make them both function.

@sockmonkey got it. let me help. i had solved this one for someone else before.

think of your piston as an event processing engine. so, its processing ONE event at a time. there will be one event for presence sensor 3 followed by an event for presence sensor 4 or vice versa. since it processes ONE event at a time, nothing is truly simultaneous from the piston’s point of view.

does that make sense?

EDIT: here is the solve:

This piston ran but I didn’t get the notification. Should the comparison not be in the “”?

@bangali :grinning: It was that very code that I was trying to find a more elegant solution to. But, if there simply isn’t another way, so be it. At least I learned something! :relaxed: