HandyHat / ha-hildebrandglow-dcc

Home Assistant integration for UK SMETS (Smart) meters pulling data from the DCC via the Hildebrand Glow API
MIT License
233 stars 34 forks source link

HA warning: Entity is using state class 'total_increasing' which is impossible considering device class ('monetary') it is using #304

Open twpol opened 1 year ago

twpol commented 1 year ago

Describe the bug Since upgrading Home Assistant to 2023.2, it now logs this warning about both "cost today" sensors

To Reproduce Steps to reproduce the behaviour:

  1. Run Home Assistant 2023.2
  2. Use this integration (Hildebrand Glow (DCC))
  3. Go to Settings > System > Logs
  4. See warning

Expected behaviour No warning from Home Assistant when using this integration

Screenshots

Logger: homeassistant.components.sensor
Source: components/sensor/__init__.py:503
Integration: Sensor (documentation, issues)
First occurred: 1 February 2023 at 21:17:53 (2 occurrences)
Last logged: 1 February 2023 at 21:17:53

Entity sensor.electric_cost_today (<class 'custom_components.hildebrandglow_dcc.sensor.Cost'>) is using state class 'total_increasing' which is impossible considering device class ('monetary') it is using; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
Entity sensor.gas_cost_today (<class 'custom_components.hildebrandglow_dcc.sensor.Cost'>) is using state class 'total_increasing' which is impossible considering device class ('monetary') it is using; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.

Version Hildebrand Glow (DCC) Integration v1.0.3 Home Assistant 2023.2.0 Supervisor 2023.01.1 Operating System 9.5 Frontend 20230201.0 - latest

Debug log Does not seem relevant here

Additional context Add any other context about the problem here.

MadGodNerevar commented 1 year ago

i would like to mention that i got a similar issue

Logger: homeassistant.components.sensor Source: components/sensor/init.py:503 Integration: Sensor (documentation, issues) First occurred: 17:37:02 (1 occurrences) Last logged: 17:37:02

Entity sensor.dcc_sourced_smart_electricity_meter_cost_today (<class 'custom_components.hildebrandglow_dcc.sensor.Cost'>) is using state class 'total_increasing' which is impossible considering device class ('monetary') it is using; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.

Scoff123 commented 1 year ago

Yes also seeing this as soon as I updated to Home Assistant 2023.2:

Entity sensor.electric_cost_today (<class 'custom_components.hildebrandglow_dcc.sensor.Cost'>) is using state class 'total_increasing' which is impossible considering device class ('monetary') it is using

HandyHat commented 1 year ago

I'm looking into this - for the moment it should be safe to just ignore this

rupisaini commented 1 year ago

I manage to fix the warning my changing

    _attr_state_class = SensorStateClass.TOTAL_INCREASING

to

    _attr_state_class = SensorStateClass.TOTAL

Code where I changed it

class Cost(SensorEntity):
    """Sensor usage for daily cost."""

    _attr_device_class = SensorDeviceClass.MONETARY
    _attr_has_entity_name = True
    _attr_name = "Cost (today)"
    _attr_native_unit_of_measurement = "GBP"
    _attr_state_class = SensorStateClass.TOTAL
    _attr_state_class = SensorStateClass.TOTAL
    _attr_last_reset = None # setting this value when we get reading
cannfoddr commented 1 year ago

I just installed today and am getting the same error, Has the above PR been merged?

Scoff123 commented 9 months ago

@HandyHat Hi, is there any progress with this PR being merged?