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

Ledvance Planon: control the lights through dp 51

dp 51 seems to be how the app controls the lights, so use that.
Since it is optional, keep the standard light dps as backups for displaying
the current value.

Issue #2683
Jason Rumney пре 1 година
родитељ
комит
78778bfa2a
1 измењених фајлова са 82 додато и 2 уклоњено
  1. 82 2
      custom_components/tuya_local/devices/ledvance_smart_plabl100x25b.yaml

+ 82 - 2
custom_components/tuya_local/devices/ledvance_smart_plabl100x25b.yaml

@@ -5,22 +5,49 @@ products:
     model: Smart+ Planon plus backlight
     model_id: BL100x25B
 entities:
+  - entity: switch
+    icon: "mdi:lightbulb-multiple"
+    dps:
+      - id: 20
+        type: boolean
+        name: switch
+
   - entity: light
     dps:
       - id: 20
         type: boolean
+        name: available
+      - id: 51
+        type: base64
+        mask: "000200000000000000000000"
+        optional: true
         name: switch
+        mapping:
+          - dps_val: null
+            value_mirror: available
       - id: 21
         type: string
+        optional: true
         name: work_mode
       - id: 22
-        name: brightness
+        name: standard_brightness
         type: integer
         range:
           min: 0
           max: 1000
+      - id: 51
+        type: base64
+        mask: "0000000000000000FFFF0000"
+        optional: true
+        name: brightness
+        mapping:
+          - dps_val: null
+            value_mirror: standard_brightness
+        range:
+          min: 0
+          max: 1000
       - id: 23
-        name: color_temp
+        name: std_color_temp
         type: integer
         range:
           min: 0
@@ -29,20 +56,67 @@ entities:
           - target_range:
               min: 2700
               max: 6500
+      - id: 51
+        type: base64
+        mask: "00000000000000000000FFFF"
+        optional: true
+        name: color_temp
+        mapping:
+          - dps_val: null
+            value_mirror: standard_brightness
+        range:
+          min: 0
+          max: 1000
+        mapping:
+          - target_range:
+              min: 2700
+              max: 6500
   - entity: light
     translation_key: backlight
     dps:
       - id: 20
         type: boolean
+        name: available
+      - id: 51
+        type: base64
+        mask: "000100000000000000000000"
+        optional: true
         name: switch
+        mapping:
+          - dps_val: null
+            value_mirror: available
       - id: 21
         type: string
+        optional: true
         name: work_mode
       - id: 24
         type: hex
+        name: std_rgbhsv
+        optional: true
+        format:
+          - name: h
+            bytes: 2
+            range:
+              min: 0
+              max: 360
+          - name: s
+            bytes: 2
+            range:
+              min: 0
+              max: 1000
+          - name: v
+            bytes: 2
+            range:
+              min: 0
+              max: 1000
+      - id: 51
+        type: base64
+        optional: true
         name: rgbhsv
         optional: true
         format:
+          - name: x
+            bytes: 2
           - name: h
             bytes: 2
             range:
@@ -58,6 +132,12 @@ entities:
             range:
               min: 0
               max: 1000
+          - name: w
+            bytes: 2
+          - name: c
+        mapping:
+          - dps_val: null
+            value_mirror: std_rgb
   - entity: number
     translation_key: timer
     class: duration