Преглед изворни кода

Avatto thermostat: sync with Beok TOL47

Issue #279

Based on info in issue #279, these two thermostats seem almost
identical, just one extra dp in the Avatto one, and different
temperature ranges.  Based on the missing features and unknown dps,
the Beok ones match, and also the strange mapping of cold/hot/wind to
manual/program/temporary modes seems the same.

For Beok, adjusted some icons - the random icons that do not really
match the selections of sensor select replaced with a single icon, and
the many adjustments with thermometer icon replaced with more descriptive
icons used in other devices for the same function, to more easily tell
them apart.
Jason Rumney пре 3 година
родитељ
комит
83de0f4d0c

+ 167 - 82
custom_components/tuya_local/devices/avatto_wt100_thermostat.yaml

@@ -12,33 +12,14 @@ primary_entity:
           constraint: preset_mode
           constraint: preset_mode
           conditions:
           conditions:
             - dps_val: cold
             - dps_val: cold
-              value: cool
-            - dps_val: hot
-              value: heat
-            - dps_val: wind
-              value: fan_only
-            - dps_val: comfortable
-              value: heat
-            - dps_val: energy
+              # manual
               value: heat
               value: heat
-            - dps_val: auto
-              value: heat_cool
-            - dps_val: program
+            - dps_val: hot
+              # program
               value: auto
               value: auto
-            - dps_val: holiday
+            - dps_val: wind
+              # temporary program - HA does not have a distinct mode for this
               value: auto
               value: auto
-            - dps_val: eco
-              value: heat
-            - dps_val: manual
-              value: heat
-            - dps_val: sleep
-              value: heat
-            - dps_val: dry
-              value: dry
-            - dps_val: floor_heat
-              value: heat
-            - dps_val: auxiliary_heat
-              value: heat
     - id: 2
     - id: 2
       name: temperature
       name: temperature
       type: integer
       type: integer
@@ -57,72 +38,33 @@ primary_entity:
       type: string
       type: string
       mapping:
       mapping:
         - dps_val: cold
         - dps_val: cold
-          value: Cool
-        - dps_val: hot
-          value: Heat
-        - dps_val: wind
-          value: Fan
-        - dps_val: comfortable
-          value: Comfort
-        - dps_val: energy
-          value: Energy
-        - dps_val: auto
-          value: Auto
-        - dps_val: holiday
-          value: Holiday
-        - dps_val: eco
-          value: Eco
-        - dps_val: manual
           value: Manual
           value: Manual
-        - dps_val: sleep
-          value: Sleep
-        - dps_val: dry
-          value: Dehumidify
-        - dps_val: program
+        - dps_val: hot
           value: Program
           value: Program
-        - dps_val: floor_heat
-          value: Floor Heating
-        - dps_val: auxiliary_heat
-          value: Auxiliary Heating
+        - dps_val: wind
+          value: Temporary Program
     - id: 5
     - id: 5
-      name: unknown_5
+      name: hvac_action
       type: string
       type: string
-    - id: 13
-      name: unknown_13
-      type: boolean
+      mapping:
+        - dps_val: "0"
+          constraint: hvac_mode
+          conditions:
+            - dps_val: true
+              value: idle
+              icon: "mdi:radiator-disabled"
+            - dps_val: false
+              value: "off"
+              icon: "mdi:radiator-off"
+        - dps_val: "1"
+          value: heating
+          icon: "mdi:radiator"
     - id: 16
     - id: 16
-      name: unknown_16
-      type: integer
-    - id: 20
-      name: unknown_20
-      type: integer
-    - id: 21
-      name: unknown_21
-      type: integer
-    - id: 25
-      name: unknown_25
-      type: string
-    - id: 26
-      name: unknown_26
-      type: boolean
+      name: fault_code
+      type: bitfield
     - id: 31
     - id: 31
       name: unknown_31
       name: unknown_31
       type: boolean
       type: boolean
