core
core copied to clipboard
Unit of measurements is not correct
The problem
Unit of measurements is not correct Unit of measurements °C, °C, °C of input sensors sensor.izone_current_temperature_upstairs, sensor.ble_temperature_upstairs_lounge_ble_climate, sensor.upstairs_climate_display_temperature are not compatible using no device class of sensor group sensor.upstairs_lounge_average_temperature.
Unit of measurements L, L of input sensors sensor.beergarden_garden_tap_total_water_no_cycle_metered, sensor.frontyard_right_side_garden_tap_water_no_cycle_metered are not compatible using no device class of sensor group sensor.total_garden_taps_water_no_cycle_metered.
Please correct the unit of measurements on the source entities or set a proper device class on the sensor group and reload the group sensor to fix this issue.
What version of Home Assistant Core has the issue?
2024.2.0
What was the last working version of Home Assistant Core?
2024.1.5
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Groups
Link to integration documentation on our website
No response
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (group
) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of group
can trigger bot actions by commenting:
-
@home-assistant close
Closes the issue. -
@home-assistant rename Awesome new title
Renames the issue. -
@home-assistant reopen
Reopen the issue. -
@home-assistant unassign group
Removes the current integration label and assignees on the issue, add the integration domain after the command. -
@home-assistant add-label needs-more-information
Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. -
@home-assistant remove-label needs-more-information
Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.
(message by CodeOwnersMention)
group documentation group source (message by IssueLinks)
Occuring, when unit of measurement is defined in the parent sensors and no device_class is available (for example µSv/h for radiation). Unit of measurement is not carried over from parent sensors (all the same unit) to the helper anymore. When using the old "Combine the state of several sensors" helper, the error message does not appear and the unit of measurement is carried over from the parent sensors to the helper.
Experiencing a similar problem with a different warning in the form of
WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.indoor_temperature (<class 'homeassistant.components.group.sensor.SensorGroup'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('temperature') it is using; expected one of ['°F', 'K', '°C'];
So in my case it appears the device_class was maintained but the units of measurement were lost.
~I found that removing and re-adding a group member caused the unit of measurement to be set again.~ Only helped until HA reboots.
Seeing the same error for my cover. I have a sensor how much they are open/closed in % but there is no device class for that.
I did a hard reboot of HA and I think that fixed it, try that everyone
Nothing changed after rebooting.
See @mill1000 and what he did
Negative. Reboot and group re-creation didn't change anything.
Same issue here. I got four different warnings with variations on this, but I was able to fix two by adding a device class for some MQTT temperature sensors in my YAML. It did require a full reboot for them to "take" and the warning to disappear. Still working on the other two.
Issue still present in core 2024.2.1
Same issue here with grouping multiple solar panels, all delivering in 'W'
....not compatible using no device class of sensor group sensor.enphase_garage_power_total.
Please correct the unit of measurements on the source entities or set a proper device class on the sensor group and reload the group sensor to fix this issue.
I cannot set a device class on the group, the choice I have is 'sensor-group' but not more specific. First seen in 2024.2.0 and indeed still present in 2024.2.1
same here: I have a helper sensor.zonenergietotaal; both have a unit_of_measurement: kW the helper gives a total so what is the problem? the helper self has no unit_of_measurement
Unit of measurements is not correct Unit of measurements kW, kW of input sensors sensor.solaredge_current_power_kw, sensor.envoy_121144087692_current_power_production are not compatible using no device class of sensor group sensor.zonenergietotaal
sensor.solaredge_current_power_kw: unit_of_measurement: kW friendly_name: solaredge_current_power_kW
sensor.envoy_121144087692_current_power_production: state_class: measurement unit_of_measurement: kW device_class: power icon: mdi:flash friendly_name: Envoy 121144087692 Current power production
I'm having the same issue with multiple Enphase Envoy solar meters.
Unit of measurements W, W, W of input sensors sensor.envoy_202220107059_current_power_production, sensor.envoy_202317171048_current_power_production, sensor.envoy_202328056209_current_power_production are not compatible using no device class of sensor group sensor.solar_current_power_production.
Please correct the unit of measurements on the source entities or set a proper device class on the sensor group and reload the group sensor to fix this issue.
This is a regression in 2024.2.0 and unchanged in 2024.2.1 .
Same here. Unfortunately there's no such device class like valve...
Unit of measurements %, %, %, %, %, %, %, % of input sensors sensor.knx_heizung_status_stellventil_bad, sensor.knx_heizung_status_stellventil_buero, sensor.knx_heizung_status_stellventil_flur, sensor.knx_heizung_status_stellventil_kinderzimmer_hinten, sensor.knx_heizung_status_stellventil_kueche, sensor.knx_heizung_status_stellventil_wohnbereich, sensor.knx_heizung_status_stellventil_kinderzimmer_vorne, sensor.knx_heizung_status_stellventil_schlafzimmer are not compatible using no device class of sensor group sensor.stellventile_fussbodenheizung_1og.
Please correct the unit of measurements on the source entities or set a proper device class on the sensor group and reload the group sensor to fix this issue.
Similar here for yahoo finance hacs integration:
Unit of measurements USD, GBP, USD, GBP, GBP, GBP of input sensors sensor.yahoofinance_, sensor.yahoofinance_c_l, Sensor.yahoofinance_a, sensor.yahoofinance_f_l, sensor.yahoofinance_h_, sensor.yahoofinance_i_l are not compatible using no device class of sensor group sensor.commodities.
Please correct the unit of measurements on the source entities or set a proper device class on the sensor group and reload the group sensor to fix this issue.
I have redacted the ticker symbol name for privacy
Same with me updated to 2024.3:
Unit of measurements °C, °C, °C, °C, °C, °C, °C, °C of input sensors sensor.temp_e, sensor.temp_j, sensor.temp_s, sensor.temp_office, sensor.temp_n, sensor.temp_master, sensor.atc_d49b84_temperature, sensor.temp_media are not compatible using no device class of sensor group sensor.tempindoor.
Please correct the unit of measurements on the source entities or set a proper device class on the sensor group and reload the group sensor to fix this issue.
If we could add the unit of measurement to the group that would be handy.
Same issue here.
Since there wasn't an option to set the device class in the UI on the Group sensor, I attempted to set the device_class to power
using yaml customize
(Envoy current power production sensors like madbrain76). This does not seem to have done anything, unless perhaps I did it wrong.
same here. all entities have unit "W" which is now lost and even if I try to add it via customize.yaml to the helper sensor it is not added
Oh man I was going to try that next :(
If the parent sensors have a unit of measurement but no device class, you can use the "Combine the state of several sensors" helper. That one keeps the unit of measurement of the parent sensors (if they are all identical) and causes no errors at moment.
Saw https://github.com/home-assistant/core/pull/110181 in the recent release and I was hopeful, ~but it doesn’t seem to have done anything~
Actually my Home Assistant crashed during the update and I didn't notice; I still have not been able to take the update. Was hoping to help test this, but won't be able to until I migrate HA to a new box during the week of 2024-02-26.
@PoppyPop folks with other-than-Enphase sensors are having the same issue. Hopefully that helps them (me as well, thank you!), but there’s definitely a regression in the Group sensor that should be addressed too.
Hello, to be honest, i first tried to correct the goup sensor, i potentially identified the source of the regression.
It seem's that it does not handle correcly sensor with missing device_class, but for the moment i don't have any clues for a good fix. (so fixing the source was easier and the fastest solution in my case).
i don't have time today to check, but wil make a second try tomorow.
Not sure how to understand that: "Source" as in source of the problem or source code? If you were able to update the sensor with a device_class, could you pls tell us how you did that? I have not been able to find such a setting. Thx /F
I don't added a device_class, i choose to make a pull request for an intégration that i use, because it was easier to fix.
@gjohansson-ST you added this commit, can you provide a bit more explanation the bug you would fix ? it seem's that if one sensor in the group has no device_class, it break the unit of measurement.
if the device_class is None, we don't need to control for converters of Units, because it will always return no Units.
Here is a minimal sample to reproduce the error :
template:
- sensor:
- name: "sensor without class"
unit_of_measurement: "W"
state: 53
sensor:
- platform: group
type: last
entities:
- sensor.sensor_without_class
Actually the repair is a bit misleading I see now reading it again.
Unless you manually configure a unit_of_measurement
on your group sensor it will not populate a UoM unless you also have a device class set ( which you can only do in YAML, not from the UI ).
So it's behaving as it's supposed to but again, not being clear on the description of the repair issue.
Anyway we should probably allow to have a calculated UoM if all UoM's on the source entities are the same when not having any device class.