Group Entry Unit

I have multiple group entries summing multiple values. It was working well for long time, but today i found that some of thesse entries lost there unit.

I did not manage to find which update broke this :disappointed_relieved:

For exemple.
This group entry sum 2 values this the same unit kWh, but the resulting value have not unit. Few month ago it was working well.

Did anyone notice something like this ? How to force a unit to an entry ?

I have the same problem and I want to avoid duplicating the group’s functionality with a template sensor adding the group members with a template.

I noticed that the “unit_of_measurement” is missing with the group sum where I add up the energy consumption of the devices to get a total value for some specific area, such as “Kitchen Total”, “Workshop Total”, Light Total, “HVAC Total”

Example yaml for hvac total:

state_class: total_increasing
entity_id:
  - sensor.vaillant_dnevna_potrosnja_dnevna
  - sensor.vaillant_dnevna_potrosnja_nocna
device_class: energy
friendly_name: Vaillant - dnevna potroĆĄnja Total

Then I open those sum group options, change some value, like “Ignore non-numeric” and after saving “unit_of_measurement” is returned back and it stays there for a while (didn’t figure out what the trigger is for removal)

state_class: total_increasing
device_class: energy
friendly_name: Vaillant - dnevna potroĆĄnja Total
entity_id:
  - sensor.vaillant_dnevna_potrosnja_dnevna
  - sensor.vaillant_dnevna_potrosnja_nocna
unit_of_measurement: kWh

The same happens with all the groups I have where I add up the kWh from several devices to get the total daily consumption.

Just a quick update, the unit of measurement in my case is lost after every restart of HomeAssistant.

1 Like

Same here after every HA restart since 2024.2, for my groups summing Riemann integrations or utility meters. Not for group summing plain sensor entities. Need to change something on the group, flip “Ignore non-numeric"to get unit back.

I am also losing data in statistics until the I manually update the group. Also see Sensor group with sum does not consistently add unit · Issue #114835 · home-assistant/core · GitHub.

Logfile shows

2024-05-24 09:26:02.870 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.envoy_no_dagproductie (<class 'homeassistant.components.group.sensor.SensorGroup'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('energy') it is using; expected one of ['kWh', 'Wh', 'MWh', 'GJ', 'MJ']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+group%22

and

2024-05-24 09:26:08.627 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.envoy_no_dagproductie (None) cannot be converted to the unit of previously compiled statistics (kWh). Generation of long term statistics will be suppressed unless the unit changes back to kWh or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this

For my case the issue started with 2024.2.0b1 for the summing of riemann integrations and 2024.3.0b1 for summing utility meters.

For workaround for now I’ve implemented an automation triggered by HA start reloading the groups.

1 Like

I confirm that this solution works well.

HA 2024.6.2 has a fix for groups summing rieman integrations or utility_Meters. (PR 119021)

For groups summing other groups the reload is still required using some automation as described. (issue 119427)