Sfoglia il codice sorgente

Add support for W'eau pool heatpumps

Issue #152
Jason Rumney 3 anni fa
parent
commit
f7e74d1032

+ 1 - 0
ACKNOWLEDGEMENTS.md

@@ -86,3 +86,4 @@ Further device support has been made with the assistance of users.  Please consi
 - [gschmidl](https://github.com/gschmidl) for assistance with Himox H05 purifier.
 - [daitj](https://github.com/daitj) for contributing support for Wilfa Haze humidifier.
 - [Utopia69](https://github.com/Utopia69) for providing additional info on his Fairland IPH45 heatpump (matching Madimack)
+- [Seopgroenten](https://github.com/Soepgronten) for assistance with W'eau pool heatpumps.

+ 2 - 0
README.md

@@ -67,6 +67,8 @@ the device will not work despite being listed below.
 - BWT FI 45 heatpump
 - Poolex Silverline and Vertigo heatpump
 - IPS Pro Pool-Systems Heatpump (seems to match Fairland Inver-X as well)
+- W'eau Pool Heatpump
+
 - these seem to use a small number of common controllers with minor variations, and many other Pool heatpumps will work using the above configurations.
   Report issues if there are any differences in presets or other features,
   or if any of the "unknown" values that are returned as attributes can

+ 51 - 0
custom_components/tuya_local/devices/weau_pool_heatpump.yaml

@@ -0,0 +1,51 @@
+name: W'Eau Pool Heatpump
+primary_entity:
+  entity: climate
+  dps:
+    - id: 1
+      type: boolean
+      name: power
+      hidden: true
+      mapping:
+        - dps_val: false
+          value: "off"
+    - id: 2
+      type: integer
+      name: temperature
+      range:
+        min: 7
+        max: 60
+    - id: 3
+      type: integer
+      name: current_temperature
+      mapping:
+        - scale: 10
+    - id: 4
+      type: string
+      name: hvac_mode
+      mapping:
+        - dps_val: hot
+          constraint: power
+          conditions:
+            - dps_val: false
+              value_redirect: power
+              value: "off"
+            - dps_val: true
+              value: heat
+        - dps_val: cold
+          constraint: power
+          conditions:
+            - dps_val: false
+              value_redirect: power
+            - dps_val: true
+              value: cool
+        - dps_val: auto
+          constraint: power
+          conditions:
+            - dps_val: false
+              value_redirect: power
+            - dps_val: true
+              value: heat_cool
+    - id: 6
+      type: integer
+      name: unknown_6

+ 1 - 1
custom_components/tuya_local/manifest.json

@@ -2,7 +2,7 @@
     "domain": "tuya_local",
     "iot_class": "local_polling",
     "name": "Tuya Local",
-    "version": "0.16.2",
+    "version": "0.16.3",
     "documentation": "https://github.com/make-all/tuya-local",
     "issue_tracker": "https://github.com/make-all/tuya-local/issues",
     "dependencies": [],

+ 8 - 0
tests/const.py

@@ -1181,3 +1181,11 @@ WILFA_HAZE_HUMIDIFIER_PAYLOAD = {
     "26": False,
     "35": False,
 }
+
+WEAU_POOL_HEATPUMP_PAYLOAD = {
+    "1": True,
+    "2": 33,
+    "3": 195,
+    "4": "auto",
+    "6": 0,
+}

+ 93 - 0
tests/devices/test_weau_pool_heatpump.py

@@ -0,0 +1,93 @@
+from homeassistant.components.climate.const import (
+    HVAC_MODE_HEAT,
+    HVAC_MODE_OFF,
+    HVAC_MODE_COOL,
+    HVAC_MODE_HEAT_COOL,
+    SUPPORT_TARGET_TEMPERATURE,
+)
+from homeassistant.const import TEMP_CELSIUS
+
+from ..const import WEAU_POOL_HEATPUMP_PAYLOAD
+from ..helpers import assert_device_properties_set
+from ..mixins.climate import TargetTemperatureTests
+from .base_device_tests import TuyaDeviceTestCase
+
+POWER_DPS = "1"
+TEMPERATURE_DPS = "2"
+CURRENTTEMP_DPS = "3"
+HVACMODE_DPS = "4"
+UNKNOWN6_DPS = "6"
+
+
+class TestWeauPoolHeatpump(
+    TargetTemperatureTests,
+    TuyaDeviceTestCase,
+):
+    __test__ = True
+
+    def setUp(self):
+        self.setUpForConfig("weau_pool_heatpump.yaml", WEAU_POOL_HEATPUMP_PAYLOAD)
+        self.subject = self.entities.get("climate")
+        self.setUpTargetTemperature(
+            TEMPERATURE_DPS,
+            self.subject,
+            min=7,
+            max=60,
+        )
+
+    def test_supported_features(self):
+        self.assertEqual(
+            self.subject.supported_features,
+            SUPPORT_TARGET_TEMPERATURE,
+        )
+
+    def test_current_temperature(self):
+        self.dps[CURRENTTEMP_DPS] = 194
+        self.assertEqual(self.subject.current_temperature, 19.4)
+
+    def test_hvac_mode(self):
+        self.dps[POWER_DPS] = True
+        self.dps[HVACMODE_DPS] = "hot"
+        self.assertEqual(self.subject.hvac_mode, HVAC_MODE_HEAT)
+        self.dps[HVACMODE_DPS] = "cold"
+        self.assertEqual(self.subject.hvac_mode, HVAC_MODE_COOL)
+        self.dps[HVACMODE_DPS] = "auto"
+        self.assertEqual(self.subject.hvac_mode, HVAC_MODE_HEAT_COOL)
+
+    def test_hvac_modes(self):
+        self.assertCountEqual(
+            self.subject.hvac_modes,
+            [HVAC_MODE_OFF, HVAC_MODE_COOL, HVAC_MODE_HEAT, HVAC_MODE_HEAT_COOL],
+        )
+
+    async def test_turn_off(self):
+        async with assert_device_properties_set(
+            self.subject._device,
+            {POWER_DPS: False},
+        ):
+            await self.subject.async_set_hvac_mode(HVAC_MODE_OFF)
+
+    async def test_set_cool(self):
+        async with assert_device_properties_set(
+            self.subject._device,
+            {POWER_DPS: True, HVACMODE_DPS: "cold"},
+        ):
+            await self.subject.async_set_hvac_mode(HVAC_MODE_COOL)
+
+    async def test_set_heat(self):
+        async with assert_device_properties_set(
+            self.subject._device,
+            {POWER_DPS: True, HVACMODE_DPS: "hot"},
+        ):
+            await self.subject.async_set_hvac_mode(HVAC_MODE_HEAT)
+
+    async def test_set_auto(self):
+        async with assert_device_properties_set(
+            self.subject._device,
+            {POWER_DPS: True, HVACMODE_DPS: "auto"},
+        ):
+            await self.subject.async_set_hvac_mode(HVAC_MODE_HEAT_COOL)
+
+    def test_extra_state_attributes(self):
+        self.dps[UNKNOWN6_DPS] = 6
+        self.assertDictEqual(self.subject.extra_state_attributes, {"unknown_6": 6})