Open rgerbranda opened 7 months 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!
(message by CodeOwnersMention)
utility_meter documentation utility_meter source (message by IssueLinks)
I have the exact same problem though despite the warning everything seems to work
Hi @dgomes any ideas? Can this be fixed?
utility_meter simply inherits device_class
from the source sensor...
Not much I can do here...
Hi @frenck @epenet Can you have a look at his issue? You modified this warning in https://github.com/home-assistant/core/pull/87294
I'm confused because the state_class of the source sensor is 'total', not 'total_increasing'
If the state_class of the source sensor is total
, but the state_class of the utility meter sensor is total_increasing
, then it does indicate a problem in utility meter.
I know there were issues a while back, so maybe the utility meter is still using the "old" state_class of the sensor, even if the sensor has since been updated to a new state_class?
device class is updated on every new state update: https://github.com/home-assistant/core/blob/a4e9e4b23badb47c80f29f6b529d8b792fff0018/homeassistant/components/utility_meter/sensor.py#L507
@rgerbranda can you download and share the diagnostic of the utility_meter ?
@dgomes as requested:
{
"home_assistant": {
"installation_type": "Home Assistant Container",
"version": "2024.8.2",
"dev": false,
"hassio": false,
"virtualenv": false,
"python_version": "3.12.4",
"docker": true,
"arch": "aarch64",
"timezone": "Europe/Brussels",
"os_name": "Linux",
"os_version": "6.1.21-v8+",
"run_as_root": true
},
"custom_components": {
"o365": {
"documentation": "https://github.com/RogerSelwyn/O365-HomeAssistant",
"version": "v4.8.4",
"requirements": [
"O365==2.0.36",
"BeautifulSoup4>=4.10.0"
]
},
"hacs": {
"documentation": "https://hacs.xyz/docs/configuration/start",
"version": "2.0.0",
"requirements": [
"aiogithubapi>=22.10.1"
]
}
},
"integration_manifest": {
"domain": "utility_meter",
"name": "Utility Meter",
"codeowners": [
"dgomes"
],
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/utility_meter",
"integration_type": "helper",
"iot_class": "local_push",
"loggers": [
"croniter"
],
"quality_scale": "internal",
"requirements": [
"croniter==2.0.2"
],
"is_built_in": true
},
"setup_times": {
"null": {
"setup": 0.002259249915368855
},
"547547719232": {
"platform_setup": 0.005341731011867523
},
"547547723456": {
"platform_setup": 0.0027571700047701597
},
"547547724160": {
"platform_setup": 0.004717719973996282
},
"547547724928": {
"platform_setup": 0.002422599936835468
},
"547547725760": {
"platform_setup": 0.0044710010988637805
},
"547547808512": {
"platform_setup": 0.007563370047137141
},
"547547809280": {
"platform_setup": 0.006231182953342795
},
"547547810048": {
"platform_setup": 0.009813250042498112
},
"547547810816": {
"platform_setup": 0.009747380972839892
},
"547547811584": {
"platform_setup": 0.002420618082396686
},
"547547812352": {
"platform_setup": 0.0036169548984616995
},
"547547813056": {
"platform_setup": 0.003938415087759495
},
"547547813824": {
"platform_setup": 0.004809589008800685
},
"547547814592": {
"platform_setup": 0.007633147994056344
},
"547547815360": {
"platform_setup": 0.0024592840345576406
},
"547547816128": {
"platform_setup": 0.0034711610060185194
}
},
"data": {
"config_entry": {
"created_at": "2024-08-29T10:19:48.566669+00:00",
"data": {},
"disabled_by": null,
"domain": "utility_meter",
"entry_id": "01J6ETC0YPASGZ7A21TWCSPYCD",
"minor_version": 1,
"modified_at": "2024-08-29T10:19:48.566675+00:00",
"options": {
"name": "zon test",
"source": "sensor.energieproductie_compensation",
"cycle": "daily",
"offset": 0.0,
"tariffs": [],
"net_consumption": false,
"delta_values": false,
"periodically_resetting": true,
"always_available": false
},
"pref_disable_new_entities": false,
"pref_disable_polling": false,
"source": "user",
"title": "zon test",
"unique_id": null,
"version": 2
},
"tariff_sensors": [
{
"name": "zon test",
"entity_id": "sensor.zon_test",
"extra_attributes": {
"status": "collecting",
"last_period": "0",
"last_valid_state": "0.948751999999962",
"last_reset": "2024-08-29T10:19:48.567406+00:00",
"next_reset": "2024-08-30T00:00:00+02:00"
},
"last_sensor_data": null,
"period": "daily",
"cron": "0 0 * * *",
"source": "sensor.energieproductie_compensation"
}
]
}
}
device class is updated on every new state update:
@rgerbranda can you download and share the diagnostic of the utility_meter ?
I think that the bug is in this line of the code:
device class is updated on every new state update: https://github.com/home-assistant/core/blob/a4e9e4b23badb47c80f29f6b529d8b792fff0018/homeassistant/components/utility_meter/sensor.py#L507
@rgerbranda can you download and share the diagnostic of the utility_meter ?
And the state_class, When is that updated?
OK... this a meter it makes sense to always increase... I believe the warning to be wrong for this type of device.
My bill (€/$) will always increase -> total_increasing
I can imagine that you say that the input sensor is always increasing, but the value of the meter returns 0 periodically . So the utillity meter sensor cannot be total_increasing to my opinion.
OK... this a meter it makes sense to always increase... I believe the warning to be wrong for this type of device.
My bill (€/$) will always increase -> total_increasing
Please read https://github.com/home-assistant/core/pull/84402#discussion_r1055343029 It seems that @frenck originally included TOTAL_INCREASING, but then @emontnemery suggested to only have TOTAL
They were open to adding TOTAL_INCREASING at a later stage if the need arose, so maybe you can propose to add it in...
The output of the Utility Meter sensor is not TOTAL_INCREASING , see graph. So it's state class should be TOTAL
OK... this a meter it makes sense to always increase... I believe the warning to be wrong for this type of device. My bill (€/$) will always increase -> total_increasing
Please read #84402 (comment) It seems that @frenck originally included TOTAL_INCREASING, but then @emontnemery suggested to only have TOTAL
They were open to adding TOTAL_INCREASING at a later stage if the need arose, so maybe you can propose to add it in...
If you are monitoring a bank account, the value can decrease...
I get the exact same warning:
Entity sensor.solar_lifetime_amortization_meter (<class 'homeassistant.components.utility_meter.sensor.UtilityMeterSensor'>) is using state class 'total_increasing' which is impossible considering device class ('monetary') it is using; expected None or one of 'total'; 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
This is my meter and its source sensor.
template:
- sensor:
- name: "Solar Accounting Amortization Daily"
unique_id: solar_accounting_amortization_daily
device_class: monetary
unit_of_measurement: "EUR"
icon: mdi:cash-refund
state: >
{{ ... }}
utility_meter:
solar_lifetime_amortization_meter:
unique_id: solar_lifetime_amortization_meter
name: "Solar Lifetime Amortization Meter"
source: sensor.solar_accounting_amortization_daily
My source sensor solar_accounting_amortization_daily
has no state_class
because I don't want to track it in long term statistics. On my utility meter solar_lifetime_amortization_meter
I cannot set any state_class
.
So is the warning a bug or am I missing something?
This is a bug in the code. total_increasing is not possible for this type of sensor. The following lines should be removed: https://github.com/home-assistant/core/blob/a4e9e4b23badb47c80f29f6b529d8b792fff0018/homeassistant/components/utility_meter/sensor.py#L708 https://github.com/home-assistant/core/blob/a4e9e4b23badb47c80f29f6b529d8b792fff0018/homeassistant/components/utility_meter/sensor.py#L709
I also have the same problem, trying to use utilty monitor on my daily cost on bought electricity from grid.
The problem
I have configured Utility Meters using the 'built-in' cost sensors from the energy dashboard.
For example, input sensor:
Utility Meter sensor: see Example YAML snippet
Since a recent update of Home Assistant, it's giving warnings about 'total_increasing'.
What version of Home Assistant Core has the issue?
core-2024.4.3
What was the last working version of Home Assistant Core?
core-2024.3
What type of installation are you running?
Home Assistant Container
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
Anything in the logs that might be useful for us?
Additional information
No response