I’ve configure a utility_meter
to fetch data from a sensor. This sensor is setup via MQTT using Home Assistant’s “MQTT Discovery” feature*
The sensor reports its unit_of_measurement
as “kWh”. The configuration works fine so far and I assume the unit of the utility meter is supposed to be copied from unit_of_measurement
of the source
-sensor. However, no unit is displayed in the corresponding card.
Here’s my configuration:
utility_meter:
fernwaerme_monthly:
source: sensor.zahlerstand_fernwarme
cycle: monthly
fernwaerme_yearly:
source: sensor.zahlerstand_fernwarme
cycle: yearly
Not sure if this is relevant, but the unit also correctly shows up in statistics_meta
:
homeassistant=# select * from statistics_meta where id in (20,21);
id | statistic_id | source | unit_of_measurement | has_mean | has_sum
----+---------------------------+----------+---------------------+----------+---------
20 | sensor.fernwaerme_yearly | recorder | kWh | f | t
21 | sensor.fernwaerme_monthly | recorder | kWh | f | t
(2 rows)
Same goes for the attribute in states
:
homeassistant=# select state_id, state, old_state_id, created, attributes from states where entity_id like '%zahlerstand_fern%' order by created desc limit 1;
state_id | state | old_state_id | created | attributes
----------+---------+--------------+-------------------------------+---------------------------------------------------------------------------------------------------------
4842565 | 42701.0 | 4842549 | 2021-10-18 19:29:53.122383+00 | {"unit_of_measurement":"kWh","friendly_name":"Z\u00e4hlerstand Fernw\u00e4rme","device_class":"energy"}
(1 row)
*I’ve written a Python script to read data from a Landis+Gyr T550 (i.e. Siemens UH 50) and create MQTT messages suited for Home Assistant, see https://github.com/peletiah/t550-mqtt