ソースを参照

Hysen thermostat: move temperature display to a read-only attribute.

It seems this is not used to set which temperature to display, but
only reports it.

issue #254
Jason Rumney 3 年 前
コミット
a769dc0c57

+ 8 - 13
custom_components/tuya_local/devices/hysen_hy08we2_thermostat.yaml

@@ -71,6 +71,14 @@ primary_entity:
     - id: 107
       type: boolean
       name: unknown_107
+    - id: 108
+      type: boolean
+      name: temperature_display
+      mapping:
+        - dps_val: false
+          value: internal
+        - dps_val: true
+          value: external
     - id: 114
       type: integer
       name: max_temperature
@@ -349,19 +357,6 @@ secondary_entities:
             value: Celsius
           - dps_val: true
             value: Fahrenheit
-  - entity: select
-    name: Display Temperature
-    category: config
-    icon: "mdi:thermometer"
-    dps:
-      - id: 108
-        type: boolean
-        name: option
-        mapping:
-          - dps_val: false
-            value: Internal
-          - dps_val: true
-            value: External
   - entity: binary_sensor
     name: Fault
     class: problem

+ 12 - 9
tests/devices/test_hysen_hy08we2_thermostat.py

@@ -115,14 +115,6 @@ class TestHysenHY08WE2Thermostat(
                         True: "Fahrenheit",
                     },
                 },
-                {
-                    "dps": DISPLAY_DPS,
-                    "name": "select_display_temperature",
-                    "options": {
-                        False: "Internal",
-                        True: "External",
-                    },
-                },
             ],
         )
         self.setUpBasicSensor(
@@ -217,7 +209,6 @@ class TestHysenHY08WE2Thermostat(
                 "number_low_temperature_protection",
                 "number_low_temperature_limit",
                 "number_high_temperature_limit",
-                "select_display_temperature",
                 "select_initial_state",
                 "select_schedule",
                 "select_temperature_sensor",
@@ -313,12 +304,24 @@ class TestHysenHY08WE2Thermostat(
         self.dps[ERROR_DPS] = 12
         self.dps[UNKNOWN106_DPS] = False
         self.dps[UNKNOWN107_DPS] = True
+        self.dps[DISPLAY_DPS] = True
+        self.assertDictEqual(
+            self.subject.extra_state_attributes,
+            {
+                "fault_code": 12,
+                "unknown_106": False,
+                "unknown_107": True,
+                "temperature_display": "external",
+            },
+        )
+        self.dps[DISPLAY_DPS] = False
         self.assertDictEqual(
             self.subject.extra_state_attributes,
             {
                 "fault_code": 12,
                 "unknown_106": False,
                 "unknown_107": True,
+                "temperature_display": "internal",
             },
         )