Subscription process/device reporting vs webCoRE pistons


#1

1) Give a description of the problem
I am new to webCoRE and writing pistons and am more just trying to learn what is going on rather than having a specific problem that needs fixing with this. When I write an if condition like “Office M-sensor’s temperature changed in the last 2 hours” the logic in the then gets fired but if I reduce the time to 10 minutes the logic never gets fired. I can see the sensor device report back different temperatures every 59 minutes in ST web app (list events), so I am assuming for this condition there is nothing to compare against in the 10 minute range so my condition always evaluates to false. Correct?

I understand the difference now between conditions and triggers but I also understand if I don’t include a trigger, webCoRE will still subscribe to the sensor temperature feed due to the condition. I see the lightning bolt beside this line of script, so I assume it is subscribed. I assume when the device sends a temperature update to the hub, this causes my piston logic to fire, correct?

I am more asking about the subscription process and when/how the piston logic gets fired by SmartThings I guess.

Is the condition being evaluated in the piston or is the condition part of the subscription and gets evaluated before the piston is fired in the base SmartThings logic? ie. what’s really going on under the covers?

2) What is the expected behavior?
When the temperature changes I want to get an email.

3) What is happening/not happening?
I get an email when the condition is “changed in the last 2 hours” I do not get any emails when the condition is “changed in the last 10 minutes”.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
I can paste the logs if anyone wants but from the logs I see the subscription happen when I Save the script in webCoRE. By pressing Test or just waiting a few hours, I can see the piston fire and at 2 hours the condition evaluates to true and I see it send email but at 10 minutes the condition is always false and it never sends the email.


#2

I am not sure why this is the case. But if you are saying you only see the temp change every 59 minutes then that might be why it’s not triggering on the last 10 minutes. You should reserve using that condition as an additional step instead of the only step.

Lightning bolts = subscription

Any time there is an event from the subscribed devices then your piston get evaluated. That is then when it determines if your conditions were true/false.

Events come into SmartThings. If that device is subscribed in webcore then it acts on that event.

Use the trigger changes Instead of changed. But with this logic you will inevitably get a lot of emails. So maybe add some logic that it changes by more than a couple degrees.