Climate - Generic Thermostat not working

I have three thermostats configured. Two are Venstar thermostats and they work fine. The third is a generic thermostat for the office, which has a temperature sensor and a switch that turns on a simple heater. The temp sensor works and the switch works. I have the following configuration for the thermostat/climate settings:

climate:

  • platform: generic_thermostat
    name: Office
    heater: switch.officesswitch1
    ac_mode: false
    min_temp: 5
    max_temp: 25
    hot_tolerance: 0.5
    target_temp: 18
    away_temp: 2
    initial_hvac_mode: heat
    target_sensor: sensor.masterbedroomtempsensor_am2301_temperature

When I add the thermostat to my UI, it works fine. However it does not actually switch the device. The temperature short up correctly and I can adjust the set point. I have set it to ā€˜heatā€™ etc.

Basically. It looks great, but doesnā€™t actual do anything.

Any help would be appreciated.

1 Like

Letā€™s start with the basics, are you certain the spelling of the two entities is correct?

Bit of a reach here but does the sensor return a purely numeric value at all times?

Also please post formatted YAML otherwise we canā€™t tell if what you posted has correct indentation.

climate:
  - platform: generic_thermostat
    name: Office
    heater: switch.officesswitch1
    ac_mode: false
    min_temp: 5
    max_temp: 25
    hot_tolerance: 0.5
    target_temp: 18
    away_temp: 2
    initial_hvac_mode: heat
    target_sensor: sensor.masterbedroomtempsensor_am2301_temperature

If you look at the docs then maybe ā€œheatā€ needs quoation marks i.e.

  initial_hvac_mode: "heat"

Might be worth a try!

image

I tried putting quotes around ā€˜heatā€™. Didnā€™t work.

Thermostat looks correct - See attached image. Just shows idle though.

Not sure why it isnā€™t working for you.

I just threw something together using random entities and it works. I used an input_boolean for heater and a sensor that reports a numeric value for target_sensor.

Idle:

Screenshot from 2020-10-07 17-28-22

Heating:

Screenshot from 2020-10-07 17-28-55

The associated input_boolean gets turned on/off as would be expected (of a switch controlling an actual heater).

Just for fun, open the Climate cardā€™s overflow menu (three dots in the upper right hand corner) and check what is selected for Preset. It should be None (as opposed to Away). Scratch that; itā€™ll report if itā€™s in Away mode.

Screenshot from 2020-10-07 17-38-13


FWIW, hereā€™s the configuration I used:

climate:
  - platform: generic_thermostat
    name: Office
    heater: input_boolean.test
    ac_mode: false
    min_temp: 25
    max_temp: 35
    hot_tolerance: 0.5
    target_temp: 29
    away_temp: 2
    target_sensor: sensor.memory_use_percent

I tried it with and without initial_hvac_mode: heat and it made no detectable difference in its behavior.

1 Like

ok. That works fine. However when I put in the switch it doesnā€™t work. Am I to assume this is the correct behaviour in that it can only work with an input_boolean, or should it also work with a switch. Seems a little pointless if it wonā€™t work with a switch right? Or am I missing something?

Thanks for your help. At least I feel I am getting somewhere now.

No I was merely demonstrating that I can throw in almost entities in there and still get it to work properly. My exampleā€™s heater is a do-nothing input_boolean and target_sensor is actually a sensor that reports memory usage. The point is, I got this working with random crap to prove thereā€™s nothing wrong with your configuration.

What you need to confirm is that switch.officesswitch1 is spelled correctly and, when it is operated via the Lovelace UI, it actually turns the heater on/off. If the name is right and it controls the heater then thereā€™s no reason the Generic Thermostat canā€™t also use it to control the heater.

Thanks for the help. I have checked the spelling etc. and there are no issues there. I have simply worked around this. As you say, using an input boolean works just fine. I simple used a declared an input boolean and then used an automation to switch the switch on/off based upon its value. Seems like a long way around the houses, but it works.

Thanks

Adam

FYI. There are a number of other posts identifying exactly the same issue. Each time, somebody comes back with similar suggestions to those here. In many of those posts, I donā€™t see people coming back and saying ā€œgreat it now worksā€. I suspect there is an issue here somewhere and many of those people have just given up and done something similar to that which I have done. Maybe the switch.officeswitch1 value (which I cut and pasted from the entities tab) does not make the cut as an input boolean. I would be glad to examine debug logs, it you could point me to them.

Regards

Adam

2 Likes

Does it not strike you as odd that the automation you created can control the switch but Generic Thermostat cannot?

Generic Thermostat simply changes the state of the heater entity from off to on to off as needed. Both the switch and input_boolean entities have two states, on and off so they work equally well. This forum contains numerous examples of people successfully using Generic Thermostat to control a switch. You should be equally successful.

  • The fact that the switch can be controlled (via the automation) indicates it is indeed controllable and behaving normally.
  • The fact it cannot be controlled by Generic Thermostat implies there is a missing clue to this puzzle (or operator-error).
  • The Rube Goldberg arrangement you have implemented, although seemingly successful, only serves to mask the root cause.

If you are interested, I am available to continue with the investigation. On the other hand, if you are satisfied with the workaround/kludge (cannot in fairness be classified as a proper solution) then I guess weā€™ve come to the end of the road.

