Răsfoiți Sursa

ElectriQ Airflex: provide single DP versions of hvac_mode

The original config for this model also had an Eco preset, so the
original config used preset_mode mostly duplicating hvac_mode.  After
it was discovered that Eco mode did not really exist, the preset_mode
was changed to a hidden work_mode dp, leaving just the hvac_mode
controls.

But apparently at least some devices do not work like this.
Originally the reports were that hvac_mode only worked for on/off, it
didn't change the mode, but after the change d682aff2519, the reverse
became true.

A proper fix is probably to allow labelling the config as "single dp
only" and implementing queuing in the sending code to ensure only one
dp is sent at a time, but the quick fix is to restore the preset_mode
duplication, and add a separate on/off switch, which can be used as
alternatives to hvac_mode.

Discussion #609
Jason Rumney 2 ani în urmă
părinte
comite
9c4076bef1

+ 24 - 3
custom_components/tuya_local/devices/electriq_airflex15w_heatpump.yaml

@@ -12,7 +12,7 @@ primary_entity:
           value: "off"
           icon: "mdi:hvac-off"
         - dps_val: true
-          constraint: work_mode
+          constraint: preset_mode
           conditions:
             - dps_val: "0" # auto
               value: heat_cool
@@ -62,8 +62,20 @@ primary_entity:
       name: unknown_20
     - id: 101
       type: string
-      name: work_mode
-      hidden: true
+      # at least some firmware versions of this model do not like combining
+      # dps in hvac_mode, so duplicate in presets to allow single dp commands
+      name: preset_mode
+      mapping:
+        - dps_val: "0"
+          value: Auto
+        - dps_val: "1"
+          value: Cool
+        - dps_val: "2"
+          value: Heat
+        - dps_val: "3"
+          value: Dry
+        - dps_val: "5"
+          value: Fan
     - id: 103
       type: boolean
       name: unknown_103
@@ -107,6 +119,15 @@ primary_entity:
       type: integer
       name: current_humidity
 secondary_entities:
+  # At least some firmware versions do not like combining dps into hvac_mode
+  # above, so provide a simple single dp on/off switch as an alternative
+  - entity: switch
+    name: Power
+    category: config
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
   - entity: select
     name: Temperature unit
     category: config