Drops Below not working as expected


#1

I’m scratching my head on this one. I’m challenged with “drops below”. I have a plug (attached to a humidifier) that I want to get a push message if the wattage drops below a threshold which indicates that the huidifier is off or the reservoir is empty. Challenge is that it never triggers when the wattage drops below the threshold and the log clearly indicates that the wattage is below the threshold.

Maybe I’m missing something. I’ve waited for the wattage to be over threshold for 10 minutes but when I turn the humidifier off and the plug is reading less than 10W the top IF returns false.

BTW the WAIT is so i don’t get several messages when i turn it off to fill the reservoir :grinning:.

Any help would be most appreciated.

Humidifier log


#2

Waits combined with triggers can get tricky. The way your piston is written, this is what happens:

Your consumption drops below 10W and your switch is on, so your condition evaluates true.

Your piston has a wait for 10 seconds, so it sets a wake-up time for itself 10 seconds in the future.

After 10 seconds pass, your piston wakes up and executes from the top. Since your consumption has been below 10W for some time, the “drops below” no longer evaluates true and your piston skips completing the remaining “then” actions.

Change “drops below” to “is” or “stays below for 10 seconds” (and delete the wait) and it should work as desired.


Repeat Loop Counter Not Incrementing
#3

You will probably also need to change the task execution policy to ‘on condition change only’ to prevent the 10 second wait constantly getting reset by fluctuations in W.

Otherwise every time the W changes even by a tiny bit, the piston will reset from the top.

This will also prevent repeated messages being sent 10 seconds after every change in W below 10W

IF
outlet is on
AND
W IS below 10
THEN
with Location (TEP Condition Change Only)
wait 10 seconds
Send Notification


#4

Thank You! The WAIT was a hold over from when I had it at W > 10 which gave be 3 notifications each time the plug powered down. I deleted the WAIT and it works perfectly!


#5

I’m still getting use to this so please excuse what might be an obvious question:

Why would the piston execute from the top after a “wait”? In my way of thinking, once the conditions/triggers are set to true, then the next set of steps would just happen regardless of any changes in the conditions.

So, if Outlet 1 is on and Outlet 1 drops below 10W, then a push notification, a notification would be sent period. Why does this change if a wait is included?


#6

By start from the top I think he meant re-checks the conditions are still true after the 10 second wait… it wouldn’t wait another 10 seconds.

As you have used a trigger that only stays true for a brief moment, the re-check would cancel the piston actions.


#7

Not a silly question at all, and one I think most new users to webCoRE stumble on. I know I did… and the gotcha comes right in here:

You see that (default) is listed next to “Cancel tasks on condition state change”. That means the default behavior of webCoRE is to look for changes in condition and react accordingly when it fires. That usually is the way most of us envision our pistons running, with the exception of when we put in a WAIT command. Most of us think it’s going to wait at that line of code and resume execution from there… but that’s not its default behavior.

It takes some getting used to, but once you understand what’s happening and why, you can work with it to accomplish what you want your pistons to do.


#8

Thank you! That makes a LOT of sense now.