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

Add support for Soho Air Purifier

Onvisoc 2 лет назад
Родитель
Сommit
a694e11643

+ 122 - 0
custom_components/tuya_local/devices/soho_air_purifier.yaml

@@ -0,0 +1,122 @@
+name: Air Purifier
+primary_entity:
+  entity: fan
+  translation_only_key: fan_with_presets
+  dps:
+    - id: 1
+      name: switch
+      type: boolean
+    - id: 3
+      name: preset_mode
+      type: string
+      mapping:
+        - dps_val: auto
+          value: auto
+        - dps_val: manual
+          value: manual
+        - dps_val: sleep
+          value: sleep
+    - id: 4
+      name: speed
+      type: string
+      mapping:
+        - dps_val: low
+          value: 33
+        - dps_val: mid
+          value: 66
+        - dps_val: high
+          value: 100
+secondary_entities:
+  - entity: switch
+    translation_key: ionizer
+    category: config
+    dps:
+      - id: 6
+        type: boolean
+        name: switch
+  - entity: switch
+    translation_key: uv_sterilization
+    category: config
+    dps:
+      - id: 9
+        type: boolean
+        name: switch
+  - entity: switch
+    translation_key: child_lock
+    category: config
+    dps:
+     - id: 7
+       type: boolean
+       name: switch
+  - entity: switch
+    translation_key: backlight
+    category: config
+    dps:
+     - id: 8
+       type: boolean
+       name: switch
+  - entity: switch
+    translation_key: keytone
+    category: config
+    dps:
+     - id: 101
+       type: boolean
+       name: switch
+  - entity: select
+    name: Timer
+    icon: mdi:timer
+    category: config
+    dps:
+      - id: 18
+        type: string
+        name: option
+        mapping:
+         - dps_val: cancel
+           value: "Off"
+         - dps_val: 1h
+           value: 1 hour
+         - dps_val: 2h
+           value: 2 hours
+         - dps_val: 3h
+           value: 3 hours
+         - dps_val: 4h
+           value: 4 hours
+         - dps_val: 5h
+           value: 5 hours
+         - dps_val: 6h
+           value: 6 hours
+         - dps_val: 7h
+           value: 7 hours
+         - dps_val: 8h
+           value: 8 hours
+         - dps_val: 9h
+           value: 9 hours
+         - dps_val: 10h
+           value: 10 hours
+         - dps_val: 11h
+           value: 11 hours
+         - dps_val: 12h
+           value: 12 hours
+  - entity: sensor
+    name: Air Quality
+    class: enum
+    icon: mdi:air-filter
+    dps:
+     - id: 21
+       type: string
+       name: sensor
+       mapping:
+        - dps_val: excellent
+          value: Excellent
+        - dps_val: good
+          value: Good
+        - dps_val: difference
+          value: Bad
+  - entity: sensor
+    transation_key: pm25
+    class: pm25
+    dps:
+     - id: 2
+       type: integer
+       name: sensor
+       unit: µg/m³

+ 25 - 0
custom_components/tuya_local/icons.json

@@ -84,6 +84,9 @@
         "sensor": {
         "sensor": {
             "time_remaining": {
             "time_remaining": {
                 "default": "mdi:timer"
                 "default": "mdi:timer"
+            },
+            "pm25": {
+                "default": "mdi:molecule"
             }
             }
         },
         },
         "switch": {
         "switch": {
@@ -95,6 +98,28 @@
             },
             },
             "uv_sterilization": {
             "uv_sterilization": {
                 "default": "mdi:solar-power"
                 "default": "mdi:solar-power"
+            },
+            "keytone": {
+                "default": "mdi:bell-ring"
+            },
+            "child_lock": {
+                "default": "mdi:lock"
+            },
+            "backlight": {
+                "default": "mdi:wall-sconce-flat-variant"
+            }
+        },
+        "fan": {
+            "fan_with_presets": {
+                "state_attributes": {
+                    "preset_mode": {
+                        "state": {
+                            "auto": "mdi:fan-auto",
+                            "manual": "mdi:wrench",
+                            "sleep": "mdi:sleep"
+                        }
+                    }
+                }
             }
             }
         }
         }
     }
     }

+ 14 - 0
custom_components/tuya_local/translations/en.json

@@ -234,6 +234,8 @@
                 "state_attributes": {
                 "state_attributes": {
                     "preset_mode": {
                     "preset_mode": {
                         "state": {
                         "state": {
+                            "auto": "Auto",
+                            "manual": "Manual",
                             "normal": "Normal",
                             "normal": "Normal",
                             "nature": "Natural",
                             "nature": "Natural",
                             "sleep": "Sleep",
                             "sleep": "Sleep",
@@ -313,6 +315,9 @@
         "sensor": {
         "sensor": {
             "time_remaining": {
             "time_remaining": {
                 "name": "Time remaining"
                 "name": "Time remaining"
+            },
+            "pm25": {
+                "name": "PM2.5"
             }
             }
         },
         },
         "switch": {
         "switch": {
@@ -327,6 +332,15 @@
             },
             },
             "evaporator_cleaning": {
             "evaporator_cleaning": {
                 "name": "Evaporator cleaning"
                 "name": "Evaporator cleaning"
+            },
+            "backlight": {
+                "name": "Backlight"
+            },
+            "keytone": {
+                "name": "Keytone"
+            },
+            "child_lock": {
+                "name": "Child Lock"
             }
             }
         }
         }
     }
     }