Răsfoiți Sursa

Eberg Cooly C35HD: make temp_set_f optional

It seems this dp is not always included when temp is set to C.

Be Cool has the same dp layout, but different mode mapping, and is
detected for Eberg devices, the only differences being a lack of
select entity to set the units, and the temp_set_f is already marked
as optional.  Sync these two by also adding the select entity for
temperature selection to Be Cool.

Remove the test for BeCool rather than update for this change, as it
is not testing anything unique.

Issue #974
Jason Rumney 2 ani în urmă
părinte
comite
c8f2b1d3b9

+ 14 - 1
custom_components/tuya_local/devices/becool_heatpump.yaml

@@ -87,4 +87,17 @@ primary_entity:
     - id: 19
       type: boolean
       name: unknown_19
-
+secondary_entities:
+  - entity: select
+    category: config
+    name: Temperature unit
+    icon: "mdi:temperature-celsius"
+    dps:
+      - id: 10
+        type: boolean
+        name: option
+        mapping:
+          - dps_val: true
+            value: "Fahrenheit"
+          - dps_val: false
+            value: "Celsius"

+ 1 - 0
custom_components/tuya_local/devices/eberg_cooly_c35hd.yaml

@@ -89,6 +89,7 @@ primary_entity:
       type: integer
       name: temperature_f
       hidden: true
+      optional: true
       range:
         min: 55
         max: 90

+ 0 - 123
tests/devices/test_becool_heatpump.py

@@ -1,123 +0,0 @@
-from homeassistant.components.climate.const import ClimateEntityFeature, HVACMode
-from homeassistant.const import UnitOfTemperature
-
-from ..const import BECOOL_HEATPUMP_PAYLOAD
-from ..helpers import assert_device_properties_set
-from ..mixins.climate import TargetTemperatureTests
-from .base_device_tests import TuyaDeviceTestCase
-
-HVACMODE_DPS = "1"
-UNKNOWN4_DPS = "4"
-MODE_DPS = "5"
-TEMPERATURE_DPS = "6"
-FAN_DPS = "8"
-UNIT_DPS = "10"
-UNKNOWN13_DPS = "13"
-UNKNOWN14_DPS = "14"
-UNKNOWN15_DPS = "15"
-UNKNOWN16_DPS = "16"
-UNKNOWN17_DPS = "17"
-TEMPF_DPS = "18"
-UNKNOWN19_DPS = "19"
-
-MODE_AUTO = "0"
-MODE_FAN = "1"
-MODE_DRY = "2"
-MODE_COOL = "3"
-MODE_HEAT = "5"
-
-
-class TestBWTHeatpump(
-    TargetTemperatureTests,
-    TuyaDeviceTestCase,
-):
-    __test__ = True
-
-    def setUp(self):
-        self.setUpForConfig("becool_heatpump.yaml", BECOOL_HEATPUMP_PAYLOAD)
-        self.subject = self.entities["climate"]
-        self.setUpTargetTemperature(
-            TEMPERATURE_DPS,
-            self.subject,
-            min=13,
-            max=32,
-        )
-
-    def test_supported_features(self):
-        self.assertEqual(
-            self.subject.supported_features,
-            (ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE),
-        )
-
-    def test_temperature_unit(self):
-        self.dps[UNIT_DPS] = False
-        self.assertEqual(self.subject.temperature_unit, UnitOfTemperature.CELSIUS)
-        self.dps[UNIT_DPS] = True
-        self.assertEqual(self.subject.temperature_unit, UnitOfTemperature.FAHRENHEIT)
-
-    def test_hvac_mode(self):
-        self.dps[HVACMODE_DPS] = False
-        self.assertEqual(self.subject.hvac_mode, HVACMode.OFF)
-        self.dps[HVACMODE_DPS] = True
-        self.dps[MODE_DPS] = MODE_AUTO
-        self.assertEqual(self.subject.hvac_mode, HVACMode.HEAT_COOL)
-        self.dps[MODE_DPS] = MODE_COOL
-        self.assertEqual(self.subject.hvac_mode, HVACMode.COOL)
-        self.dps[MODE_DPS] = MODE_HEAT
-        self.assertEqual(self.subject.hvac_mode, HVACMode.HEAT)
-        self.dps[MODE_DPS] = MODE_DRY
-        self.assertEqual(self.subject.hvac_mode, HVACMode.DRY)
-        self.dps[MODE_DPS] = MODE_FAN
-        self.assertEqual(self.subject.hvac_mode, HVACMode.FAN_ONLY)
-
-    def test_hvac_modes(self):
-        self.assertCountEqual(
-            self.subject.hvac_modes,
-            [
-                HVACMode.OFF,
-                HVACMode.COOL,
-                HVACMode.DRY,
-                HVACMode.FAN_ONLY,
-                HVACMode.HEAT,
-                HVACMode.HEAT_COOL,
-            ],
-        )
-
-    async def test_turn_on_to_auto(self):
-        async with assert_device_properties_set(
-            self.subject._device, {HVACMODE_DPS: True, MODE_DPS: MODE_AUTO}
-        ):
-            await self.subject.async_set_hvac_mode(HVACMode.HEAT_COOL)
-
-    async def test_turn_on_to_cool(self):
-        async with assert_device_properties_set(
-            self.subject._device, {HVACMODE_DPS: True, MODE_DPS: MODE_COOL}
-        ):
-            await self.subject.async_set_hvac_mode(HVACMode.COOL)
-
-    async def test_turn_on_to_heat(self):
-        async with assert_device_properties_set(
-            self.subject._device, {HVACMODE_DPS: True, MODE_DPS: MODE_HEAT}
-        ):
-            await self.subject.async_set_hvac_mode(HVACMode.HEAT)
-
-    async def test_turn_on_to_dry(self):
-        async with assert_device_properties_set(
-            self.subject._device, {HVACMODE_DPS: True, MODE_DPS: MODE_DRY}
-        ):
-            await self.subject.async_set_hvac_mode(HVACMode.DRY)
-
-    async def test_turn_on_to_fan(self):
-        async with assert_device_properties_set(
-            self.subject._device, {HVACMODE_DPS: True, MODE_DPS: MODE_FAN}
-        ):
-            await self.subject.async_set_hvac_mode(HVACMode.FAN_ONLY)
-
-    async def test_turn_off(self):
-        async with assert_device_properties_set(
-            self.subject._device, {HVACMODE_DPS: False}
-        ):
-            await self.subject.async_set_hvac_mode(HVACMode.OFF)
-
-    def test_fan_modes(self):
-        self.assertCountEqual(self.subject.fan_modes, ["low", "medium", "high"])