If I change the units on a gauge showing a temperature, a calculation using the gauge’s value uses the new value from the changed display without respect for the units. What am I doing wrong? The sensor and template sensor definitions are also included.
Change the inlet temperature units to F, note the Delta T gauge:
from configuration.yaml…
‘’’
- name: "cx_delta_t"
unique_id: cx_delta_t
state_class: measurement
unit_of_measurement: °C"
state: >
{% set hp_outlet_temp = states('sensor.cx50_outlet_water_temp') | float %}
{% set hp_inlet_temp = states('sensor.cx50_inlet_water_temp') | float %}
{% set hp_delta_t = hp_outlet_temp - hp_inlet_temp | float %}
{{ hp_delta_t | round(1, default=0) }}
'''
from modbus.yaml...
'''
- name: "CX50 Outlet Water Temp"
unique_id: "cx50_outlet_water_temp"
state_class: measurement
device_class: temperature
unit_of_measurement: "°C"
scale: 0.1
input_type: holding
address: 205
slave: 1
precision: 1
- name: "CX50 Inlet Water Temp"
unique_id: "cx50_inlet_water_temp"
state_class: measurement
device_class: temperature
unit_of_measurement: "°C"
scale: 0.1
input_type: holding
address: 281
slave: 1
precision: 1
'''