From 7582f1e9b4a44bb4f5b2d8ad1b3e21e365548329 Mon Sep 17 00:00:00 2001 From: SchiZzA Date: Mon, 18 May 2026 20:49:01 +0200 Subject: [PATCH] fix: Corrected RAIN and DAILYRAIN for PWS protocol. The `RAININ` suppose to be accumulated rainfall in 60 minutes. So the unit must be in `mm/h` or `in/h`. In the opposite `DAILYRAIN` is rain in the day do far, represented in accumulated `mm` or `in`. --- custom_components/sws12500/manifest.json | 2 +- custom_components/sws12500/sensors_weather.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/custom_components/sws12500/manifest.json b/custom_components/sws12500/manifest.json index f4db27f..6486e0d 100644 --- a/custom_components/sws12500/manifest.json +++ b/custom_components/sws12500/manifest.json @@ -14,6 +14,6 @@ "issue_tracker": "https://github.com/schizza/SWS-12500-custom-component/issues", "requirements": [], "ssdp": [], - "version": "1.8.5", + "version": "1.8.6", "zeroconf": [] } diff --git a/custom_components/sws12500/sensors_weather.py b/custom_components/sws12500/sensors_weather.py index bb23027..19d590e 100644 --- a/custom_components/sws12500/sensors_weather.py +++ b/custom_components/sws12500/sensors_weather.py @@ -139,10 +139,10 @@ SENSOR_TYPES_WEATHER_API: tuple[WeatherSensorEntityDescription, ...] = ( ), WeatherSensorEntityDescription( key=RAIN, - native_unit_of_measurement=UnitOfPrecipitationDepth.INCHES, - device_class=SensorDeviceClass.PRECIPITATION, - state_class=SensorStateClass.TOTAL, - suggested_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, + native_unit_of_measurement=UnitOfVolumetricFlux.INCHES_PER_HOUR, + device_class=SensorDeviceClass.PRECIPITATION_INTENSITY, + state_class=SensorStateClass.MEASUREMENT, + suggested_unit_of_measurement=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR, suggested_display_precision=2, icon="mdi:weather-pouring", translation_key=RAIN, @@ -150,10 +150,10 @@ SENSOR_TYPES_WEATHER_API: tuple[WeatherSensorEntityDescription, ...] = ( ), WeatherSensorEntityDescription( key=DAILY_RAIN, - native_unit_of_measurement=UnitOfVolumetricFlux.INCHES_PER_DAY, + native_unit_of_measurement=UnitOfPrecipitationDepth.INCHES, state_class=SensorStateClass.MEASUREMENT, - device_class=SensorDeviceClass.PRECIPITATION_INTENSITY, - suggested_unit_of_measurement=UnitOfVolumetricFlux.MILLIMETERS_PER_DAY, + device_class=SensorDeviceClass.PRECIPITATION, + suggested_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, suggested_display_precision=2, icon="mdi:weather-pouring", translation_key=DAILY_RAIN,