Pārlūkot izejas kodu

Saswell Thermostat: Use capitalised C/F for units.

Based on developer portal info from issue #45.
Jason Rumney 4 gadi atpakaļ
vecāks
revīzija
41d20888c6

+ 4 - 4
custom_components/tuya_local/devices/saswell_t29utk_thermostat.yaml

@@ -50,9 +50,9 @@ primary_entity:
       name: temperature_unit
       type: string
       mapping:
-        - dps_val: f
+        - dps_val: F
           value: F
-        - dps_val: c
+        - dps_val: C
           value: C
     - id: 101
       name: preset_mode
@@ -102,11 +102,11 @@ primary_entity:
       mapping:
         - constraint: temperature_unit
           conditions:
-            - dps_val: c
+            - dps_val: C
               range:
                 min: 5
                 max: 35
-            - dps_val: f
+            - dps_val: F
               value_redirect: temperature_f
               range:
                 min: 41

+ 1 - 1
tests/const.py

@@ -366,7 +366,7 @@ SASWELL_T29UTK_THERMOSTAT_PAYLOAD = {
     "3": 241,
     "4": "cold",
     "5": "auto",
-    "19": "c",
+    "19": "C",
     "101": False,
     "102": False,
     "103": "cold",

+ 12 - 6
tests/devices/test_saswell_t29utk_thermostat.py

@@ -68,31 +68,37 @@ class TestSaswellT29UTKThermostat(TuyaDeviceTestCase):
         self.assertEqual(self.subject.icon, "mdi:thermometer-off")
 
     def test_temperature_unit(self):
-        self.dps[UNITS_DPS] = "c"
+        self.dps[UNITS_DPS] = "C"
         self.assertEqual(self.subject.temperature_unit, TEMP_CELSIUS)
 
-        self.dps[UNITS_DPS] = "f"
+        self.dps[UNITS_DPS] = "F"
         self.assertEqual(self.subject.temperature_unit, TEMP_FAHRENHEIT)
 
     def test_target_temperature(self):
-        self.dps[UNITS_DPS] = "c"
+        self.dps[UNITS_DPS] = "C"
         self.dps[TEMPERATURE_DPS] = 25
         self.dps[TEMPF_DPS] = 75
         self.assertEqual(self.subject.target_temperature, 25)
-        self.dps[UNITS_DPS] = "f"
+        self.dps[UNITS_DPS] = "F"
         self.assertEqual(self.subject.target_temperature, 75)
 
     def test_target_temperature_step(self):
         self.assertEqual(self.subject.target_temperature_step, 1)
 
     def test_minimum_target_temperature(self):
+        self.dps[UNITS_DPS] = "C"
         self.assertEqual(self.subject.min_temp, 5)
+        self.dps[UNITS_DPS] = "F"
+        self.assertEqual(self.subject.min_temp, 41)
 
     def test_maximum_target_temperature(self):
+        self.dps[UNITS_DPS] = "C"
         self.assertEqual(self.subject.max_temp, 35)
+        self.dps[UNITS_DPS] = "F"
+        self.assertEqual(self.subject.max_temp, 95)
 
     async def test_set_target_temperature(self):
-        self.dps[UNITS_DPS] = "c"
+        self.dps[UNITS_DPS] = "C"
         async with assert_device_properties_set(
             self.subject._device,
             {TEMPERATURE_DPS: 24},
@@ -100,7 +106,7 @@ class TestSaswellT29UTKThermostat(TuyaDeviceTestCase):
             await self.subject.async_set_target_temperature(24)
 
     async def test_set_target_temperature_f(self):
-        self.dps[UNITS_DPS] = "f"
+        self.dps[UNITS_DPS] = "F"
         async with assert_device_properties_set(
             self.subject._device,
             {TEMPF_DPS: 74},