If you are going to power a space heater I would add additional safeguards into your piston.
Maybe setup up some time constraints. A do every 10 minutes and check the temp. As WCmore mentioned webcore is event driven. So if your temp goes above the shutoff temp for whatever reason, loss of internet someone accidentally turned it on manually while above the threshold. I have also had switches turn on by themselves for no reason. It is a rare occurrence but it does happen. You can find a few threads about it.
The heater may not get turned off if you are only relying on a temp change. If it gets turned off and doesnāt come back on thatās an inconvenience, if it gets turned on and doesnāt get turned back off that can be a bigger problem.
I had a similar issue a few years back when I wrote my first smartapp. I had a app to heat our master bath every morning just before we got up. For the first couple of days I couldnāt figure out why it wouldnāt come in the mornings. The temp was below the threshold, but as you found out it needs to cross that threshold. So I added a time activation to check the temp at 5:00 am and then I could start the process.
This is how I found out about switches turning themselves on. One morning at about 3:00AM the receptacle that powered the heater came on for no reason. This was after I had been using it for a while and had learned to put in safeguards. My time constarints turned it back off. I contacted ST support about it because it concerned me why it came on and they basically said yeah that happens sometimes.
The switch turning on is also an event, so you can trigger off of that as well. So if someone turns it on manually you can check the temp or time. I also had a check to verify the door to the bathroom was closed. If anything is a amiss you can turn it back off. Just things to think about.