Sfoglia il codice sorgente

Ditua aroma diffuser: make dps optional for compatibility

Sierra Modern Home aroma diffuser has the same iot.tuya.com info as #627
But the log captured from the device is missing some dps (fan speed,
color_mode and on one log the mood lighting select, but on another log that
is there).
Make these optional so the configs match.

There are some inconsistencies though:
  - the cloud API has the same small and large options for fan speed as
    in the existing config.  But the Query Things Data Model data
    (not available for the Ditua model) lists "off", "small" and "big".
    If the latter is correct, it is quite likely correct for the Ditua also.
  - the Sierra Modern Home model lists fault code, countdown and
    countdown_remain dps, which are not in the config.  Fault is indicating
    151 in the first log message (128 + 16 + 4 + 2 + 1), and 0 in the second.
    Countdown is "0" in both, and remain is 0.
    There is no mention of these in the Ditua docs, but no log message
    in the issue to compare.

Issue #1063
Jason Rumney 2 anni fa
parent
commit
5023edf303

+ 63 - 3
custom_components/tuya_local/devices/ditua_dt1522yn_aromadiffuser.yaml

@@ -2,6 +2,8 @@ name: Aroma diffuser
 products:
   - id: 6ASdNwe9IdaewQEl
     name: Ditua DT-1522-YN
+  - id: venoaj75waptukdf
+    name: Sierra Modern Home diffuser
 primary_entity:
   entity: fan
   icon: "mdi:scent"
@@ -12,11 +14,19 @@ primary_entity:
     - id: 103
       type: string
       name: speed
+      optional: true
       mapping:
         - dps_val: small
           value: 50
         - dps_val: large
           value: 100
+        - dps_val: null
+          value: 0
+          hidden: true
+    - id: 12
+      type: bitfield
+      name: fault_code
+      optional: true
 secondary_entities:
   - entity: light
     name: LED
@@ -53,6 +63,7 @@ secondary_entities:
       - id: 109
         type: string
         name: color_mode
+        optional: true
         mapping:
           - dps_val: white
             value: white
@@ -60,6 +71,9 @@ secondary_entities:
             value: rgb
           - dps_val: colourful1
             value: Mood
+          - dps_val: null
+            value: white
+            hidden: true
       - id: 111
         type: integer
         name: brightness
@@ -74,10 +88,56 @@ secondary_entities:
       - id: 110
         type: string
         name: option
+        optional: true
         mapping:
           - dps_val: "1" 
-            value: "Mood 1" 
+            value: "Cycle" 
           - dps_val: "2"
-            value: "Mood 2"
+            value: "Fixed"
           - dps_val: "3"
-            value: "Mood 3"
+            value: "Nightlight"
+  - entity: binary_sensor
+    name: Fault
+    class: problem
+    category: diagnostic
+    dps:
+      - id: 12
+        type: bitfield
+        name: sensor
+        optional: true
+        mapping:
+          - dps_val: 0
+            value: false
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: select
+    name: Timer
+    icon: "mdi:timer"
+    category: config
+    dps:
+      - id: 13
+        type: string
+        name: option
+        optional: true
+        mapping:
+          - dps_val: "0"
+            value: "Off"
+          - dps_val: "1"
+            value: "1 hour"
+          - dps_val: "2"
+            value: "3 hours"
+          - dps_val: "3"
+            value: "6 hours"
+  - entity: sensor
+    name: Time remaining
+    class: duration
+    category: diagnostic
+    dps:
+      - id: 14
+        type: integer
+        name: sensor
+        unit: min
+        optional: true
+
+