Skip to content

Commit 8fe79a8

Browse files
authored
Fix state classes of Ecowitt rain sensors (home-assistant#157409)
1 parent 7a32853 commit 8fe79a8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

homeassistant/components/ecowitt/sensor.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,14 @@ def _new_sensor(sensor: EcoWittSensor) -> None:
285285
name=sensor.name,
286286
)
287287

288-
# Hourly rain doesn't reset to fixed hours, it must be measurement state classes
288+
# Only total rain needs state class for long-term statistics
289289
if sensor.key in (
290-
"hrain_piezomm",
291-
"hrain_piezo",
292-
"hourlyrainmm",
293-
"hourlyrainin",
290+
"totalrainin",
291+
"totalrainmm",
294292
):
295293
description = dataclasses.replace(
296294
description,
297-
state_class=SensorStateClass.MEASUREMENT,
295+
state_class=SensorStateClass.TOTAL_INCREASING,
298296
)
299297

300298
async_add_entities([EcowittSensorEntity(sensor, description)])

0 commit comments

Comments
 (0)