home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.03k stars 29.69k forks source link

UtilityMeter is using state class 'total' which is impossible considering device class ('volume_storage') #122108

Open ChristophCaina opened 1 month ago

ChristophCaina commented 1 month ago

The problem

I am getting the following warning about some of my UtilityMeter-Helpers and don't see, where I could change the state class...

Logger: homeassistant.components.sensor
Source: components/sensor/__init__.py:560
integration: Sensor (documentation, issues)
First occurred: 2:00:48 AM (3 occurrences)
Last logged: 2:00:48 AM

Entity sensor.olverbrauch_heizung_jahr (<class 'homeassistant.components.utility_meter.sensor.UtilityMeterSensor'>) is using state class 'total' which is impossible considering device class ('volume_storage') it is using; expected None or one of 'measurement'; 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+utility_meter%22

Entity sensor.olverbrauch_heizung_quartal_2 (<class 'homeassistant.components.utility_meter.sensor.UtilityMeterSensor'>) is using state class 'total' which is impossible considering device class ('volume_storage') it is using; expected None or one of 'measurement'; 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+utility_meter%22

Entity sensor.olverbrauch_heizung_monat (<class 'homeassistant.components.utility_meter.sensor.UtilityMeterSensor'>) is using state class 'total' which is impossible considering device class ('volume_storage') it is using; expected None or one of 'measurement'; 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+utility_meter%22

These Utility Meters are using the same source Sensor, which has the State_class "Total Increasing" with device_class: Volume_Storage.

The UI for the Utility Meters does not allow (at first glance) to change the State_class. grafik

The Meters were created via UI (helpers)

What version of Home Assistant Core has the issue?

2024.7.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Utility Meter

Link to integration documentation on our website

https://www.home-assistant.io/integrations/utility_meter/

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

home-assistant[bot] commented 1 month ago

Hey there @dgomes, mind taking a look at this issue as it has been labeled with an integration (utility_meter) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `utility_meter` 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 utility_meter` 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)


utility_meter documentation utility_meter source (message by IssueLinks)

melvinisken commented 3 weeks ago

I experience the same:

Logger: homeassistant.components.sensor Source: components/sensor/init.py:569 integration: Sensor (documentation, issues) First occurred: 4:32:53 PM (2 occurrences) Last logged: 4:32:53 PM Entity sensor.pv2_daily_production_um (<class 'homeassistant.components.utility_meter.sensor.UtilityMeterSensor'>) is using state class 'total_increasing' which is impossible considering device class ('power') it is using; expected None or one of 'measurement'; 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+utility_meter%22 Entity sensor.pv2_daily_load_um (<class 'homeassistant.components.utility_meter.sensor.UtilityMeterSensor'>) is using state class 'total_increasing' which is impossible considering device class ('power') it is using; expected None or one of 'measurement'; 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+utility_meter%22

dgomes commented 3 weeks ago

not the same issue I'm afraid. But can both of you provide the diagnostic file available on the utility_meter device webpage ?

melvinisken commented 3 weeks ago

I'm sorry, I'm quite new to HA, how do I get it? I didn't find any device webpage related to utility meter..

dgomes commented 3 weeks ago

Settings -> Devices & Services -> Devices

search for the device associated to the utility_meter

On the "Device Info" you will find an option to download the diagnostic of the utility_meter (might need to click the 3 dots)

melvinisken commented 3 weeks ago

Found it. I have two sensors I created to calculate daily production of solar power (and it seems those do not work correctly yet, so I also might have misconfigured them). config_entry-utility_meter-01J4S5GN4NRGWD7KSPK4R4PZCS.json config_entry-utility_meter-01J4S5QHWF5PP61K4MQDY096ET.json

I have the problem that the sensor creates huge spikes: grafik The daily production should be around 4kWh (it seems the sensors counts that somehow correctly) but at some points in time, it jumps to thousands of kWh...

dgomes commented 3 weeks ago

@melvinisken your sources have unit of measurement of Watts (that's POWER) utility_meter is to be used with kWh (that's ENERGY)

You need first to convert your sources from power to energy (use the rienman sum integration for that) then you can use the new entity as the source of the utility_meter.

As I said... your problem is unrelated to @ChristophCaina, please create a new issue if necessary after doing the necessary changes.