Explorar el Código

smartplugv2_energyv2: add Light mode, make some optional

- Improve compatibility by making test_bit and random_timer optional.
- Make unknown_41 child lock, as this has been observed on multiple devices now.
- add optional Light mode on dp 40, which seems common (also in other configs).

With these changes, this config is a 100% match for the RDCBC energy
monitor switch module in PR #599, which avoids creating another new config
for a fairly standard smartswitch dps layout.
Jason Rumney hace 2 años
padre
commit
7b0e4b6b17
Se han modificado 1 ficheros con 26 adiciones y 3 borrados
  1. 26 3
      custom_components/tuya_local/devices/smartplugv2_energyv2.yaml

+ 26 - 3
custom_components/tuya_local/devices/smartplugv2_energyv2.yaml

@@ -9,15 +9,14 @@ primary_entity:
     - id: 21
       type: integer
       name: test_bit
+      optional: true
     - id: 26
       type: bitfield
       name: fault_code
-    - id: 41
-      type: boolean
-      name: unknown_41
     - id: 42
       type: string
       name: random_timer
+      optional: true
 secondary_entities:
   - entity: number
     category: config
@@ -118,4 +117,28 @@ secondary_entities:
             value: "Off"
           - dps_val: memory
             value: "Last State"
+  - entity: lock
+    name: Child lock
+    icon: "mdi:hand-back-right-off"
+    category: config
+    dps:
+      - id: 41
+        type: boolean
+        name: lock
+  - entity: select
+    name: Light mode
+    icon: "mdi:television-ambient-light"
+    category: config
+    dps:
+      - id: 40
+        type: string
+        name: option
+        optional: true
+        mapping:
+          - dps_val: relay 
+            value: State
+          - dps_val: pos
+            value: Position
+          - dps_val: "on"
+            value: "On"