Make my own climate entity with a temp sensor and a climate entity

Hi,
i took the thermostat off the wall and hung an ipad instead. The thermostat now hangs in the boiler room.
I want to create a new climate entity with a temp sensor and the original thermostat. I already tried the generic thermostat but my Toon thermostat won’t work on it.

Someone can help me?

Thanks!

1 Like

The Generic Thermostat integration requires two entities:

  1. temperature sensor entity (to report the ambient temperature)
  2. switch entity (to control the heater)

If your existing Toon thermostat is represented as a climate entity in Home Assistant then it’s not a simple switch entity so it’s incompatible with the needs of the Generic Thermostat integration.

You said the original thermostat is now in the boiler room. I assume the temperature sensor you mentioned is located elsewhere in your home and you want to make it the primary source of indoor temperature as opposed to the thermostat’s internal temperature sensor. Is that correct?

Not entirely.
You can set up an automation to turn on/off the “real” thermostat based on what the generic thermostat does to a input boolean.
I have all our TRVs set up like that.

In this situation, how would the Generic Thermostat override the Toon thermostat’s internal temperature sensor?

I’m not familiar with this specific thermostat but the way I set it up is to set the Toon thermostat set temperature higher than the generic.
So essentially if you want 20 degrees, set the Toon to 24 or something.

When the generic thermostat sees 20 it will send a signal to Toon to switch off

Interesting. How are you configuring Generic Thermostat to control the climate entity seeing that it must appear as a switch? Did you create a Template Switch?

You can use an input boolean.
It’s not documented but it does work.

So the boolean is if the room needs heat, and this change triggers an automation to set the TRV temperature to some degrees above what the generic is set to.
When boolean is off I set it to 0, but it could be set to a lower value than room temperature also to maintain better the heat I guess.

OK, thanks. I think I now understand what you have done.

Usually it’s a switch entity, controlling the actual heating device, so I thought you were using a Template Switch to control the climate entity. However, you’re using an Input Boolean and an automation (different means to achieve the same result).

FWIW, I have suggested the use of an Input Boolean in the past and using an Input Number to serve as the temperature source. However, that was just for demonstration purposes, to allow the user to easily experiment with the operation of Generic Thermostat. I didn’t foresee it being used in production the way you have done.

Correct,

The temperature in the boiler room is way higher than te temperature in the living room.
I want to use the temperature sensor in the living room.
I will try to figure out what you mean with the input boolean in combination with an automation.

Thanks!

I suggest you create a Template Switch similar to the following example. It assumes your Toon thermostat’s entity_id is climate.toon (change it to the actual entity_id).

switch:
  - platform: template
    switches:
      toon:
        value_template: "{{ is_state_attr('climate.toon', 'hvac_action', 'heating') }}"
        turn_on:
          - service: climate.set_temperature
            target:
              entity_id: climate.toon
            data:
              temperature: 30
              hvac_mode: heat
        turn_off:
          - service: climate.set_temperature
            target:
              entity_id: climate.toon
            data:
              temperature: 15
              hvac_mode: heat

The result is a switch called switch.toon. When turned on, it sets climate.toon to a high target temperature (30). When turned off, it sets climate.toon to a low target temperature (15). The basic idea is to simply make your heating system turn on/off. You can use other climate service calls to achieve the same result but, for simplicity, I have simply chosen to use high/low target temperatures in this example.

For the configuration of Generic Thermostat, reference the Template Switch switch.toon. Here’s a sample configuration. Assign it whatever name you prefer and don’t forget to set the correct entity_id for target_sensor.

climate:
  - platform: generic_thermostat
    name: Thermostat
    heater: switch.toon
    target_sensor: sensor.your_temperature_sensor
    min_temp: 18
    max_temp: 24
    target_temp: 21
    min_cycle_duration:
      minutes: 15
    away_temp: 16
    precision: 0.5

The result is a new climate entity called climate.thermostat that can control your existing climate.toon via the Template Switch.

2 Likes

That’s it!

Thanks a lot for the help mate!!

1 Like

For a more fine control you can use

switch:
  - platform: template
    switches:
      toon:
        value_template: "{{ is_state_attr('climate.toon', 'hvac_action', 'heating') }}"
        turn_on:
          - service: climate.set_temperature
            target:
              entity_id: climate.toon
            data:
              temperature: {{ state_attr('climate.toon', 'temperature') |float + 3.5 }}
              hvac_mode: heat
        turn_off:
          - service: climate.set_temperature
            target:
              entity_id: climate.toon
            data:
              temperature: 0
              hvac_mode: heat

This way your generic thermostat can control the toon thermostat temperature.
The way Taras suggested is more or less on or off. With the above you can control the set temperature with the generic thermostat.

If you demand 30 degrees from a heater and you only want 20 degrees chances are that it will overshoot its target. All that heat that is “wasted”.
I have seen people here making very advanced templates where you turn down the heat as you get closer to target.
I believe mine is set to 3.5 above the generic thermostat and it keeps the heat quite well.

It should turn on below 21 and turn off at 21.5 while we are home (that is why it drops below sometimes)

The spike is me putting my hand on the radiator to make it switch off, I just wanted to see if the battery was OK in the TRV

1 Like

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.

I need assistance please. Want to do the same kind of thing, but essentially the opposite. I want to use an actual switch (switch.geyserswitch) combined with a temperature (sensor.geysertemperature) to form a Climate based entity (climate.gesyer). The entities are sourced from Tuya.local. I also have (sensor.geyserworkstate) an actual work state, all from the Tuya Gesyer/Heater controller. What I want to do is ensure I have a Climate entity, controlled from a Dashboard, but with readings of temperature, and control to switch hvac to heat/off. Used your example, but know the switch.geyser doesn’t take the actuals from the actual Tuya, can only control (send heat command) to Tuya. See configuration.yaml below.


switch: - platform: template sensor: geyser: value_template: “{{ is_state_attr(‘climate.geyser’, ‘hvac_action’, ‘heat’) }}” turn_on: - service: climate.set_temperature target: entity_id: climate.geyser data: temperature: “{{ int(istates(‘number.geyserblock1’)) }}” hvac_mode: heat turn_off: - service: climate.set_temperature target: entity_id: climate.geyser data: temperature: 35 hvac_mode: heatclimate: - platform: generic_thermostat name: Geyser heater: switch.geyser target_sensor: sensor.geysertemperature min_temp: 20 max_temp: 55 initial_hvac_mode: “off” ac_mode: false target_temp: 55
‘’’

Hi,

Where does this code go? inside the climate template?
I have the following…but state doesn’t update (although the underlying switch does).

climate:
  - platform: generic_thermostat
    name: SpaceHeater_Porch
    ac_mode: false
    heater: switch.space_heater_pro_power_switch
    target_sensor: sensor.space_heater_pro_temperature
    initial_hvac_mode: 'off'
    min_temp: 45
    max_temp: 500
    target_temp: 71
    min_cycle_duration:
      seconds: 5
    away_temp: 50
    precision: 1