-    - id: 41
-      name: unknown_41
-      type: string
-    - id: 42
-      name: unknown_42
-      type: string
-    - id: 101
-      name: unknown_101
-      type: boolean
-    - id: 105
-      name: unknown_105
-      type: integer
-    - id: 107
-      name: unknown_107
-      type: integer
 secondary_entities:
 secondary_entities:
   - entity: lock
   - entity: lock
     name: Child lock
     name: Child lock
@@ -132,3 +74,146 @@ secondary_entities:
       - id: 8
       - id: 8
         name: lock
         name: lock
         type: boolean
         type: boolean
+        mapping:
+          - dps_val: true
+            icon: "mdi:hand-back-right-off"
+          - dps_val: false
+            icon: "mdi:hand-back-right"
+  - entity: switch 
+    name: Sound
+    category: config
+    icon: "mdi:music-note"
+    dps:
+      - id: 13
+        type: boolean
+        name: switch
+  - entity: binary_sensor
+    name: Fault alarm
+    category: diagnostic
+    class: problem
+    dps:
+      - id: 16
+        type: bitfield
+        name: sensor
+        mapping:
+          - dps_val: 0
+            value: False
+          - value: True
+  - entity: number
+    name: Temperature calibration
+    category: config
+    icon: "mdi:arrow-collapse-up"
+    dps:
+      - id: 20
+        type: integer
+        name: value
+        range:
+          min: -90
+          max: 90
+        mapping:
+          - scale: 10
+        unit: C
+  - entity: number
+    name: Maximum temperature
+    category: config
+    icon: "mdi:thermometer-chevron-up"
+    dps:
+      - id: 21
+        type: integer
+        name: value
+        range:
+          min: 15
+          max: 70
+        unit: C
+  - entity: select
+    name: Sensor
+    category: config
+    icon: "mdi:home-thermometer"
+    dps:
+      -id: 25
+      type: string
+      name: option
+      mapping:
+        - dps_val: "1"
+          value: Internal
+        - dps_val: "2"
+          value: External
+        - dps_val: "3"
+          value: Both
+  - entity: switch
+    name: Anti-frost
+    category: config
+    icon: "mdi:snowflake-melt"
+    dps:
+      - id: 26
+        type: boolean
+        name: switch
+  - entity: select
+    name: Backlight brightness
+    category: config
+    dps:
+      - id: 41
+        type: string
+        name: option
+        mapping:
+          - dps_val: "0"
+            icon: "mdi:lightbulb-on-10"
+            value: None
+          - dps_val: "1"
+            icon: "mdi:lightbulb-on-40"
+            value: Low
+          - dps_val: "2"
+            icon: "mdi:lightbulb-on-70"
+            value: Middle
+          - dps_val: "3"
+            icon: "mdi:lightbulb-on"
+            value: High
+  - entity: select
+    name: Schedule
+    category: config
+    icon: "mdi:calendar-clock"
+    dps:
+      - id: 42
+        type: string
+        name: option
+        mapping:
+          - dps_val: "1"
+            value: "Weekday+Weekend"
+          - dps_val: "2" 
+            value: "Mon-Sat+Sun"
+          - dps_val: "3"
+            value: "Daily"
+  - entity: switch
+    name: Output reverse
+    category: config
+    icon: "mdi:swap-horizontal"   
+    dps:
+      - id: 101
+        type: boolean
+        name: switch
+  - entity: number
+    name: Temperature hysteresis
+    category: config
+    icon: "mdi:thermometer-plus"
+    dps:
+      - id: 105
+        type: integer
+        name: value
+        range:
+          min: 5
+          max: 95
+        mapping:
+          - scale: 10
+        unit: C
+  - entity: number
+    name: External temperature limit
+    category: config
+    icon: "mdi:arrow-collapse-up"
+    dps:
+      - id: 107
+        type: integer
+        name: value
+        range:
+          min: 20
+          max: 70
+        unit: C

+ 12 - 12
custom_components/tuya_local/devices/beok_tol47_thermostat.yaml

@@ -45,7 +45,7 @@ primary_entity:
       type: string
       type: string
       name: hvac_action
       name: hvac_action
       mapping:
       mapping:
-        - dps_val: 0
+        - dps_val: "0"
           constraint: hvac_mode
           constraint: hvac_mode
           conditions:
           conditions:
             - dps_val: true
             - dps_val: true
@@ -54,9 +54,12 @@ primary_entity:
             - dps_val: false
             - dps_val: false
               value: "off"
               value: "off"
               icon: "mdi:radiator-off"
               icon: "mdi:radiator-off"
-        - dps_val: 1
+        - dps_val: "1"
           value: heating
           value: heating
           icon: "mdi:radiator"
           icon: "mdi:radiator"
+    - id: 16
+      type: bitfield
+      name: fault_code
 secondary_entities:
 secondary_entities:
   - entity: lock
   - entity: lock
     name: Child lock
     name: Child lock
@@ -81,7 +84,6 @@ secondary_entities:
   - entity: binary_sensor
   - entity: binary_sensor
     name: Fault alarm
     name: Fault alarm
     category: diagnostic
     category: diagnostic
-    icon: "mdi:alert"
     class: problem
     class: problem
     dps:
     dps:
       - id: 16
       - id: 16
@@ -94,7 +96,7 @@ secondary_entities:
   - entity: number
   - entity: number
     name: Calibration offset
     name: Calibration offset
     category: config
     category: config
-    icon: "mdi:thermometer"
+    icon: "mdi:arrow-collapse-up"
     dps:
     dps:
       - id: 20
       - id: 20
         type: integer
         type: integer
@@ -108,7 +110,7 @@ secondary_entities:
   - entity: number
   - entity: number
     name: High temperature limit
     name: High temperature limit
     category: config
     category: config
-    icon: "mdi:thermometer"
+    icon: "mdi:thermometer-chevron-up"
     dps:
     dps:
       - id: 21
       - id: 21
         type: integer
         type: integer
@@ -120,19 +122,17 @@ secondary_entities:
   - entity: select
   - entity: select
     name: Sensor selection
     name: Sensor selection
     category: config
     category: config
+    icon: "mdi:home-thermometer"
     dps:
     dps:
       - id: 25
       - id: 25
         type: string
         type: string
         name: option
         name: option
         mapping:
         mapping:
           - dps_val: "1"
           - dps_val: "1"
-            icon: "mdi:gauge"
             value: Internal
             value: Internal
           - dps_val: "2"
           - dps_val: "2"
-            icon: "mdi:thermometer-chevron-down"
             value: External
             value: External
           - dps_val: "3"
           - dps_val: "3"
-            icon: "mdi:thermometer"
             value: Both
             value: Both
   - entity: switch
   - entity: switch
     name: Anti-frost
     name: Anti-frost
@@ -176,7 +176,7 @@ secondary_entities:
           - dps_val: "2" 
           - dps_val: "2" 
             value: "Mon-Sat+Sun"
             value: "Mon-Sat+Sun"
           - dps_val: "3"
           - dps_val: "3"
-            value: "Daily"	 
+            value: "Daily"
   - entity: switch
   - entity: switch
     name: Output main reverse
     name: Output main reverse
     category: config
     category: config
@@ -188,7 +188,7 @@ secondary_entities:
   - entity: number
   - entity: number
     name: Temperature control switch difference
     name: Temperature control switch difference
     category: config
     category: config
-    icon: "mdi:thermometer"
+    icon: "mdi:thermometer-plus"
     dps:
     dps:
       - id: 105
       - id: 105
         type: integer
         type: integer
@@ -202,7 +202,7 @@ secondary_entities:
   - entity: number
   - entity: number
     name: External sensor temperature limit
     name: External sensor temperature limit
     category: config
     category: config
-    icon: "mdi:thermometer"
+    icon: "mdi:arrow-collapse-up"
     dps:
     dps:
       - id: 107
       - id: 107
         type: integer
         type: integer
@@ -210,4 +210,4 @@ secondary_entities:
         unit: C
         unit: C
         range:
         range:
           min: 5
           min: 5
-          max: 60
+          max: 60