My only tip is that you add initial_state: true to the kludge automation. Should it ever be accidentally turned off, upon startup that directive will force the automation to on. Itā€™s important that it always remains on otherwise the Generic Thermostat will fail to control the heater.

1 Like

Hi, just to document that the same issue happened for me with a tuya/xiaomi switch. Coudnā€™t get the Generic Thermostat to work when using the heater parameter, with my switch, but using an input boolean instead and linking to an automation worked.

1 Like

Adding my 2pā€¦

I could never get generic thermostat to work with my set up either, which was (supposed to be) controlling a switch provided by esphome. Tried for ages, but it didnā€™t work once.

I decided it was rubbish and just moved to using an automation (that actually works better than the thermostat would have anyway) in the end.

Iā€™m curious, are you not using generic thermostat at all? And if so, would you be so kind to share an example? Iā€™m curious how you input your desired temperature. Thks

I donā€™t use any climate components at all. I use a template sensor to get the average current temperature of the house, I use a template sensor based on device trackers and known guests for occupancy and I use an input_boolean for ā€˜30 minute boostā€™.

We also have a loft extension where the radiator is not as effective as weā€™d like, so thereā€™s an electric heater in there that switches on for 15 minutes every time the main heating switches on.

I actually found that if I kept the house at an average temperature between 16 and 19 everyoneā€™s happy, and I also worked out that when the heating is switched off the temperature continues to rise another degree (well, about 0.8, but whoā€™s counting) before the temperature starts dropping again, so I didnā€™t actually need to ā€˜set a desired temperatureā€™, I just have 16 and 18 degrees hard coded, but you could easily use an input_number for one or both.

I can post the automation itself later/tomorrow with a better explanation of how it all comes together if you need it.

I have played around with this and the issue seems to be that the Generic Thermostat can deal with an input_boolean. The temp input works find and it will set the boolean when the heat (or cool) needs to be turned on/off. However just changing that one parameter from input_boolean. to switch. makes it do nothing.

1 Like

I cannot replicate your results. In other words, I have a Generic Thermostat that successfully controls a switch entity.

Hereā€™s the configuration. For this experiment, I used a switch that controls a bathroom exhaust fan (I donā€™t have a switch entity that controls a heater).

climate:
  - platform: generic_thermostat
    name: Office
    heater: switch.guest_fan
    ac_mode: false
    min_temp: 18
    max_temp: 25
    hot_tolerance: 0.5
    target_temp: 20
    away_temp: 2
    target_sensor: sensor.counter_light_temperature

Hereā€™s the resulting card in the Lovelace UI:

Screenshot from 2020-10-24 12-00-30

Youā€™ll notice the ambient temperature is 20.7 and the target temperature is 21.5. However, it is not currently heating because it is Off (notice the ā€˜flameā€™ icon is dimmed whereas the ā€˜powerā€™ icon is bright).

After clicking the ā€˜flameā€™ icon to enable heating, the status changes from Off to Heating and the bathroom fan turns on (ā€˜flameā€™ icon is red and the ā€˜powerā€™ icon is dimmed).

Screenshot from 2020-10-24 12-00-43

Can others duplicate this behavior or does it not even get this far?

1 Like

Itā€™s been a while since I tried it, and I have no inclination to conduct any further tests currently, but if I remember correctly setting the temperature of the thermostat to above the current ambient temperature in the ui did work. The problem was when the ambient temperature dropped below the desired temperature that was previously set and/or the thermostat mode was changed from off to heat.

As I said it was a long time ago, but it simply didnā€™t work and we would often find ourselves sat in a cold house with the generic thermostat in heat mode, the ambient temperature being below the desired temperature and the generic thermostat sitting idle.

2 Likes

OK, thatā€™s a plausible failure scenario. Iā€™ll need to replace the temperature sensor entity with an input_number so I simulate the same conditions.

What perplexes me is why this failure scenario purportedly only manifests itself for a switch but not an input_boolean. The Generic Thermostatā€™s code simply use a turn_on/turn_off service so it should behave the same regardless of whether itā€™s a switch or an input_boolean (i.e. as long as the entity responds to turn_on/turn_off, it should work the same).

Anyway, I completely understand why, given that you already a reliable alternative, this quirk is no longer on your radar.

1 Like

I agree it makes no sense, but itā€™s a regular problem as evidenced above.

As you can imagine I did put a lot of work into it at the time but never found a solution, just people saying ā€œworks for meā€, or saying ā€œI had the same problem and never found a solutionā€.

All I can say is thereā€™s definitely a bug somewhere, but it doesnā€™t seem to be ā€˜reproducibleā€™ (in the sense of if I do this it works, but as soon as I do thatā€¦) - the whole thing either works for people or it doesnā€™t with no obvious cause. The only thing that appears to link the cases is the use of a switch domain, but many people use switches without issue, so in the words of the prophetā€¦

:man_shrugging:

1 Like

As a data point, I was also unable to use a switch and thermometer, but changing to an input_boolean (that controls the switch through an automation) and input_number (that is update from an automation) makes the thermostat work.

The switch is an insteon 2663-222 outlet and the thermometer is off of an aeotec multi-sensor 6.

I do also want to acknowledge how difficult it is to troubleshoot so many different permutations of configurations that people can have and how all of those are abstracted into HA and appreciate how much effort has gone into making things work so well.

2 Likes