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

Essentials purifier: combine switch and mode select into a fan entity

This device was the first purifier added, and the connection to fans
was not yet realised, so in review it was missed that the mode select
could be replaced with fan presets.

Issue #2188
Jason Rumney пре 1 година
родитељ
комит
b3bd112c90
1 измењених фајлова са 31 додато и 10 уклоњено
  1. 31 10
      custom_components/tuya_local/devices/essentials_purifier.yaml

+ 31 - 10
custom_components/tuya_local/devices/essentials_purifier.yaml

@@ -1,12 +1,32 @@
-name: Essentials air purifier
+name: Air purifier
 primary_entity:
-  entity: switch
+  entity: fan
+  translation_key: fan_with_presets
   icon: "mdi:air-purifier"
   dps:
     - id: 1
       type: boolean
       name: switch
+    - id: 3
+      name: preset_mode
+      type: string
+      mapping:
+        - dps_val: auto
+          value: smart
+        - dps_val: M
+          value: normal
+        - dps_val: H
+          value: strong
+        - dps_val: sleep
+          value: sleep
 secondary_entities:
+  - entity: switch
+    deprecated: fan
+    icon: "mdi:air-purifier"
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
   - entity: sensor
     name: Active filter life
     icon: "mdi:air-filter"
@@ -79,7 +99,7 @@ secondary_entities:
       - id: 19
         type: integer
         name: sensor
-        unit: "min"
+        unit: min
   - entity: sensor
     class: pm25
     dps:
@@ -96,16 +116,17 @@ secondary_entities:
         name: sensor
   - entity: select
     name: Mode
+    deprecated: fan
     dps:
       - id: 3
         name: option
         type: string
         mapping:
           - dps_val: auto
-            value: "Auto"
-          - dps_val: "M"
-            value: "Medium"
-          - dps_val: "H"
-            value: "High"
-          - dps_val: "sleep"
-            value: "Sleep"
+            value: Auto
+          - dps_val: M
+            value: Medium
+          - dps_val: H
+            value: High
+          - dps_val: sleep
+            value: Sleep