Kaynağa Gözat

Euroster4040 thermostat: update to use climate entity

- use climate entity for richer UI
- hide difficult to use or non-useful controls so only users willing to put in the effort need to be bothered by them
- Clean up products and top-level name
- Clean up entity naming
- use translations where available

PR #3255
Jason Rumney 8 ay önce
ebeveyn
işleme
24b1e24669

+ 0 - 107
custom_components/tuya_local/devices/euroster4040.yaml

@@ -1,107 +0,0 @@
-name: Euroster 4040
-products:
-  - id: f8oamfazwp5wo8go
-    name: Euroster 4040
-# room thermostat controlling the pump relay
-entities:
-  - entity: switch
-    icon: "mdi:switch"
-    dps:
-      - id: 1
-        type: boolean
-        name: switch
-  - entity: select
-    name: Temperature Unit
-    category: config
-    dps:
-      - id: 17
-        type: string
-        name: option
-        mapping:
-          - dps_val: "c"
-            value: "C"
-          - dps_val: "f"
-            value: "F"
-  - entity: sensor
-    name: Set Temperature
-    category: diagnostic
-    dps:
-      - id: 103
-        type: base64
-        name: sensor
-        optional: true
-        mask: "0000000000000000FF000000000000000000"
-        mapping:
-          - scale: 1
-  # HEX Value      2d 02 00 00 00 00 00 02 18 01 14 06 80 00 80 00 08 02
-  - entity: sensor
-    name: Set Temperature Decimal
-    category: diagnostic
-    dps:
-      - id: 103
-        type: base64
-        name: sensor
-        optional: true
-        mask: "000000000000000000FF0000000000000000"
-        mapping:
-          - scale: 10
-  # Set_temperature= "Set Temperature"+"Set Temperature Decimal"
-  - entity: sensor
-    name: Current Temperature
-    category: diagnostic
-    dps:
-      - id: 103
-        type: base64
-        name: sensor
-        optional: true
-        mask: "00000000000000000000FF00000000000000"
-        mapping:
-          - scale: 1
-            constraint: temperature_unit
-  - entity: sensor
-    name: Current Temperature Decimal
-    category: diagnostic
-    dps:
-      - id: 103
-        type: base64
-        name: sensor
-        optional: true
-        mask: "0000000000000000000000FF000000000000"
-        mapping:
-          - scale: 10
-  # Current Temperature= "Current Temperature"+"Current Temperature Decimal"
-  - entity: sensor
-    name: Status
-    category: diagnostic
-    dps:
-      - id: 103
-        type: base64
-        name: sensor
-        optional: true
-        mask: "FF0000000000000000000000000000000000"
-        mapping:
-          - scale: 1
-  # State of module/pump:
-  # not working(40) / working(45) /temperature too high(57)/ not working yet(41)
-
-  - entity: button
-    # requesting refresh of sensors (dp103)
-    name: GET INFO
-    class: restart
-    category: config
-    dps:
-      - id: 101
-        type: boolean
-        name: button
-        optional: true
-  - entity: button
-    # requesting refresh of schedule
-    # (dp 104 - HEX Value(015555555aaaaaaaaaaaaaaa55170918010000))
-    name: GET PROGRAM
-    class: restart
-    category: config
-    dps:
-      - id: 102
-        type: boolean
-        name: button
-        optional: true

+ 117 - 0
custom_components/tuya_local/devices/euroster4040_thermostat.yaml

@@ -0,0 +1,117 @@
+name: Thermostat
+products:
+  - id: f8oamfazwp5wo8go
+    manufacturer: Euroster
+    model: 4040 Smart
+    # room thermostat controlling the pump relay
+entities:
+  - entity: climate
+    translation_key: thermostat
+    dps:
+      - id: 1
+        type: boolean
+        name: hvac_mode
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            value: heat_cool
+      - id: 103
+        type: base64
+        name: temperature
+        optional: true
+        mask: "0000000000000000FF000000000000000000"
+        range:
+          min: 5
+          max: 35
+        # it is likely the F temperatures are encoded in a different place in the masked field,
+        # so assume we can ignore temperature unit and always use C
+        unit: C
+      - id: 103
+        type: base64
+        name: current_temperature
+        optional: true
+        mask: "00000000000000000000FF00000000000000"
+        # Full Current Temperature= "Current Temperature"+"Current Temperature Decimal"
+      - id: 103
+        type: base64
+        name: current_temperature_decimal
+        optional: true
+        mask: "0000000000000000000000FF000000000000"
+        mapping:
+          - scale: 10
+      - id: 103
+        type: base64
+        name: hvac_action
+        optional: true
+        mask: "0F0000000000000000000000000000000000"
+        mapping:
+          - dps_val: 1
+            value: preheating
+          - dps_val: 5
+            value: heating
+          - value: idle
+    translation_key: temperature_unit
+    category: config
+    dps:
+      - id: 17
+        type: string
+        name: option
+        mapping:
+          - dps_val: c
+            value: celsius
+          - dps_val: f
+            value: fahrenheit
+
+  # HEX Value      2d 02 00 00 00 00 00 02 18 01 14 06 80 00 80 00 08 02
+  # complex encoding that can't be directly supported, so provide it
+  # hidden by default in case someone wants to handle it with helpers, templates and automation
+  # Set_temperature= "Set Temperature"+"Set Temperature Decimal"
+  - entity: number
+    name: Set temperature decimal
+    category: diagnostic
+    hidden: true
+    dps:
+      - id: 103
+        type: base64
+        name: value
+        optional: true
+        mask: "000000000000000000FF0000000000000000"
+        mapping:
+          - scale: 10
+
+  - entity: binary_sensor
+    class: problem
+    category: diagnostic
+    dps:
+      - id: 103
+        type: base64
+        name: sensor
+        optional: true
+        mask: "0F0000000000000000000000000000000000"
+        mapping:
+          - dps_val: 7
+            value: true
+          - value: false
+  - entity: button
+    # requesting refresh of sensors (dp103)
+    name: Update sensors
+    icon: "mdi:refresh"
+    category: config
+    dps:
+      - id: 101
+        type: boolean
+        name: button
+        optional: true
+  - entity: button
+    # requesting refresh of schedule - hide by default, as schedule is not exposed
+    # (dp 104 - HEX Value(015555555aaaaaaaaaaaaaaa55170918010000))
+    name: Fetch schedule
+    icon: "mdi:calendar-sync"
+    category: config
+    hidden: true
+    dps:
+      - id: 102
+        type: boolean
+        name: button
+        optional: true