Procházet zdrojové kódy

Add Airton Aircon device (#4469)

* Add Airton Aircon device

* Add known but unused DPS for better matching

* Set DPS 5 (Fan) to optional

Sometimes missing when the AC is off, which can mess up with the auto
detect

* Update based on feedback

* Change the contraint on the temp range

* Use APISpec and testing to improve the settings

* Self-clean doesn't seem to work

* Anti-freeze doesn't seem to be supported either

* Another round of fix

* fix (airton_aircon): merge problem sensors, expose extra attributes

- merge the 2 problem sensors into a single binary_sensor with 2
  attributes, which signals a problem if either dp indicates one[
- change hidden to optional for extra attributes that are not used in conditional logic. Having these exposed lets them be studied to figure out if they are ever useful. If "they are not showing up", then they need to be optional rather than hidden.

PR #4469

---------

Co-authored-by: Julien <julien@vallee.me>
Co-authored-by: Jason Rumney <make-all@users.noreply.github.com>
Finwë před 20 hodinami
rodič
revize
9c61c86919

+ 215 - 0
custom_components/tuya_local/devices/airton_aircon.yaml

@@ -0,0 +1,215 @@
+name: Air conditioner
+products:
+  - id: keyquxnsj75xc8se
+    model: Reversible 2500W (409730)
+    manufacturer: Airton
+entities:
+  - entity: climate
+    translation_key: aircon_extra
+    dps:
+      - id: 1
+        name: hvac_mode
+        type: boolean
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            constraint: hvac_mode_switch
+            conditions:
+              - dps_val: auto
+                value: heat_cool
+              - dps_val: cold
+                value: cool
+              - dps_val: heat
+                value: heat
+              - dps_val: wet
+                value: dry
+              - dps_val: fan
+                value: fan_only
+      - id: 4
+        name: hvac_mode_switch
+        type: string
+        hidden: true
+      - id: 2
+        name: temperature
+        type: integer
+        range:
+          min: 160
+          max: 310
+        unit: C
+        mapping:
+          - scale: 10
+            step: 10
+            constraint: hvac_mode_switch
+            conditions:
+              - dps_val: fan
+                invalid: true
+      - id: 3
+        name: current_temperature
+        type: integer
+        mapping:
+          - scale: 10
+      - id: 5
+        name: fan_mode
+        type: string
+        optional: true
+        mapping:
+          - dps_val: auto
+            value: auto
+          - dps_val: mute
+            value: quiet
+          - dps_val: low
+            value: low
+          - dps_val: low_mid
+            value: medlow
+          - dps_val: mid
+            value: medium
+          - dps_val: mid_high
+            value: medhigh
+          - dps_val: high
+            value: high
+          - dps_val: turbo
+            value: strong
+      - id: 8
+        name: preset_mode
+        type: boolean
+        mapping:
+          - dps_val: false
+            constraint: preset_mode_sleep
+            conditions:
+              - dps_val: false
+                value: none
+              - dps_val: true
+                value: sleep
+          - dps_val: true
+            value: eco
+            constraint: hvac_mode_switch
+            conditions:
+              - dps_val: [auto, heat, wet, fan]
+                invalid: true
+      - id: 109
+        name: preset_mode_sleep
+        type: boolean
+        hidden: true
+      - id: 114
+        name: active_mode
+        type: string
+        optional: true
+      - id: 101
+        name: use_number
+        type: integer
+        optional: true
+      - id: 103
+        name: electricity
+        type: integer
+        optional: true
+      - id: 104
+        name: electricity_number
+        type: integer
+        optional: true
+      - id: 112
+        name: unit_type
+        type: string
+        optional: true
+      - id: 106
+        name: horizontal_swing
+        type: string
+        optional: true
+      - id: 107
+        name: swing_mode
+        type: string
+        mapping:
+          - dps_val: "off"
+            value: "off"
+          - dps_val: "15"
+            value: Swing
+          - dps_val: "1"
+            value: Position 1
+          - dps_val: "2"
+            value: Position 2
+          - dps_val: "3"
+            value: Position 3
+          - dps_val: "4"
+            value: Position 4
+          - dps_val: "5"
+            value: Position 5
+      - id: 108
+        name: swing3d
+        type: boolean
+        optional: true
+      - id: 111
+        name: clean
+        type: boolean
+        optional: true
+      - id: 115
+        name: heat8
+        type: boolean
+        optional: true
+      - id: 21
+        name: countdown
+        type: string
+        optional: true
+      - id: 22
+        name: countdown_left
+        type: integer
+        optional: true
+  - entity: light
+    translation_key: display
+    category: config
+    dps:
+      - id: 13
+        name: switch
+        type: boolean
+  - entity: switch
+    translation_key: ionizer
+    category: config
+    dps:
+      - id: 110
+        name: switch
+        type: boolean
+  - entity: switch
+    name: Anti-mould
+    icon: "mdi:water-off"
+    category: config
+    dps:
+      - id: 9
+        name: switch
+        type: boolean
+  - entity: switch
+    name: Auxiliary heat
+    icon: "mdi:fire"
+    category: config
+    dps:
+      - id: 12
+        name: switch
+        type: boolean
+  - entity: binary_sensor
+    class: problem
+    category: diagnostic
+    dps:
+      - id: 20
+        type: bitfield
+        name: sensor
+        mapping:
+          - dps_val: 0
+            value: true
+            constraint: fault_code_2
+            conditions:
+              - dps_val: 0
+                value: false
+          - value: true
+      - id: 20
+        type: bitfield
+        name: fault_code
+      - id: 113
+        type: bitfield
+        name: fault_code_2
+  - entity: sensor
+    name: Total usage time
+    icon: "mdi:clock-outline"
+    category: diagnostic
+    dps:
+      - id: 102
+        type: integer
+        name: sensor
+        unit: h