Thermostat to control a gas heater

Hello all,

I plan to setup a smarter thermostat for the gas heater in my house and I have some questions. Initially I was thinking of starting from the Generic Thermostat example and customise it but I cannot figure some things out. Here is my setup:

  1. I measure the temperature in each room with xiaomi bluetooth devices and feed them to homeassistant via esp32.

  2. my gas heater will have an esp8266 with a relay that will turn it on and off.

Now, the house is not very smartly build so I cannot really control the temperature per room (although I am researching some options for the future).

In my mind I would do the following: take the average temperature in the house using the temperatures in each room and use that as input for the generic thermostat. But this will create the following problem: when the average temperature falls below a threshold even by a bit the heater will turn on and the it will turn off and so on. This leads to a lot of gas being burned. How can I add some sort of condition to this? For example: say the average temperature falls below the threshold but the temperature in one or two rooms are ok (as in between some limits) then the heater should not turn on (this would correspond for example to the situation when a window is opened in one room).

In any case, I am confused about how to add some more logic to the existing generic thermostat example.

Any help or advice is appreciated!

Lucian

Since the generic thermostat has a heater switch that would control the gas heater, instead of specifying the switch that controls the heater, put a generic switch object in between and add an automation triggering on either the thermostat switch state change (for the case when you change the temperature value of the generic thermostat on the UI) or the rooms temperature change and add the logic you want as a set of conditions. If those conditions are met, turn on the switch that effectively controls the heater, otherwise turn it off.

I don’t know if this helps, but my Honeywell “smart” thermostats have a setting (forget what they call it) which indicates about how many cycles per hour you want your heating (or cooling) system to run. In other words, rather than going on and off based on an exact temperature range, it tries to approximate how often, and for how long, it needs to run the heat to achieve a relatively stable temperature. This is more fuel efficient, reduces wear on your system, and keeps you more comfortable.

I’m impressed by how well it works. I’d think something like this would be helpful in the HA generic thermostat, although I’ve never heard that it can do this. Maybe with automations?

Back to the original question, would it be possible to select one temperature sensor in the middle of your house, where the temperature swings are the least, as the primary input to the generic thermostat? Then add logic to bump the set temperature up or down if some other key room (bedroom, living room, whatever) gets out of a comfortable range?

Where I live, I can’t risk my heating system to something as unreliable as HA. A failure could be very expensive, even life threatening. While I can monitor and control my thermostats from HA, they work just fine without it. I just offer this as something to think about. Obviously in milder climates this isn’t an issue.

i have not yet used the generic thermostat so my reply is theory only!

I looked at the generic thermostat and it appears to have everything you need. It has the concept of a set point (desired temperature) as well as differential (how much to go past the set point). They call that the cold_tolerance and hot_tolerance. So if you set the temperature for 25 degrees and the hot_tolerance and cold_tolerance to 1 then the furnace will go on at 24 and off at 26.

Oh, and be careful of averages - humans don’t do well with them. ie. you could find the place you normally habitat at 30 degree because the furnace is trying to achieve the average temperature of 23. Remember the statisticians joke - my head is in the freezer and my feet are in the oven, and on average my temperature is fine.

At the moment I have a Salus Thermostat which works OK-ish but it is a pain to setup and it lost the settings twice already.

I have thought about HA failing and leaving me without a thermostat but then I can always reconnect the Salus one I guess. Also, I live in Romania and is not that life threatening if there is a small hiccup with the heater.

I like this comment! This is my concern about using the average temperature as the trigger. I was thinking to set some weight to the room temperatures like this:

  1. most important is the kids bedroom. There I would like it to be 24 C.
  2. main bedroom. Here it doesn’t matter much, but not below 21-22 and not above 24 either.
  3. spare bedroom/office. Here it can be the same as main bedroom.
  4. livingroom (downstairs). Here is the tricky bit and I can probably leave this out of the average/automation because this is a large space with a much faster temperature fluctuation (outside door opening etc.)

So I image that I will take the average of 1+2+3 and ask the heater to turn on like this:

  1. the average value is below a minimul threshold
  2. if the temperature in 1 is 24 and 2 and 3 are within the rage then don’t turn on
  3. if temperature in 1 is below a minimul threshold (23 for example) but average is within range then turn on.
  4. if 2 falls below minimum value then turn on but stop if 1 goes above 24 (or something like this).

