Creating climate entities

Is it possible to create a climate entity?

Currently my heating is through hive, and I have the integration here. However, the thermostats are not in ideal places, the down stairs being in my hall and upstairs being on the landing. I’m interested in keeping tighter control over my house’s gas usage (for obvious reasons) and so would rather not be reliant on the landing thermostat, due to there not being a radiator on the landing, so thermostat would never reach temperature. What I want to do is instead have the temperature controlled by the average temperature of my three bedrooms (which I can get via philips hue motion detectors (I know they’re not the most accurate, but it’s a start)). However, I need this average to read as a climate sensor. How can I do this?
Any help would be appreciated.

tl;dr
Need to average out several temperature readings and make that average read as a climate sensor.

Have you looked at Generic Thermostat?

Oh, so I need to create a generic thermostat in order to create a climate entity?
I’ll have to have a closer look at it. I assume, the “heater” then is the heat on demand entity from hive?

OK, so I use Hive also. Firstly, I calibrate my Hue motion sensors. I put them all together once a year and work out the differences between them and my Hive thermostat (which I consider to be the most accurate. Then I create template sensors as follows:

template: 
  - sensor:

      # last calibration on 2022-11-07
      # float() set to give 15 ℃ after calibration offset

# Offset & round-off Hue temperature sensors -----------------------------------
      - name: "Hallway temp"
        unique_id: hallway_temp
        device_class: temperature
        unit_of_measurement: °C
        state: "{{ ( states('sensor.hallway_motion_temperature') | float(13.8) +1.2 ) | round(1) }}"

      - name: "Living room temp"
        unique_id: living_room_temp
        device_class: temperature
        unit_of_measurement: °C
        state: "{{ ( states('sensor.livingroom_motion_temperature') | float(13.7) +1.3 ) | round(1) }}"

      - name: "Study temp"
        unique_id: study_temp
        device_class: temperature
        unit_of_measurement: °C
        state: "{{ ( states('sensor.study_motion_temperature') | float(14.1) +0.9 ) | round(1) }}"

      - name: "Landing temp"
        unique_id: landing_temp
        device_class: temperature
        unit_of_measurement: °C
        state: "{{ ( states('sensor.landing_motion_temperature') | float(13.8) +1.2 ) | round(1) }}"

      - name: "Bedroom 1 temp"
        unique_id: bedroom_1_temp
        device_class: temperature
        unit_of_measurement: °C
        state: "{{ ( states('sensor.bedroom_1_motion_temperature') | float(13.7) +1.3 ) | round(1) }}"
  
      - name: "Bedroom 2 temp"
        unique_id: bedroom_2_temp
        device_class: temperature
        unit_of_measurement: °C
        state: "{{ ( states('sensor.bedroom_2_motion_temperature') | float(13.7) +1.3 ) | round(1) }}"

      - name: "Bedroom 3 temp"
        unique_id: bedroom_3_temp
        device_class: temperature
        unit_of_measurement: °C
        state: "{{ ( states('sensor.bedroom_3_motion_temperature') | float(13.7) +1.3 ) | round(1) }}"

      - name: "Front temp"
        unique_id: front_temp
        device_class: temperature
        unit_of_measurement: °C
        state: "{{ states('sensor.front_motion_temperature') | float(15.0) |round(1) }}"

      - name: "Patio temp"
        unique_id: patio_temp
        device_class: temperature
        unit_of_measurement: °C
        state: "{{ states('sensor.patio_motion_temperature') | float(15.0) |round(1) }}"

# others -----------------------------------------------------------------------
      - name: "Hottest temp"
        unique_id: hottest_temp
        device_class: temperature
        unit_of_measurement: °C
        state: >
          {% set sensors = expand(
            'sensor.hive_heating_reported_current_temp',
            'sensor.hallway_temp',
            'sensor.living_room_temp',
            'sensor.study_temp',
            'sensor.landing_temp',
            'sensor.bedroom_1_temp',
            'sensor.bedroom_2_temp',
            'sensor.bedroom_3_temp')
            %}
          {{ sensors
            | rejectattr('state','in',['unavailable','unknown'])
            | map(attribute='state')
            | map('float')
            | max
            }}

      - name: "Coldest temp"
        unique_id: coldest_temp
        device_class: temperature
        unit_of_measurement: °C
        state: >
          {% set sensors = expand(
            'sensor.hive_heating_reported_current_temp',
            'sensor.hallway_temp',
            'sensor.living_room_temp',
            'sensor.study_temp',
            'sensor.landing_temp',
            'sensor.bedroom_1_temp',
            'sensor.bedroom_2_temp',
            'sensor.bedroom_3_temp')
            %}
          {{ sensors
            | rejectattr('state','in',['unavailable','unknown'])
            | map(attribute='state')
            | map('float')
            | min
            }}

If you want to average 3 temp sensors, you can create another sensor:

      - name: "average thermostat temp"
        unique_id: average_thermostat
        device_class: temperature
        unit_of_measurement: °C
        state: {{ (
                   states('sensor.temp1')|float()
                   + states('sensor.temp2')|float()
                   + states('sensor.temp3')|float()
                   ) / 3 }}

I split it out on multiple lines to make it easier to read. It’ll work on multiple lines or a single line.

you can then set the Hive target temp as follows:

- service: climate.set_temperature
  data_template:
    temperature: "{{ states('sensor.average_thermostat_temp') |float(15) }}"
    entity_id: climate.thermostat

or simply turn the hive on or off dependant on whether that average_thermostat_temp sensor has hit the target you want. So you could create an input number:

input_number:
  hive_heating_target_temp:
    name: "Hive target"
    unit_of_measurement: °C
    min: 5
    max: 15
    step: 0.5
    icon: mdi:thermostat

…and then have an automation that turns the Hive on and off dependent on where sensor.average_thermostat_temp is relative to the input_number. hive_heating_target_temp

I (sort of) do this as a have completely replaced my Hive app with logic in HA. However, I have not replaced the Hive thermostat with my Hue motion sensors.

My Hive thermostat is mobile (I honestly thought they all were), so I simply put it in the room that I want given the time of year (in your case, one of the bedrooms). If yours is fixed, perhaps changing over to the mobile one would be the easiest route?

[edited for typos and clarity]

I already have the hue sensors set up with offsets, did that quite a while back, as well as the average sensor. My issue was with needing a climate entity as I’m working with a blueprint that needs one.
My thermostats are mobile, but as two out of three bedrooms are used year round, as well as having an upstairs bathroom, and another spare bedroom that’s used intermittently, I can’t move around the upstairs thermostat, so the solution is either get more thermostats, or use what I have. I’m pretty happy with my hue sensors though I should check to see if they’ve drifted.

apologies - I misunderstood. I’ve deleted the post to avoid confusing people.

Oh man, there was no need to delete. No such thing as useless information. Restore your post, if you like. Someone else might find it of use. :slight_smile:

1 Like

Done.

[extra text needed in order to post]

2 Likes