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

Inkbird ITC-306A: use hvac_mode for control instead of preset_mode.

hvac_mode allows the device to be toggled on and off, and is easier to
use in the UI.  on and off are simply mapped to "off" and "heat", but
pause is creatively mapped to "fan_only" to allow that to be selected
(according to user feedback it is no different than off mode, but
according to the manual, pause should leave the display on for
monitoring temperature, while off should be completely off).

- modify the translations for "thermo_switch" (only used by this
device) to follow this change.

- modify hvac_action to indicate "off" for both off and pause modes.

Discussion #1144
Jason Rumney 2 лет назад
Родитель
Сommit
340caead40

+ 25 - 15
custom_components/tuya_local/devices/inkbird_itc306a_thermostat.yaml

@@ -1,5 +1,8 @@
 name: Inkbird ITC-306A thermostat
 legacy_type: inkbird_thermostat
+products:
+  - id: wynvjn0ztufzrd0p
+    name: Inkbird ITC-306A V3.0
 primary_entity:
   entity: climate
   translation_key: thermo_switch
@@ -15,14 +18,14 @@ primary_entity:
       name: temperature_unit
     - id: 103
       type: string
-      name: preset_mode
+      name: hvac_mode
       mapping:
-        - dps_val: 'on'
-          value: 'on'
-        - dps_val: 'pause'
-          value: 'pause'
-        - dps_val: 'off'
-          value: 'off'
+        - dps_val: "on"
+          value: heat
+        - dps_val: pause
+          value: fan_only
+        - dps_val: "off"
+          value: "off"
     - id: 104
       type: integer
       name: current_temperature
@@ -88,14 +91,21 @@ primary_entity:
       type: boolean
       name: hvac_action
       mapping:
-        - dps_val: true
-          icon: "mdi:thermometer"
-          icon_priority: 6
-          value: heating
-        - dps_val: false
-          icon: "mdi:thermometer-off"
-          icon_priority: 5
-          value: idle
+        - constraint: hvac_mode
+          conditions:
+            - dps_val: "on"
+              mapping:
+                - dps_val: true
+                  icon: "mdi:thermometer"
+                  icon_priority: 6
+                  value: heating
+                - dps_val: false
+                  icon: "mdi:thermometer-off"
+                  icon_priority: 5
+                  value: idle
+            - icon: "mdi:thermometer-off"
+              icon_priority: 5
+              value: "off"
     - id: 116
       type: integer
       name: current_temperature_f

+ 2 - 4
custom_components/tuya_local/translations/en.json

@@ -142,11 +142,9 @@
             },
             "thermo_switch": {
                 "state_attributes": {
-                    "preset_mode": {
+                    "hvac_mode": {
                         "state": {
-                            "on": "On",
-                            "off": "Off",
-                            "pause": "Pause"
+                            "fan_only": "Pause",
                         }
                     }
                 }

+ 2 - 4
custom_components/tuya_local/translations/fr.json

@@ -142,11 +142,9 @@
             },
             "thermo_switch": {
                 "state_attributes": {
-                    "preset_mode": {
+                    "hvac_mode": {
                         "state": {
-                            "on": "Marche",
-                            "off": "Arrêt",
-                            "pause": "Pause"
+                            "fan_only": "Pause"
                         }
                     }
                 }

+ 2 - 4
custom_components/tuya_local/translations/no-NB.json

@@ -142,11 +142,9 @@
             },
             "thermo_switch": {
                 "state_attributes": {
-                    "preset_mode": {
+                    "hvac_mode": {
                         "state": {
-                            "on": "På",
-                            "off": "Av",
-                            "pause": "Pause"
+                            "fan_only": "Pause"
                         }
                     }
                 }

+ 3 - 5
custom_components/tuya_local/translations/pl.json

@@ -142,11 +142,9 @@
             },
             "thermo_switch": {
                 "state_attributes": {
-                    "preset_mode": {
+                    "hvac_mode": {
                         "state": {
-                            "on": "Włączony",
-                            "off": "Wyłączony",
-                            "pause": "Pauza"
+                            "fan_only": "Pauza"
                         }
                     }
                 }
@@ -197,4 +195,4 @@
             }
         }
     }
-}
+}