Expression mode not the same as actual Mode


#1

1) Give a description of the problem
First I want to say how glad I am to have found webCoRE (and a lot of the users I’ve already learned so much from).
The expression I’m using to compare $locationMode to the ST Modes (defined in text) is coming up differently than what is shown on the webCoRE portal home screen

2) What is the expected behavior?
By running the expression, I am hoping to have it figure out which is the current mode and assign a variable that I’ve defined to things like light levels and timers further down the script.

3) What is happening/not happening?
Right now it’s executing ‘true’ for the first item in the string, which is not correct. When I run a new expression statement using just the $locationMode, it reads properly. Its causing the timeouts and intensity levels to be incorrect.

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

5) Attach any logs (From ST IDE and by turning logging level to Full)
(PASTE YOUR LOGS HERE BETWEEN THE MARKS THEN HIGHLIGHT ALL OF THE LOGS SND CLICK ON THE </> ICON TO FORMAT THEM)![


#2

Screenshot_2019-03-05%20webCoRE%20Community%20Forum

I have not had time to run through all of this yet but immediately I am curious about your first IF statement. It’s a condition, not a trigger. Should it be {sensors}'s motion changes to active ?

I will look at $locationMode later today unless someone beats me to it. :slight_smile:


#3

Also, in your expression, try == instead of just =


#4

Agree with @Pantheon your first if will never get executed since it is not a trigger. Agree with @eibyer the ‘==’ is the correct syntax for a condition vs an assignment.

I believe your light intensity expression should be after you define all the variables (although after the first run it might not matter since it will remember the prior values).


#5

I’ll give those a shot. As for the trigger versus the condition, I’ve had much more success using it this way, but have definitely tried it the other way as well.

For the most part, everything is working as intended. Just the expression for the timer and intensity are coming back incorrect.


#6

BOOM! The == solved the issue. Loving all this customization. Although the wife has been wondering why I’ve been walking back and forth through my family room every 5 minutes.

Thanks!


#7

@peakyfreak80 I would be interested in seeing the Green Snapshot of your piston when you get it working!


#8

Absolutely. If there is any cleaner way to do things, I’m always up for critique. This is my first ‘master’ piston which I’ll base other timed lights on. The wife hates when lights are left on in the house, so these will come in handy!


#9

This is why this community is so great. I did not know about the ==. So here I am trying to help someone and I learn something in the process. :slight_smile:


#10

What is the Do > Cancel all pending tasks doing that would not be done if the Task Cancelation Policy was set to one of the non-default values?

Thanks for posting your example and the opportunity to learn about ==


#11

I was having issues where it seemed like the piston wouldn’t reset itself if the events happened too closely after the previous one finished. i.e. I have a light in a small mudroom/pantry/bathroom area that I wanted sensored so it would go on when you were in there and turn off pretty soon after you left. But I was finding that if I went back into the area right after the light turned off, it wasn’t getting picked up. This was what I tried, and it seemed to work. TBH, I have no idea if its doing what I ‘think’ its doing, but the setup works really well now.


#12

I know that motion sensors have a “retrigger time” that seems to be variable between different products. My driveway motion sensor stays “active” for 20-30 seconds after motion has cleared and I had to adjust my pistons accordingly. I am not sure if that is the latency of the sensor or just the latency of the network to reset.