Piston in a stuck state


#1

1) Give a description of the problem
Switch is not turning on and is acting like the piston is stuck in a state. It stops running after it turns the space heater switch off and does not start again until it is force ran from the ST app the next night (when I notice it).

2) What is the expected behavior?
Turns the switch on/off when the location is not away and the temperature is within the limits.

3) What is happening/not happening?
Switch is not turning on and is acting like the piston is stuck in a state. If I force the piston to

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

I don’t have logs at the moment as I’m not home and the piston only runs with the specified parameters. I will post them later if needed. We also turn the space heater off as it’s a fire hazard if we are not home so I can’t turn remotely get the logs. I am using a Smartthings Motion Sensor for the temperature sensor, a Zooz ZEN15 (which supports the wattage of the space heater fully), and a GE fan control switch for turning the fan off/on. I am mainly wondering if there is something with the piston code that is noticeably wrong. I was thinking of recreating the piston as it seems to work if I force run it from the Smartthings app. This is something I’ve setup so that my wife can focus on sleeping instead of regulating the temperature of the room during the night for our 8 month old daughter. It works well when it isn’t “stuck”. I hate having this be my first post but I am desperate.

Thank you for taking a look and the help.


#2

There’s a lot going on here, but let’s start with the basics. The primary issue is your structure and the improper use and placement of conditions and triggers. There’s an entire topic on the subject here that you should review. But to oversimplify the subject, a trigger is something that causes your piston to execute, while a condition is something the piston will evaluate only when the piston is executed.

if you look at the left column of your snapshot, you’ll see what look like little lightning bolts. Only those events with lightning bolts will cause your piston to execute. Not only do many of your statements not have triggers, but where you do have triggers they are buried under conditions rather than preceding them.

So to begin, I would rewrite your very first ‘if’ statement as follows.

Note that I’ve done three things. (1) Revised your initial statement to be a trigger rather than a condition, (2) eliminated the nested if insofar as it contains (as revised here) a separate trigger, and (3) eliminated the ‘switch is on’ condition as It’s not needed (because if the switch is already on, webCoRE won’t turn it on again).

Further down, you have other issues. For example, you have ‘if’ statements with no triggers, but triggers within the then/else portion. You also have multiple triggers linked with an ‘and’ in a single group; and since it’s effectively impossible for all three triggers to be true at the same time, the piston will never execute that portion of the code. Both these issues can be seen here:

6635b984a29b3ca8ea9a9069a8d048d63cfb17c6

Think of writing the code more along these lines:

If
Light is turned on <-- Something Happens (a trigger)
and
Mode is Home <-- Something is True (a condition)
and
Door has been closed for five minutes <-- Something else is true (a condition)
Then
Do Stuff
Endif

I don’t have enough time today to help you with a full rewrite, but perhaps this will be enough to get you started and then myself and/or others can help you finish up.


#3

Thank you for the help. I’ve modified a lot of the piston. I reread the article again and it makes sense after you explained it. The funny thing is that I read that article before hand but I must have been sleep deprived or something as it didn’t make sense. Now it all does and I feel like an idiot for not getting it sooner. Thanks again and I’m sure it will work tonight.


#4

Thank you for the help and the guidance. This really jump started my use of webCoRE. Even though I don’t condone using a heater while not actively watching it, this may help someone else or help in other routines. We’ve since moved our daughter into the crib in her bedroom and I’m automating the furnace instead of this as I’m not conformable with a fire hazard in her room. The space heater was right next to me in our bedroom.

Switch 3 is a virtual switch device used for manual override of this piston (bypass switch).
Dimmer 1 is a GE fan control switch for a ceiling fan.
Outlet 4 is the Zooz ZEN15 I have controlling the space heater.
Keypad 1 and 2 are both SmartThings Buttons I have in the room that are used for other automation routines.

While you could use one temp sensor, I found it was better to use two and average the two as it gave better results. The way I already had the buttons positioned in the room gave temperatures of both sides of the bedroom.