From a43d8202dd804ec90a5f8fb12e82f256016bc4e6 Mon Sep 17 00:00:00 2001 From: schizza Date: Mon, 27 Oct 2025 08:12:26 +0100 Subject: [PATCH] Corrects wind direction sensor state class Updates the wind direction sensor to use `MEASUREMENT_ANGLE` state class for proper representation in Home Assistant. This ensures correct interpretation of wind direction as an angle. --- custom_components/sws12500/sensors_weather.py | 3 ++- custom_components/sws12500/sensors_wslink.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/custom_components/sws12500/sensors_weather.py b/custom_components/sws12500/sensors_weather.py index a70309c..bb23027 100644 --- a/custom_components/sws12500/sensors_weather.py +++ b/custom_components/sws12500/sensors_weather.py @@ -122,7 +122,8 @@ SENSOR_TYPES_WEATHER_API: tuple[WeatherSensorEntityDescription, ...] = ( WeatherSensorEntityDescription( key=WIND_DIR, native_unit_of_measurement=DEGREE, - state_class=SensorStateClass.MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT_ANGLE, + device_class=SensorDeviceClass.WIND_DIRECTION, suggested_display_precision=None, icon="mdi:sign-direction", translation_key=WIND_DIR, diff --git a/custom_components/sws12500/sensors_wslink.py b/custom_components/sws12500/sensors_wslink.py index 43ff151..0f70d54 100644 --- a/custom_components/sws12500/sensors_wslink.py +++ b/custom_components/sws12500/sensors_wslink.py @@ -132,7 +132,7 @@ SENSOR_TYPES_WSLINK: tuple[WeatherSensorEntityDescription, ...] = ( WeatherSensorEntityDescription( key=WIND_DIR, native_unit_of_measurement=DEGREE, - state_class=None, + state_class=SensorStateClass.MEASUREMENT_ANGLE, device_class=SensorDeviceClass.WIND_DIRECTION, suggested_display_precision=None, icon="mdi:sign-direction",