فهرست منبع

feat (wind_direction): support the new measurement_angle state class

Around 2025.5 HA quietly introduced a new measurement_angle state
class that is not referenced in the developer blog or release notes,
though documentation changes were submitted in late February well before
the code changes, so it was documented.

HA is raising warnings if measurement is used for wind_direction, so
use the new state class.
Jason Rumney 4 روز پیش
والد
کامیت
827e5891e5

+ 1 - 2
custom_components/tuya_local/devices/README.md

@@ -280,8 +280,7 @@ equivalents, other units are currently ASCII so can be easily entered directly).
 
 
 *Optional.*
 *Optional.*
 
 
-For sensors, this sets the state class of the sensor (measurement, total
-or total_increasing)
+For sensors, this sets the state class of the sensor (`measurement`, `measurement_angle`, `total` or `total_increasing`)
 
 
 
 
 ### `format`
 ### `format`

+ 1 - 1
custom_components/tuya_local/devices/bresser_weather_station.yaml

@@ -339,4 +339,4 @@ entities:
         type: integer
         type: integer
         name: sensor
         name: sensor
         unit: "°"
         unit: "°"
-        class: measurement
+        class: measurement_angle

+ 2 - 2
custom_components/tuya_local/devices/device_config_schema.json

@@ -155,8 +155,8 @@
                                 },
                                 },
                                 "class": {
                                 "class": {
                                     "type": "string",
                                     "type": "string",
-                                    "enum": ["measurement", "total", "total_increasing"],
-                                    "description": "Optional state class for sensor DPs. (e.g., measurement, total, total_increasing)."
+                                    "enum": ["measurement", "measurement_angle", "total", "total_increasing"],
+                                    "description": "Optional state class for sensor DPs. (e.g., measurement, total_increasing)."
                                 },
                                 },
                                 "sensitive": {
                                 "sensitive": {
                                     "type": "boolean",
                                     "type": "boolean",

+ 1 - 0
custom_components/tuya_local/devices/immax_neolite_weatherstation.yaml

@@ -510,6 +510,7 @@ entities:
         name: sensor
         name: sensor
         mask: "0000000000FFFF0000"
         mask: "0000000000FFFF0000"
         unit: °
         unit: °
+        class: measurement_angle
       - id: 134
       - id: 134
         type: base64
         type: base64
         optional: true
         optional: true

+ 1 - 0
custom_components/tuya_local/devices/vevor_yt60307_weather_station.yaml

@@ -114,6 +114,7 @@ entities:
                000000000000000000000000000000000000000000000000\
                000000000000000000000000000000000000000000000000\
                00000000000000000000000000000000000000"
                00000000000000000000000000000000000000"
         unit: °
         unit: °
+        class: measurement_angle
       - id: 113
       - id: 113
         type: base64
         type: base64
         optional: true
         optional: true

+ 1 - 0
tests/test_device_config.py

@@ -102,6 +102,7 @@ DP_SCHEMA = vol.Schema(
         vol.Optional("class"): vol.In(
         vol.Optional("class"): vol.In(
             [
             [
                 "measurement",
                 "measurement",
+                "measurement_angle",
                 "total",
                 "total",
                 "total_increasing",
                 "total_increasing",
             ]
             ]