Generic_Thermostat not working

I have a sensor (sensor.nn_max_hdd_temp) that I know is working as I graph it in Graphana - it contains the maximum temperature of a bunch of HDD’s in a NAS. I actually go straight from the NAS to influxdb and then pull the data into HA via a flux query. This value is set by a helper and is then pushed back to InfluxDB and then out to Grafana

I also have a smart switch connected to a light bulb. I can turn this on and off with HA at the dashboard. This is (switch.tasmota_wifi1). The intention is to use the lightbulb as a placeholder, so that when the max drive temps go > a set value then the light turns on and then back off again when the sensor goes below a value.

The intention is that this is a test precursor to switching on / off an HVAC system based on temperature so I can keep the drives below a set value. At the moment I am treating this as a heater, so I haven’t reversed things yet. I am just trying to get the concept working first

In configuration.yaml I have the following code

climate:
  - platform: generic_thermostat
    name: Garage.AC.Thermostat
    unique_id: a816ccc9-f857-4581-9757-af013e7bd7b7
    heater: switch.tasmota_wifi1
    target_sensor: sensor.nn_max_hdd_temp
#    ac_mode: true
    min_cycle_duration:
      seconds: 600
    min_temp: 32
    max_temp: 39
    precision: 1

The intention is that if temp < 32 then light off
if temp > 32 then light on and if temp goes as high as 39 then I think light off again.
Temp was 33 earlier today and is now 31 - so the light should be on (I think)

But its not. What am I doing wrong?

max_temp and min_temp set the available range of set points, they do not actually set the target temperature… that is set initially by the target_temp variable.

OK - that makes sense - so I have now configured the following:

climate:
  - platform: generic_thermostat
    name: Garage.AC.Thermostat
    unique_id: a816ccc9-f857-4581-9757-af013e7bd7b7
    heater: switch.tasmota_wifi1
    target_sensor: sensor.nn_max_hdd_temp
#    ac_mode: true
    min_cycle_duration:
      seconds: 600
    min_temp: 28
    max_temp: 39
    target_temp: 36
    precision: 1

Lets see what happens

Current Sensor Temp = 30 or am I going to have a problem with the temperature having to cross one of the temperature values?

The temp went from 32 this morning to 39 just now - still no light

Did you turn the climate entity mode to heat…? You did not set an initial_hvac_mode, so the default is off and you must turn it on through the UI or a service call.

With the climate entity on and a setpoint of 36, the light should have turned on whenever the temp changed to a value below 36, and turned off once the the temp reached 36.3 or above (the default tolerance is 0.3).

Check the switch’s history. If there’s no evidence of switching, post the climate entity’s data from the States tool in Developer tools.

Thank you
I have added the entity as suggested - the current temp however is 39 (as its a bit warm) so I will wait and see what happens overnight

And that seems to work. The light was off, I turned on the AC and now the light is on (temp as I check is 34). So I shall wait for the temp to go back up and see if it does as expected.

I do however need a less powerful bulb for testing though [Blink Blink]

And the light turned off again as the temp went up. Now I get to try and reverse the effect

1 Like

Well - that all seems to work. The trigger temperature just went from 36 to 37 and the light turned on.

climate:
  - platform: generic_thermostat
    name: Garage.AC.Thermostat
    unique_id: a816ccc9-f857-4581-9757-af013e7bd7b7
    heater: switch.tasmota_wifi1
    target_sensor: sensor.nn_max_hdd_temp
    ac_mode: true
    min_cycle_duration:
      seconds: 600
    min_temp: 28
    max_temp: 39
    target_temp: 36
    initial_hvac_mode: "cool"
    precision: 1

I shall run some more tests on this over the next few days and then switch to the AC unit.

I believe that I am limited to a single switched unit in the generic thermostat - so if I want the light to come on / off AND the AC to switch on / off then I will need a second generic_thermostat triggered from the same value. I am tempted by a light on in my office if the AC is on for the server - its nice to know

Thank you @Didgeridrew

As a second thought - does anyone know of a way (device) of having a USB Power Supply with more than 1 USB port - but individually addressable - so I could use one to power a bank of small light and use HA to switch on / off each light individually?

I am thinking of using something like: Ebay Link to Sample Light

Turns out I may be able to use an LED strip. Some of these are/can be individually adressable

You are limited to one switch entity, but that could be a Template switch that includes both the Tasmota switch and light in it’s actions. Or you can set up a second automation to turn the light on/off based on the Tasmota switch or climate entity’s state… there’s no real advantage (and some disadvantage) to setting up a second Generic thermostat if the temperature set points are going to be the same.

So I changed the light switch over to the Garage AC which I thought was climate.garage_ac
But it doesn’t work. It seems I am using the wrong control

Looking at the logbook it seems that I need to be using


so this needs to be set to “Cool” or “off” - the rest don’t matter

If however I change the yaml to heater: climate.set_hvac_mode then it doesn’t work

As an aside this is not a great solution (not HA’s fault) in that the sensibo unit I am using to talk to the AC unit can only send data - it has no idea of what the actual state of the AC unit is. Other than changing the AC unit for one that is directly supported in some manner (WiFi connection or similar) then I don’t see a way around the issue

Yeah - its working. I have done something a bit different to what I was trying

Rather than try and (it seems like) reinvent the wheel I have used my light on/off switch (that was working correctly) in a simple pair of automations. If light turns on - then switch on AC. If light turns off then switch off AC. The min_cycle_duration inside the generic_thermostat keeps the light from cycling on and off too often and thus keeps the AC from cycling too often as well.