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

fix (polytherm_polyalpha_thermostat): hide unavailable entities

There seem to be at least 2 variants of this device, with and without humidity.
See #3279, #4336, #4527

- Hide the humidity control and the floor temperature sensor if they are not available.
- revert the hvac_mode to using 2 dps. #4336 wasn't clear about the problem, and if one
  variant supports it, it seems unlikely that the other would remain compatible but reject
  more than 1 dp being changed at once.

This is a better compomise than the proposed PR #4529, which just reverts almost all
the changes from #4336 completely.
Jason Rumney 21 часов назад
Родитель
Сommit
a67397ea57

+ 30 - 13
custom_components/tuya_local/devices/polytherm_polyalpha_thermostat.yaml

@@ -4,25 +4,26 @@ products:
     manufacturer: Polytherm
     model: Polyalpha
 entities:
-  - entity: switch
-    dps:
-      - id: 1
-        type: boolean
-        name: switch
   - entity: climate
     translation_key: thermostat
     dps:
       - id: 1
-        name: available
-        type: boolean
-      - id: 104
         name: hvac_mode
         type: boolean
         mapping:
           - dps_val: false
-            value: cool
+            value: "off"
           - dps_val: true
-            value: heat
+            constraint: cool_heat
+            conditions:
+              - dps_val: false
+                value: cool
+              - dps_val: true
+                value: heat
+      - id: 104
+        name: cool_heat
+        type: boolean
+        hidden: true
       - id: 2
         name: preset_mode
         type: string
@@ -51,7 +52,7 @@ entities:
         type: string
         mapping:
           - dps_val: open
-            constraint: hvac_mode
+            constraint: cool_heat
             conditions:
               - dps_val: false
                 value: cooling
@@ -61,10 +62,16 @@ entities:
             value: idle
   - entity: humidifier
     name: Humidity override
+    hidden: unavailable
     dps:
-      - id: 1
-        type: boolean
+      - id: 107
+        type: integer
+        optional: true
         name: available
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
       - id: 106
         type: integer
         optional: true
@@ -97,11 +104,21 @@ entities:
   - entity: sensor
     name: Floor temperature
     class: temperature
+    hidden: unavailable
     dps:
       - id: 103
         type: integer
+        optional: true
         name: sensor
         unit: C
         class: measurement
         mapping:
           - scale: 10
+      - id: 103
+        type: integer
+        optional: true
+        name: available
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true