From 8fe79a88cac2dda16e77dff52849216c62148e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C4=8Cerm=C3=A1k?= Date: Thu, 27 Nov 2025 12:24:28 +0100 Subject: [PATCH] Fix state classes of Ecowitt rain sensors (#157409) --- homeassistant/components/ecowitt/sensor.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/ecowitt/sensor.py b/homeassistant/components/ecowitt/sensor.py index 8cbdafd9f87..5044dd44155 100644 --- a/homeassistant/components/ecowitt/sensor.py +++ b/homeassistant/components/ecowitt/sensor.py @@ -285,16 +285,14 @@ async def async_setup_entry( name=sensor.name, ) - # Hourly rain doesn't reset to fixed hours, it must be measurement state classes + # Only total rain needs state class for long-term statistics if sensor.key in ( - "hrain_piezomm", - "hrain_piezo", - "hourlyrainmm", - "hourlyrainin", + "totalrainin", + "totalrainmm", ): description = dataclasses.replace( description, - state_class=SensorStateClass.MEASUREMENT, + state_class=SensorStateClass.TOTAL_INCREASING, ) async_add_entities([EcowittSensorEntity(sensor, description)])