ソースを参照

Add missing/broken entities to weather station (#3963)

* Add missing/broken entities to weather station

Adding missing/broken entities to weather station like wind direction and outdoor battery. Also cleaned the weather station entities, so that entities are in correct categories.

* Update on fixes

Simplify battery entity. Add correct scaling to real-time wind speed

* rework (immax_neolite_weatherstation): revert yaml tag addition

- revert device_config.py changes to add cutoff_mask tag and latin1b64 type
- convert remaining cutoff_mask to use mask
- use numeric representation of wind direction from binary data to avoid weird latin1b64 encoded text that is null padded and centered in the 5 byte field
- revert swapping of battery sensors to avoid breaking other users' configs

PR #3963

* feat (immax_neolite_weatherstation): add access to raw value for masked fields

Wind direction and Outdoor battery are now extracted from the binary fields, but there was other data bundled in with them. Retain attributes giving access to the raw data in case a user wants the extra data.
- wind direction seems to be encoded as 5 bytes text name, 2 bytes numeric angle (used in the sensor), 2 bytes unknown
- outdoor battery seems to be 1 byte flags?, 1 byte percentage (used in sensor), 30 bytes unknown (provision for more sensors?)

---------

Co-authored-by: Jason Rumney <jasonrumney@gmail.com>
Co-authored-by: Jason Rumney <make-all@users.noreply.github.com>
Taneli Veistinen 7 ヶ月 前
コミット
836f225364

+ 23 - 17
custom_components/tuya_local/devices/immax_neolite_weatherstation.yaml

@@ -6,6 +6,9 @@ products:
   - id: 6cwineqz1ndjmuee
   - id: 6cwineqz1ndjmuee
     manufacturer: Immax
     manufacturer: Immax
     model: Neo Lite Smart professional 7-in-1
     model: Neo Lite Smart professional 7-in-1
+  - id: pj4qomlesttsisgi
+    manufacturer: Horisont
+    model: Pro-5 WIFI Weather Station
 entities:
 entities:
   - entity: sensor
   - entity: sensor
     name: Indoor temperature
     name: Indoor temperature
@@ -29,6 +32,7 @@ entities:
         class: measurement
         class: measurement
   - entity: sensor
   - entity: sensor
     class: battery
     class: battery
+    category: diagnostic
     dps:
     dps:
       - id: 4
       - id: 4
         type: integer
         type: integer
@@ -159,7 +163,6 @@ entities:
   - entity: sensor
   - entity: sensor
     name: Remote humidity 1
     name: Remote humidity 1
     class: humidity
     class: humidity
-    category: diagnostic
     hidden: unavailable
     hidden: unavailable
     dps:
     dps:
       - id: 41
       - id: 41
@@ -200,7 +203,6 @@ entities:
   - entity: sensor
   - entity: sensor
     name: Remote humidity 2
     name: Remote humidity 2
     class: humidity
     class: humidity
-    category: diagnostic
     hidden: unavailable
     hidden: unavailable
     dps:
     dps:
       - id: 43
       - id: 43
@@ -241,7 +243,6 @@ entities:
   - entity: sensor
   - entity: sensor
     name: Remote humidity 3
     name: Remote humidity 3
     class: humidity
     class: humidity
-    category: diagnostic
     hidden: unavailable
     hidden: unavailable
     dps:
     dps:
       - id: 45
       - id: 45
@@ -317,7 +318,7 @@ entities:
           - scale: 10
           - scale: 10
   - entity: sensor
   - entity: sensor
     name: UV index
     name: UV index
-    category: diagnostic
+    icon: "mdi:sun-wireless"
     dps:
     dps:
       - id: 62
       - id: 62
         type: integer
         type: integer
@@ -326,7 +327,6 @@ entities:
   - entity: sensor
   - entity: sensor
     name: Dew point
     name: Dew point
     class: temperature
     class: temperature
-    category: diagnostic
     dps:
     dps:
       - id: 64
       - id: 64
         type: integer
         type: integer
@@ -338,7 +338,6 @@ entities:
   - entity: sensor
   - entity: sensor
     name: Feels like
     name: Feels like
     class: temperature
     class: temperature
-    category: diagnostic
     dps:
     dps:
       - id: 65
       - id: 65
         type: integer
         type: integer
@@ -350,7 +349,6 @@ entities:
   - entity: sensor
   - entity: sensor
     name: Heat index
     name: Heat index
     class: temperature
     class: temperature
-    category: diagnostic
     dps:
     dps:
       - id: 66
       - id: 66
         type: integer
         type: integer
@@ -362,7 +360,6 @@ entities:
   - entity: sensor
   - entity: sensor
     name: Windchill index
     name: Windchill index
     class: temperature
     class: temperature
-    category: diagnostic
     dps:
     dps:
       - id: 67
       - id: 67
         type: integer
         type: integer
@@ -433,14 +430,18 @@ entities:
           - dps_val: angle
           - dps_val: angle
             value: Compass angle
             value: Compass angle
   - entity: sensor
   - entity: sensor
-    name: Power status
+    name: Outdoor battery
+    class: battery
     category: diagnostic
     category: diagnostic
-    hidden: true
     dps:
     dps:
       - id: 113
       - id: 113
         type: base64
         type: base64
-        optional: true
+        mask: "00FF000000000000000000000000000000000000000000000000000000000000"
+        unit: "%"
         name: sensor
         name: sensor
+      - id: 113
+        type: base64
+        name: raw_data
   - entity: text
   - entity: text
     name: Backlight
     name: Backlight
     category: config
     category: config
@@ -463,7 +464,6 @@ entities:
   - entity: sensor
   - entity: sensor
     name: Last rainfall
     name: Last rainfall
     class: precipitation
     class: precipitation
-    category: diagnostic
     dps:
     dps:
       - id: 127
       - id: 127
         type: integer
         type: integer
@@ -475,20 +475,27 @@ entities:
   - entity: sensor
   - entity: sensor
     name: Real-time wind speed
     name: Real-time wind speed
     class: wind_speed
     class: wind_speed
-    category: diagnostic
     dps:
     dps:
       - id: 131
       - id: 131
         type: integer
         type: integer
         name: sensor
         name: sensor
         unit: km/h
         unit: km/h
         class: measurement
         class: measurement
+        mapping:
+          - scale: 10
+  - entity: sensor
+    class: wind_direction
+    dps:
       - id: 134
       - id: 134
         type: base64
         type: base64
-        optional: true
-        name: direction_data
+        name: sensor
+        mask: "0000000000FFFF0000"
+        unit: °
+      - id: 134
+        type: base64
+        name: raw_data
   - entity: sensor
   - entity: sensor
     class: illuminance
     class: illuminance
-    category: diagnostic
     dps:
     dps:
       - id: 135
       - id: 135
         type: integer
         type: integer
@@ -500,7 +507,6 @@ entities:
   - entity: sensor
   - entity: sensor
     name: Sunlight
     name: Sunlight
     class: duration
     class: duration
-    category: diagnostic
     dps:
     dps:
       - id: 137
       - id: 137
         type: integer
         type: integer