US Heat Pump with gas aux

I have one of the original HestaPI units, but never put it in place because I have a US style heat pump with propane auxiliary heat, and I could never find out how to configure the HestaPI to support that. It has a line to start the compressor, a line for the reversing valve, a fan line, and a line to turn on the gas heat.
Ideally, I want to have the device use the heat pump for heating unless one of the following is true:

  • External temperature (as fetched from some external source e.g. NOAA) is below 10F
  • Delta between setpoint and internal temperature is greater than 10F (e.g. during a transition from nighttime to daytime heat settings)
  • When forced by an override (for use during power failures where the backup generator has enough power for the fans but not the compressor).

Bonus points would be for having an addition mode where the auxiliary heat is disabled, and ONLY the heat pump may be used (for when the propane delivery is late and I’m running out).

I’ve done some searching and I don’t see any other posts that cover this use case.

I think this is doable with some customization.

There is a 2nd stage heating built in, which is similar to what it sounds like you are looking for. It will use the main heart (your heat pump) unless it can’t keep up, then it’ll also turn on the auxillary heat (gas). The way it’s currently implemented in the HestiaPi is that if the heat has been on for a while and it’s still not up to the set point, it’ll turn on the seconds stage until it gets to where it should be.

The main issue is that most thermostats, including the HestiaPi, expect turning the heat on to be a single relay. I’m not quite sure I followed how your system works with the reversing valve, but it seems pretty clear that’s not the case with your system.

As I see it, there are two options:

  1. Change to code that turns on the heat, the second stage, and the cooling, or
  2. Build some hardware so a single relay will control the heat pump, another relay will control the gas heater, and a third one will control the cooling

Pure software solution

It sounds like your system is controlled by 4 relays, which matches what the HestiaPi has. If I understood correctly, it should look like this:

  • Normal heating
    • heat pump: on
    • reversing valve: off
    • fan: on
    • gas heater: off
  • Second stage heating
    • heat pump: on?
    • reversing valve: off
    • fan: on
    • gas heater: on
  • Cooling
    • heat pump: on
    • reversing valve: on
    • fan: on
    • gas heater: off
  • Fan
    • heat pump: off
    • reversing valve: off
    • fan: on
    • gas heater: off
  • Off
    • heat pump: off
    • reversing valve: off
    • fan: off
    • gas heater: off

If that’s correct then this is totally doable. And if I have the reversing valve backwards, let me know, that’s easy enough to fix.

Hardware solution

This option is interesting because it would not only make your HVAC compatible with the stock HestiaPi, buy it would also make it compatible with and standard thermostat.

Basically it would have 3 inputs (heating, 2nd stage, cooling) and then would control each of the components. The fan would just connect directly.

It would take some thought, but it should be a pretty simple circuit in the end. Just a bunch of relays and some kind of power supply (possibly powered by the HVAC lines, depending on if you have a common wire or not).

Second stage logic

Whether going the software or hardware route, the logic to control when the second stage kicks in will need some work. I like what you have in mind and it should be fairly straight forward to implement.

However I’d suggest we focus on the control parts first. It’s getting to be spring, so second stage heating shouldn’t be urgent at this time of year. Plus you can always adjust your set point to kind of get what you want until you’ve implemented what you actually want.

Once the basics are covered, then we can do the improved logic for when to turn on the second stage.

Questions

Are you more interested in the software solution or the hardware option? I can help with either.

Do you know how to read or write Javascript code? I ask because most of the control logic is written in JS.

Comments

I’m also personally interested in more advanced logic for multi-stage heating (and cooling). I have a ground source heat pump that has 3 stage heating and 2 stage cooling.

It also is not controlled by relays, but rather some propritary ModBus over RS485 junk. So before I can use more advanced multi-stage heating/cooling, I need to find a way interface with the HVAC unit (there’s an existing project to help with this). I also want to upgrade to Debian 12, and have the option to run OpenHAB on another machine (rather than ruining on the thermostat itself).

So in other words, there’s a lot vying for my time on this project alone. But, fear not, I make supporting others a priority. :heart:

My system is already compatible with the US standard, so I have no reason to change it.
The truth table for a standard US system like this is:
State | Compressor | Reversing | Fan | Aux
Cool | ON | off | ON | off
Fan | off | off | ON | off
Heat | ON | ON | ON | off
Gas heat | off | off | ON | ON
IDLE | off | off | off | off

Then basically:
doThermostat()
{
if SetpointLo - Internal > swing
CallForHeat();
else if Internal - SetpointHi > swing
CallForCool();
else if Mode = Fan
HwState(Fan);
else HwState(Idle);
}

CallForHeat()
{
if (ouside < -10C)
HwState(Gas Heat);
else if (Emergency)
HwState(Gas Heat);
else if (Low Fuel)
HwState(Heat);
else if (SetPointLo - internal > 10C)
HwState(Gas Heat);
else
HwState(Heat);
}
CallForCool()
{
if (Emergency)
return;
HwState(Cool);
}

Mostly, I just need to know where any changes need to go. Is this all controlled by some form of config file (e.g. XML), or is this all code.
As for languages: I’m fluent in C++20, Javascript, Perl, Python, Shell Scripting, TCL, C# - I just need to know what to change.

Awesome. The code is technically stored in /var/lib/openhab2/jsondb/automation_rules.json but you’ll probably want to update it via the OpenHAB PaperUI (under Configuration → Rules, IIRC).

You’ll find rules like “HeatingCtrl received command” which has the code when the heat should be turned on:

And cooling:

And the logic for when to trigger the heating or cooling:

I find the text file easier to navigate to figure out which rules I should look into and then I use the PaperUI to actually look at and modify the code. I’d highly recommend making a backup before and after you make changes.

If you want to contribute your changes back, it’d be very cool to have a third mode (US-Heat-Pump) to add to the existing US and EU modes. Then if you ever have to re-flash the card you won’t have to re-apply all your changes. Just switch from US to US-Heat-Pump and you’ll be good to go.