So if my understanding is correct. I can achieve this with a complex automation that is tied to the Generic thermostat feature of HA? Or should I just use the automation without the Generic Thermostat?

Also another point of confution with the generic thermostat:
In my case, I will have to have three temperature inputs, but the Generic Thermostat only has one. How can I change the interface of the Generic Thermostat to make it more customizable to my case?

Lucian

You don’t have to change the generic thermostat. Instead use a template to take the temperatures and create a new sensor that is the average or whatever formulae you want.

OK, so I have added the following card to ui-lovelace.yaml:

- type: 'custom:simple-thermostat'
    entity: climate.home
    step_size: 0.5
    sensors:
        - entity: sensor.roomtemp_office
          name: Office
        - entity: sensor.roomtemp_kids_bedroom
          name: Kids
        - entity: sensor.roomtemp_master_bedroom
          name: Bedroom

and the climate section to the configuration.yaml

climate:
  - platform: generic_thermostat
    name: home
    heater: switch.heating
    target_sensor: sensor.average_house_temp
    min_temp: 15
    max_temp: 28
    ac_mode: false
    target_temp: 17
    cold_tolerance: 0.3
    hot_tolerance: 0.5
    min_cycle_duration:
      seconds: 5
    keep_alive:
      minutes: 3
    initial_hvac_mode: "off"
    away_temp: 16
    precision: 0.1

I still don’t understand where should I add the logic. I have created a sensor that averages the temperatures in the rooms I am interested in. But how do I turn on the heater based on some conditions like I outlined earlier?

When? 24/7? just overnight? When this room is maintained at 24, what temp is the rest of the house? To maintain this room at 24 there isn’t a range, so it’s going to dictate whether or not the heat comes on.

I’m probably going to HA for an apartment building in the north east, so yeah I’m concerned about failure and freezing. What I plan to do when I set control to HA is to have and ol fashioned honeywell analog button set at like 65° as a fail safe.

1 Like

ok 24 is probably too much but you get the idea. I have tried to just use the average house temperature sensor as the target temperature for the generic thermostat.

I have added a switch to an esp8266 on my desk and tried to play with this thermostat. It worked for a bit, as in I would set a target temperature and the switch would turn on. Lower that temperature and the switch would turn off. Trouble is that it stopped working for some reason and I have no clue how to get it working again.

Maybe I am over complicating my setup so I could try just with the generic thermostat and the average house temperature. I wish I new where to look to see if I can modify this generic thermostat to my use case.

If room #1 is being held at a temp 22, 23,or 24 doesn’t matter, what matters is the effect it has on the rest of the system.

The way you have the rules defined above:

If room #1 is at it’s set temp but another room needs heat, as soon as room #1 goes up a degree the system will shut off regardless if the other room has reached min temp or not.

and vice versa

If room #1 needs heat but the other rooms are at their set temperature the furnace will go one to satisfy the room #1 rule even if it means another room goes above its max temp.

So what I suggest is, the times that room #1 needs to be at it’s set temp, just use that one thermostat. I would use multiple automatons depending on the time of day/day of the week using the relevant thermostats. Rather than one rule to cover everything

Since the system is all on or nothing, in an all in one rule. The best you will be able to do is maintain a minimum temp in all rooms with a thermostat. Doing that though will make some rooms hotter than you’d like.

Edit: Is this a hot water or steam radiator system?

I think this is what I was trying to say earlier. Pick a room (presumably, the central or most commonly used room.) Use the thermometer in that room to feed the generic thermostat.

Then set up automations to increase the set point on that thermostat if one of the other rooms falls below a desired temperature, and to restore it when the conditions change (time of day, occupancy or whatever else) or the temperature gets to the desired value.

No matter what you do, you run the risk of making one or more rooms too hot, trying to keep the coolest room up to a minimum temperature. There are manual ways to balance the system, depending on whether it’s forced hot air, forced hot water or steam. But those change with outdoor temperature and wind conditions and you can’t automate them unless you have zone valves, powered dampers or some such.