Explorar o código

Fix linting and refactor to entities

Andreas Koppenhoefer hai 1 ano
pai
achega
3cca92145f

+ 26 - 32
custom_components/tuya_local/devices/ledvance_smart_plabl100x25b.yaml

@@ -5,8 +5,7 @@ products:
 # https://github.com/FlagX/ha-ledvance-tuya-resync-localkey
 # https://github.com/FlagX/ha-ledvance-tuya-resync-localkey
 #
 #
 # https://github.com/rospogrigio/localtuya/wiki/HOWTO-get-a-DPs-dump
 # https://github.com/rospogrigio/localtuya/wiki/HOWTO-get-a-DPs-dump
-#DEBUG:localtuya.pytuya:[bfa...aly] Deciphered data = '{"dps":{"20":false,"22":410,"23":1000,"24":"004803e8018f","26":0,"41":true}}'
-#AVAILABLE DPS ARE [{'20': False, '22': 410, '23': 1000, '24': '004803e8018f', '26': 0, '41': True}]
+#
 #    DPS [20] VALUE [False] on off switch
 #    DPS [20] VALUE [False] on off switch
 #    DPS [21] VALUE [scene] ?
 #    DPS [21] VALUE [scene] ?
 #    DPS [22] VALUE [400] main led brightness
 #    DPS [22] VALUE [400] main led brightness
@@ -14,15 +13,33 @@ products:
 #    DPS [24] VALUE [0136019a0348] rgb led color
 #    DPS [24] VALUE [0136019a0348] rgb led color
 #    DPS [26] VALUE [0] rgb led brightness
 #    DPS [26] VALUE [0] rgb led brightness
 #    DPS [41] VALUE [False] ?
 #    DPS [41] VALUE [False] ?
-primary_entity:
-  entity: switch
-  dps:
-    - id: 20
-      type: boolean
-      name: switch
-secondary_entities:
+entities:
+  - entity: light
+    name: Main LED
+    translation_key: main
+    dps:
+      - id: 20
+        type: boolean
+        name: switch
+      - id: 22
+        name: brightness
+        type: integer
+        range:
+          min: 0
+          max: 1000
+      - id: 23
+        name: color_temp
+        type: integer
+        range:
+          min: 0
+          max: 500
+        mapping:
+          - target_range:
+              min: 2700
+              max: 6500
   - entity: light
   - entity: light
     name: RGB LED
     name: RGB LED
+    translation_key: rgb
     category: config
     category: config
     dps:
     dps:
       - id: 20
       - id: 20
@@ -54,26 +71,3 @@ secondary_entities:
             range:
             range:
               min: 0
               min: 0
               max: 1000
               max: 1000
-  - entity: light
-    name: Main LED
-    category: config
-    dps:
-      - id: 20
-        type: boolean
-        name: switch
-      - id: 22
-        name: brightness
-        type: integer
-        range:
-          min: 0
-          max: 1000
-      - id: 23
-        name: color_temp
-        type: integer
-        range:
-          min: 0
-          max: 500
-        mapping:
-          - target_range:
-              min: 2700
-              max: 6500