Преглед изворни кода

feat (ble_smart_plant_moisture): add support for SGS02Z

- additional light intensity sensor. PR #4791 by @ameer1234567890
  labelled this as illuminance, but it is not providing a lux
  reading as expected by the HA illuminance class, but a
  qualitative description, so renamed it to avoid confusion.
- qualitative battery status may be missing, so made that optional
  in any case the percentage matches HA's expectation for battery
  sensor, so is the primary sensor for that.
Jason Rumney пре 1 месец
родитељ
комит
20c1af41ec
1 измењених фајлова са 31 додато и 0 уклоњено
  1. 31 0
      custom_components/tuya_local/devices/ble_smart_plant_moisture.yaml

+ 31 - 0
custom_components/tuya_local/devices/ble_smart_plant_moisture.yaml

@@ -2,6 +2,8 @@ name: Moisture sensor
 products:
   - id: gvygg3m8
     model: SGS01
+  - id: nt4pquef
+    model: SGS02Z
 entities:
   - entity: sensor
     name: Soil moisture
@@ -34,6 +36,7 @@ entities:
     dps:
       - id: 14
         type: string
+        optional: true
         name: state
       - id: 15
         type: integer
@@ -77,3 +80,31 @@ entities:
       - id: 9
         type: string
         name: current
+  - entity: sensor
+    name: Light intensity
+    class: enum
+    hidden: unavailable  # only SGS02Z supports this
+    dps:
+      - id: 2
+        type: string
+        optional: true
+        name: sensor
+        mapping:
+          - dps_val: lower
+            value: dark
+          - dps_val: low
+            value: low
+          - dps_val: normal
+            value: normal
+          - dps_val: high
+            value: high
+          - dps_val: higher
+            value: bright
+      - id: 2
+        type: string
+        optional: true
+        name: available
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true