Help with Time Delay Heat Pump Piston


1) Give a description of the problem
I have a Sensibo Sky unit and it controls my Fujitsu Heat Pump perfectly. I have it integrated in ST and able to control it there as well. I created a Webcore Piston for it and the piston works great as well. However I would like to add a delay to the piston for certain temperatures but am not sure how to. I currently have all of the IFs set to ASYNC and have a No Cancellation policy for the WITH commands. I can change these if need be, they just work that way for me now.

2) What is the expected behavior?
The piston works great for all ASYNC IF conditions. It changes the heat pump temperature as expected. My issue is that the temp sensor I use at the other end of my house keeps toggling back and forth between 19C and 20C so the piston runs and changes the heat pump multiple times per hour during those changes. I’ve attached a screen shot to show this.

3) What is happening/not happening?

I would like to modify the piston so that if the room temp rises above 20C the heat pump sets to 20C but stays there for an hour. Even during this hour if it goes back to 19C and then back to 20C, etc, I would like to keep the set point at 20C in the piston for an hour. Then the process can start again. If it drops down to 18C I would like to continue to piston where it will turn up the heat pump based on the ASYNC IF commands.

4) Post a Green Snapshot of the piston

5) Attach any logs (From ST IDE and by turning logging level to Full)

The logs are correct for the piston I have now, I want to add to my piston.


I always leave at least a one degree difference so there is no “balancing on the edge of the fence”.
(For future reference, this also happens with humidity)

For example, in your current code:
something happens at 17°, and something else happens at 18°
something happens at 19°, and something else happens at 20°

With your coding the way it is, it is normal for it to toggle back and forth when the temp is around 17.9° or 19.9°.

Here is an example of how I usually code for this:

IF temp drops below 17°
    Then do stuff

IF Temp enters range of 18° to 19°
    Then do stuff

IF temp rises above 20°
    Then do stuff

This makes sure there are no crazy bouncing back and forth.
(notice nothing happens from 17.0-17.9 or from 20.0-20.9)



Thank you for the help. I can definitely change my If statements to have different temperature limits like you have suggested to help ease the transition.

I still have an issue where the actual temperature (and sensor) will bounce back and forth between 19 degrees and 20 degrees. I would like to have IF temp sensor goes to 20 degrees the heat is set at 20 degrees, for at least an hour regardless of what the temp sensor does. Then resume the other parts of the piston. I could just have it set to 20 degrees, then WAIT 60 minutes and have that section never cancel. Then the piston would resume running normally after 60 minutes but it won’t catch any of the rest of the IF statements I don’t believe due to the temp sensor possibly already being 18-19 degrees and not just entering that range after an hour.


This means your temp is near 19.9 degrees. My last post should stop the bouncing back and forth. If you still see issues once the new version in place, repost a new green snapshot and we can take a closer look.

By the way, a WAIT command will not stop the other triggers from firing. We may have to use variables to bypass your current logic, but the first line of attack is to get rid of the bouncing back and forth



I see what you are saying but I’m not sure if it will work. I’ve made the change for 17 and under. The 18-19 already exists. And the rises above 20 exists.

My problem is the temp sensor, you can see in this screenshot that it goes from 19 to 20 to 19 over and over. This causes the heat pump to go to 20 and then 21 and then 20 over and over.


This is normal for ALL temperature & humidity devices, which is why we created a “blank” slot so the piston does not respond to every slight change.

Visualize the old fashioned thermostats. The temp has to change 1.1 degrees for it to kick on, and then it stays on until it has heated/cooled the room 1.1 degrees. Rinse and repeat

Using this example, if the ideal temp is 75°, then the AC will kick on at 76°, and turn itself off at 74°.
(which is likely a 1.1° difference, even though it looks like 2° on paper)

Unless you changed something, the heat punp should not switch to 20° unless the temp sensor rises above 20°. (since it looks like your device only sees whole numbers, that would be 21°)

To be fair, I usually leave 2-3 degrees separating, but I have gotten by using one degree on occasions.


Also, for clarification:
If your temp device only sees whole numbers, then “rises above 20°” means 21° and up…
If your temp device sees decimal numbers, then “rises above 20°” means 20.1° and up…

In other words, if your device sees decimals, then you need to create a wider “gap”


Thanks for the help. My temp sensor only reports whole numbers so that is good. My current IF statement activates if the temp rises to or above 20. I can change that to rises above 20 and it won’t cut in until it sees 21 degrees. That will stop the temperature swinging I think, but it is way too hot for sleeping in the bedroom.

The other IFs are what you have suggested now, at or below 17, which will work fine. Another for enters range 18-19. I’m thinking I modify that so that it is just changes to 18 and forget about the 19.

So I will have:

If temp is at or below 17
Do set 22

If temp changes to 18
Do set 21

If temp is at or above 20
Do set 20

I think that will cover all the bases and allow the temperature to be close to correct and not jump back and forth on the heat pump. When the temp gets to 19 it will stay the same as 18 (21 degrees) or it will be coming down from 20 (and stay at 20 degrees) until the temp reaches 18.

What do you Think? I will type it up and send a screenshot along in a bit.


I was going to suggest this earlier… Good call!!

One small tweak to your last post:

By changing the line “IF temp is at or below 17” you have effectively deleted the one minute gap. Meaning the code above may occasionally straddle the fence at 17.9 degrees. Putting that back to “Drops below 17” will prevent that.


One crazy idea that I have done with a few clients in the past…

If your temp sensors only use whole numbers, you will actually have more precise control over the device if you tell the Device Handler to report back in Fahrenheit. You will effectively get almost double precision.
(1° C = 1.8° F)

If you go that route, each Fahrenheit number is 0.56° in Celsius, so you can fine-tune your comfort zone with greater accuracy.

This does mean a little calculating may be required when you make the piston, but you do not have to change your thermostat. That device can still stay with Celsius if you want.

Such as:

If temp drops below 62
Do set 22

If temp changes to 64
Do set 21

If temp rises above 66
Do set 20

(my math is not exact on this example, but there is a great conversion using Google)


I see what you mean about below 17 but I think at or below 17 will be fine. It has never actually reached 17 degrees so it shouldn’t be a problem, it’s just there as an “in case.”

I will look into the Fahrenheit, I don’t mind doing a conversion since it looks to help.


OK cool, I was just giving you a heads up since your current code could bounce back and forth at 17.9°


If it ever makes it that low I will look into changing it at that point.