wil
(Willi)
January 17, 2025, 8:09am
1
For my PV I want to show and log the isolation resistance of my PV panels.
Unit of measurement of electric resistance is ohm = Ω
I get this value via MQTT (query of node-red using modbus/TCP). I have configured it as the following sensor:
- sensor:
state_topic: "fronius/inverter/isolation_resistance"
name: "Fronius Isolation resistance"
unique_id: "fronius_isolation_resistance"
object_id: "fronius_isolation_resistance"
I did not find any device class that matches resistance. Also I did not find a way to tell HA that this value is a integer value. HA loggs this sensors like it would be a string:
My question: How can I configure the sensor so that HA handles this as a number and not as a string?
tom_l
January 17, 2025, 8:25am
2
Add.a unit of measurement.
unit_of_measurement: "Ω"
Also, to format your config for the forum use the </>
button. Not the quote button.
wil
(Willi)
January 17, 2025, 8:37am
3
Thanks a lot. This works!
When creating a template sensor I can select different units of measurement. But Ω is not part of this.
I did not find this unit_of_measurement. Where do I find the complete list of these?
tom_l
January 17, 2025, 9:13am
4
In the documentation for the integration.
wil
(Willi)
January 17, 2025, 10:54am
5
You mean the MQTT sensor integration? There MQTT Sensor - Home Assistant is no documentation which units are defined.
Or did I look wrong?
tom_l
January 17, 2025, 12:46pm
6
You can use anything you want if you are not using a device class.
https://www.home-assistant.io/integrations/sensor.mqtt/#unit_of_measurement
Only if you use a device class must you pick one of the specified units, see: https://www.home-assistant.io/integrations/sensor#device-class
wil
(Willi)
January 17, 2025, 9:19pm
7
Ok. Thanks.
Does this mean that all undefinded units like “Ω” are handled as integer if I set "unit_of_measurement: " ?
Strange is that that settiing “unit_of_measurement:” to a not defined value behaves different than not setting unit_of_measurement.
tom_l
January 18, 2025, 3:55am
8
Setting any unit of measurement causes the HA frontend to treat it as a number.
wil
(Willi)
January 18, 2025, 12:19pm
9
OK. Thanks. This is the trick. “Ω” is not defined as a unit_of_measurement, but setting it just treats the value as a number.