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

AlecoAir D25: code review changes

- Changes to naming to fit HA conventions better
- Remove dynamic icon config, as it messes with themes
- Move speed and swing into a fan entity
- Move current_humidity into the humidifier entity
Jason Rumney 2 лет назад
Родитель
Сommit
37eb380503
1 измененных файлов с 18 добавлено и 83 удалено
  1. 18 83
      custom_components/tuya_local/devices/AlecoAir_D25_Traditio.yaml

+ 18 - 83
custom_components/tuya_local/devices/AlecoAir_D25_Traditio.yaml

@@ -1,4 +1,4 @@
-name: AlecoAir D25
+name: Dehumidifier
 products:
     - id: bf1872f920fbb07813iiwn
       name: AlecoAir D25
@@ -9,13 +9,6 @@ primary_entity:
     - id: 1
       name: switch
       type: boolean
-      mapping:
-        - dps_val: false
-          icon: "mdi:air-humidifier-off"
-          icon_priority: 1
-        - dps_val: true
-          icon: "mdi:air-humidifier"
-          icon_priority: 4
     - id: 2
       name: humidity
       type: integer
@@ -24,38 +17,25 @@ primary_entity:
         max: 80
       mapping:
         - step: 5
-    - id: 4
-      type: string
-      name: speed
-      icon: "mdi:fan"
-      mapping:
-        - dps_val: low
-          value: low
-        - dps_val: high
-          value: high        
     - id: 5
       name: mode
       type: string
       mapping:
         - dps_val: Manual
-          value: Manual
+          value: normal
         - dps_val: Auto
-          value: Auto
-          icon: "mdi:tshirt-crew-outline"
-          icon_priority: 3
+          value: auto
         - dps_val: Laundrydrying
-          value: Laundrydrying
-          icon: "mdi:air-filter"
-          icon_priority: 3
+          value: laundry
         - dps_val: Sleep
-          value: Sleep
-          icon: "mdi:power-sleep"
-          icon_priority: 3
+          value: sleep
         - dps_val: Purifying
-          value: Purifying
-          icon: "mdi:leaf"
+          value: purify
+    - id: 6
+      type: integer
+      name: current_humidity
     - id: 19
-      name: error
+      name: fault_code
       type: bitfield
       # Docs mention E1 and E2, it isn't clear which is tank full, so for now
       # treat both as that.
@@ -64,26 +44,14 @@ primary_entity:
           value: OK
         - dps_val: 1
           value: E1
-          icon: "mdi:cup-water"
-          icon_priority: 2
         - dps_val: 2
           value: E2
-          icon: "mdi:cup-water"
-          icon_priority: 2
-    - id: 8
-      type: boolean
-      name: swing
-      mapping:
-        - dps_val: true
-          icon: "mdi:creation"
-        - dps_val: false
-          icon: "mdi:creation-outline"
 secondary_entities:
-  - entity: select
-    name: speed
-    icon: "mdi:fan"
-    category: config
+  - entity: fan
     dps:
+      - id: 1
+        type: boolean
+        name: switch
       - id: 4
         type: string
         name: option
@@ -93,54 +61,25 @@ secondary_entities:
             value: low
           - dps_val: high
             value: high
-  - entity: switch
-    name: swing
-    category: config
-    icon: "mdi:tailwind"
-    dps: 
       - id: 8
         type: boolean
-        name: switch
-        mapping:
-          - dps_val: true
-            icon: "mdi:tailwind"
-          - dps_val: false
-            icon: "mdi:tailwind"
+        name: oscillate
   - entity: switch
-    name: ionizer
+    name: Ionizer
     category: config
     icon: "mdi:creation"
     dps:
       - id: 10
         type: boolean
         name: switch
-        mapping:
-          - dps_val: true
-            icon: "mdi:creation"
-          - dps_val: false
-            icon: "mdi:creation-outline"
   - entity: switch
-    name: uv
+    name: UV sterilization
     category: config
     icon: "mdi:leaf"
     dps:
       - id: 13
         type: boolean
         name: switch
-        mapping:
-          - dps_val: true
-            icon: "mdi:leaf"
-          - dps_val: false
-            icon: "mdi:leaf-outline"
-  - entity: sensor
-    name: Current humidity
-    class: humidity
-    dps:
-      - id: 6
-        type: integer
-        name: sensor
-        unit: "%"
-        class: measurement
   - entity: binary_sensor
     name: Tank
     class: problem
@@ -156,15 +95,11 @@ secondary_entities:
   - entity: lock
     name: Child lock
     category: config
+    icon: "mdi:hand-back-right-off"
     dps:
       - id: 16
         type: boolean
         name: lock
-        mapping:
-          - dps_val: true
-            icon: "mdi:lock"
-          - dps_val: false
-            icon: "mdi:lock"
   - entity: select
     name: Timer
     icon: "mdi:timer"