Help with adjusting temperature sensor!

not true, some devices auto assign sensor names and this is one of them. The unfortunate thing here is that you cannot use the direct access to the state machine objects when the object_id starts with a number. He’ll have to use the states method.

{{ states('sensor.0x286d970001010cd0_temperature') | float - 3.2 }}
1 Like

I’ve just got a Moes Zigbee thermostatic radiator valve (TRV). I use ZHA to manage the zigbee devices on my network. The TRV is reporting the temperature correctly but it is setting the temperature x10 in the TRV compared to the temperature in HA. The image below illustrates it:
Capture

The temperature in the room is correctly 20 but the target temperature in the TRV is 52, not 5.2 as shown in HA.

Can I use the techniques described in here to correct the set point? What would I have to do? What platform: should I use? Where should it go, in what file?

Thanks

Thanks, needed this too!

In case anyone else is interested, I’ve explained the workaround I’ve implemented below. However, I still would prefer to fix the problem at source but I’ve no idea how.

First, I’ve configured a few templates as follows so I have the right values and with easy to remember names. Note the “* 10” to get the right set value from the trvs.

- platform: template
  sensors:
    rad_1_setting:
      friendly_name: "Radiator 1 setting"
      icon_template: mdi:thermostat
      unit_of_measurement: '°C'
      value_template: "{{ state_attr('climate.tzeyyycfe_thermostat', 'temperature') * 10 }}"
    rad_1_temp:
      friendly_name: "Radiator 1 temperature"
      icon_template: mdi:thermometer
      unit_of_measurement: '°C'
      value_template: "{{ state_attr('climate.tzeyyycfe_thermostat', 'current_temperature') }}"
    rad_2_setting:
      friendly_name: "Radiator 2 setting"
      icon_template: mdi:thermostat
      unit_of_measurement: '°C'
      value_template: "{{ state_attr('climate.tzexxxa6fe_thermostat', 'temperature') * 10 }}"
    rad_2_temp:
      friendly_name: "Radiator 2 temperature"
      icon_template: mdi:thermometer
      unit_of_measurement: '°C'
      value_template: "{{ state_attr('climate.tzexxxa6fe_thermostat', 'current_temperature') }}"

I use node red and use service calls to set the trv temperature. Fortunately, there’s no limit on the setting so I can set them to, say, 2 deg, which becomes 20 deg at the trv. One is in my study, one in the bedroom. So I set the study one to 20 deg during the weekdays, and 12 otherwise. The bedroom trv I set 20 early morning and late evening, 12 otherwise.

However, to see the setting and to override them, I use a grid card with two button cards, that call a service to set the trvs to set low and high temperatures, and two gauge cards to show the setting and reading. The gauge cards use the sensors I’ve set up above. This is what they look like (I need to understand how to theme them to make them look better):

Hope this is useful. Any better ideas welcome.

1 Like

I have the same problem, but in my case the Thermostat connected with MODBUS and coefficient that should be applied to value is 5.
So 20.5 C at Thermostat shown as 4.1 C at home assistant.
Read setpoint: 4.1 * 5 = 20.5 C
Set setpoint: 20.5 / 5 = 4.1 C

Is it possible to have TWO coefficients: one for read value, one for set value back?

Thanx!

I set up templates for both the reading and the setting. I only needed a factor (x10 in my case) for the setting but you could use a different factor for the reading. But remember, if you do anything to, say, set the temperature using automations or lovelace, you’ll have to use the raw values.

In the unlikely even anyone is following my ramblings, it looks like recent HA updates have resolved this issue and now the temperature readings and settings are correct.

Wrote this in yaml:

dallas:
  pin: 13
  update_interval: 10s

sensor:
  - platform: dallas
    address: 0x3xxxxxxxxxx2ef28
    name: "Temp Vardagsrum"
    filters:
    - offset: -8.0
2 Likes

What i missed?
I edited /config/configuration.yaml as following:

# Sensor calibration
sensors:
  termometru_afara:
    friendly_name: Termometru Afara
    unit_of_measurement: "°C"
    value_template: '{{((sensor.termometru_afara_temperature)-2)|round(1)}}'

I am using sonoff zigbee temperature sensor connected to tasmotized sonoff zigbee bridge.
Entity ID: sensor.termometru_afara_temperature

The result:

Configuration invalid!
Integration error: sensors - Integration ‘sensors’ not found.

@samybalasa
You mixed it up. Use sensor: instead of sensors:

Try this for the value_template:

value_template: ‘{{ (states(‘sensor.termometru_afara_temperature’) | float(0) - 2 ) | round(1) }}’

Invalid config for [sensor]: required key not provided @ data[‘platform’]. Got None. (See /config/configuration.yaml, line 85).

The line 85 is the first one

sensor:
 termometru_afara:
  friendly_name: "Termometru Afara"
  icon_template: mdi:thermometer
  unit_of_measurement: '°C'
  value_template: ‘{{ (states(‘sensor.termometru_afara_temperature’) | float(0) - 2 ) | round(1) }}’

still not working…

Try a simple version first which will hopefully work and then add elements you need to do your conversion. An example I have that works is:

value_template: "{{ state_attr('climate.blah_blah_thermostat', 'temperature') * 10 }}"

Oh, and if you’re not aware, the easiest way of testing these is in Developer Tools > Template.

1 Like

Looks like you use the wrong quotation marks and indent. Try something like this (new template format!):

template:
  - sensor:
      - name: "Termometru Afara"
        unique_id: termometru_afara
        unit_of_measurement: "°C"
        state_class: measurement
        icon: mdi:thermometer
        state: "{{ (states('sensor.termometru_afara_temperature') | float(0) - 2.0 ) | round(2) }}"
1 Like

It works, man, thank you !!!

1 Like

in my case in the configuration.yaml for a luftdaten sensor i swapped them of place
value_template: “{{ value_json.sensordatavalues[0].value | round(2) | float(0) - 12 }}”

it didnt take the config as correct with float in front of round, this for a negative12° correction