Nythbran23
(Nythbran23)
September 10, 2024, 7:03am
1
I want to plot two temperatures on one graph and then probably go on from there to plot only the diffference between the two.
One is a standard °C entity.
The other is coming from Modbus (PMG_TEMP) where they only accept C as the unit of measurement.
I was thinking I could add a template something like below to convert C to °C but this does not seem to work - any ideas please:
- name: "Turbine Temperature (°C)"
unit_of_measurement: "°C"
device_class: "temperature"
state_class: "measurement"
state: "{states('sensor.PMG_TEMP')}"
francisp
(Francis)
September 10, 2024, 7:10am
2
Create a template helper like this:
apreick
September 10, 2024, 7:21am
3
Nythbran23:
C to °C
use
unit_of_measurement: ‘°C’
not „“
Nythbran23
(Nythbran23)
September 10, 2024, 7:34am
4
I now have this but is is not working:
- name: "Turbine Temperature (°C)"
unit_of_measurement: '°C'
device_class: "temperature"
state_class: "measurement"
state: "{{states('sensor.PMG_TEMP') | float(0)}}}"
tom_l
September 10, 2024, 7:46am
6
You don’t need a template sensor for this.
Use manual customization . e.g.
configuration.yaml
homeassistant:
customize:
sensor.pmg_temp:
unit_of_measurement: "°C"
Also the reason your template sensors are not working is because you are using capital letters in your entity id. Entity ids are always lower case.
Nythbran23
(Nythbran23)
September 10, 2024, 7:46am
7
Of course - thank you - now running - excellent
Thanks all!
Nythbran23
(Nythbran23)
September 10, 2024, 7:50am
8
Final yaml:
- name: "Turbine Temperature (°C)"
unit_of_measurement: '°C'
device_class: "temperature"
state_class: "measurement"
state: "{{states('sensor.PMG_TEMP') | float(0)}}"
tom_l
September 10, 2024, 12:41pm
9
As I said, you do not need another entity for this. You can change the unit of the original sensor.