barleybobs / homeassistant-ecowater-softener

A Homeassistant custom component to integrate Ecowater water softeners
https://github.com/barleybobs/homeassistant-ecowater-softener
MIT License
31 stars 9 forks source link

Entity is using state class 'measurement' which is impossible considering device class ('water') it is using #47

Closed R1DEN closed 7 months ago

R1DEN commented 7 months ago

I have the following warning displayed in my log, so will report it here

Entity sensor.ecowater_acxxxxx_water_available (<class 'custom_components.ecowater_softener.sensor.EcowaterSensor'>) is using state class 'measurement' which is impossible considering device class ('water') it is using; expected None or one of 'total_increasing', 'total'; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/barleybobs/homeassistant-ecowater-softener/issues
BillyFKidney commented 7 months ago

I was receiving the same error:

Logger: homeassistant.components.sensor
Source: components/sensor/__init__.py:528
Integration: Sensor (documentation, issues)
First occurred: 7:44:44 PM (1 occurrences)
Last logged: 7:44:44 PM

Entity sensor.ecowater_err_3700_water_available (<class 'custom_components.ecowater_softener.sensor.EcowaterSensor'>) is using state class 'measurement' which is impossible considering device class ('water') it is using; expected None or one of 'total_increasing', 'total'; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/barleybobs/homeassistant-ecowater-softener/issues

I changed /homeassistant/custom_components/ecowater_softener/sensor.py to contain the following:

SENSOR_TYPES: tuple[EcowaterSensorEntityDescription, ...] = (
    EcowaterSensorEntityDescription(
        key=STATUS,
        name="Status",
        icon="mdi:power",
    ),
    EcowaterSensorEntityDescription(
        key=WATER_AVAILABLE,
        name="Water Available",
        icon="mdi:water",
        device_class=SensorDeviceClass.WATER,
        state_class=SensorStateClass.TOTAL,
barleybobs commented 7 months ago

Fixed in v3.1.0