Просмотр исходного кода

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 год назад
Родитель
Сommit
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:
 primary_entity:
-  entity: switch
+  entity: fan
+  translation_key: fan_with_presets
   icon: "mdi:air-purifier"
   icon: "mdi:air-purifier"
   dps:
   dps:
     - id: 1
     - id: 1
       type: boolean
       type: boolean
       name: switch
       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:
 secondary_entities:
+  - entity: switch
+    deprecated: fan
+    icon: "mdi:air-purifier"
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
   - entity: sensor
   - entity: sensor
     name: Active filter life
     name: Active filter life
     icon: "mdi:air-filter"
     icon: "mdi:air-filter"
@@ -79,7 +99,7 @@ secondary_entities:
       - id: 19
       - id: 19
         type: integer
         type: integer
         name: sensor
         name: sensor
-        unit: "min"
+        unit: min
   - entity: sensor
   - entity: sensor
     class: pm25
     class: pm25
     dps:
     dps:
@@ -96,16 +116,17 @@ secondary_entities:
         name: sensor
         name: sensor
   - entity: select
   - entity: select
     name: Mode
     name: Mode
+    deprecated: fan
     dps:
     dps:
       - id: 3
       - id: 3
         name: option
         name: option
         type: string
         type: string
         mapping:
         mapping:
           - dps_val: auto
           - 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