소스 검색

Add support for Ecostrad Accent iQ heating panels

Issue #108
Jason Rumney 4 년 전
부모
커밋
53d14bdfa4
5개의 변경된 파일154개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      ACKNOWLEDGEMENTS.md
  2. 1 0
      README.md
  3. 53 0
      custom_components/tuya_local/devices/ecostrad_accentiq_heater.yaml
  4. 8 0
      tests/const.py
  5. 90 0
      tests/devices/test_ecostrad_accentiq_heater.py

+ 2 - 0
ACKNOWLEDGEMENTS.md

@@ -68,3 +68,5 @@ Further device support has been made with the assistance of users.  Please consi
  - [miannelli516](https://github.com/miannelli516) for assistance with TR9B thermostats.
  - [edwinyoo44](https://github.com/edwinyoo44) for contributing support for JJPro JPD01 dehumidifiers and assistance with Poiema One purifiers.
  - [mpetcuRO](https://github.com/mpetcuRO) for assistance with Hysen HT08WE-2 thermometers.
+ - [Paul-C-S](https://github.com/Paul-C-S) for assistance with Ecostrad Accent iQ heaters.
+ 

+ 1 - 0
README.md

@@ -43,6 +43,7 @@ the device will not work despite being listed below.
 - Wetair WCH-750 heater
 - Kogan Flame effect heater - KAWHMFP20BA model
 - Nedis convection heater - WIFIHTPL20F models
+- Ecostrad Accent iQ heating panels
 
 ### Air Conditioners / Heatpumps
 

+ 53 - 0
custom_components/tuya_local/devices/ecostrad_accentiq_heater.yaml

@@ -0,0 +1,53 @@
+name: Ecostrad Accent iQ heater
+primary_entity:
+  entity: climate
+  dps:
+    - id: 1
+      type: boolean
+      name: hvac_mode
+      mapping:
+        - dps_val: true
+          value: heat
+        - dps_val: false
+          value: "off"
+    - id: 2
+      type: integer
+      name: temperature
+      range:
+        min: 0
+        max: 450
+      mapping:
+        - scale: 10
+          step: 5
+          constraint: temperature_unit
+          conditions:
+            - dps_val: false
+              step: 10
+              range:
+                min: 32
+                max: 113
+    - id: 3
+      type: integer
+      name: current_temperature
+      mapping:
+        - scale: 10
+    - id: 101
+      type: boolean
+      name: temperature_unit
+      mapping:
+        - dps_val: true
+          value: C
+        - dps_val: false
+          value: F
+secondary_entities:
+  - entity: number
+    name: Timer
+    category: config
+    dps:
+      - id: 10
+        type: integer
+        name: value
+        unit: min
+        range:
+          min: 0
+          max: 720

+ 8 - 0
tests/const.py

@@ -826,3 +826,11 @@ POIEMA_ONE_PURIFIER_PAYLOAD = {
     "18": "cancel",
     "19": 0,
 }
+
+ECOSTRAD_ACCENTIQ_HEATER_PAYLOAD = {
+    "1": True,
+    "2": 200,
+    "3": 195,
+    "10": 0,
+    "101": True,
+}

+ 90 - 0
tests/devices/test_ecostrad_accentiq_heater.py

@@ -0,0 +1,90 @@
+from homeassistant.components.climate.const import (
+    HVAC_MODE_HEAT,
+    HVAC_MODE_OFF,
+    SUPPORT_TARGET_TEMPERATURE,
+)
+from homeassistant.const import (
+    STATE_UNAVAILABLE,
+    TEMP_CELSIUS,
+    TEMP_FAHRENHEIT,
+    TIME_MINUTES,
+)
+
+from ..const import ECOSTRAD_ACCENTIQ_HEATER_PAYLOAD
+from ..helpers import assert_device_properties_set
+from ..mixins.climate import TargetTemperatureTests
+from ..mixins.number import BasicNumberTests
+from .base_device_tests import TuyaDeviceTestCase
+
+HVACMODE_DPS = "1"
+TEMPERATURE_DPS = "2"
+CURRENTTEMP_DPS = "3"
+TIMER_DPS = "10"
+UNIT_DPS = "101"
+
+
+class TestEcostradAccentIqHeater(
+    BasicNumberTests, TargetTemperatureTests, TuyaDeviceTestCase
+):
+    __test__ = True
+
+    def setUp(self):
+        self.setUpForConfig(
+            "ecostrad_accentiq_heater.yaml",
+            ECOSTRAD_ACCENTIQ_HEATER_PAYLOAD,
+        )
+        self.subject = self.entities.get("climate")
+        self.setUpTargetTemperature(
+            TEMPERATURE_DPS, self.subject, min=0.0, max=45.0, scale=10, step=5
+        )
+        self.setUpBasicNumber(
+            TIMER_DPS,
+            self.entities.get("number_timer"),
+            max=720,
+            unit=TIME_MINUTES,
+        )
+        self.mark_secondary(["number_timer"])
+
+    def test_supported_features(self):
+        self.assertEqual(
+            self.subject.supported_features,
+            SUPPORT_TARGET_TEMPERATURE,
+        )
+
+    def test_temperature_unit(self):
+        self.dps[UNIT_DPS] = True
+        self.assertEqual(self.subject.temperature_unit, TEMP_CELSIUS)
+        self.dps[UNIT_DPS] = False
+        self.assertEqual(self.subject.temperature_unit, TEMP_FAHRENHEIT)
+
+    def test_current_temperature(self):
+        self.dps[CURRENTTEMP_DPS] = 250
+        self.assertEqual(self.subject.current_temperature, 25.0)
+
+    def test_hvac_mode(self):
+        self.dps[HVACMODE_DPS] = True
+        self.assertEqual(self.subject.hvac_mode, HVAC_MODE_HEAT)
+
+        self.dps[HVACMODE_DPS] = False
+        self.assertEqual(self.subject.hvac_mode, HVAC_MODE_OFF)
+
+        self.dps[HVACMODE_DPS] = None
+        self.assertEqual(self.subject.hvac_mode, STATE_UNAVAILABLE)
+
+    def test_hvac_modes(self):
+        self.assertCountEqual(self.subject.hvac_modes, [HVAC_MODE_OFF, HVAC_MODE_HEAT])
+
+    async def test_turn_on(self):
+        async with assert_device_properties_set(
+            self.subject._device, {HVACMODE_DPS: True}
+        ):
+            await self.subject.async_set_hvac_mode(HVAC_MODE_HEAT)
+
+    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(HVAC_MODE_OFF)
+
+    def test_extra_state_attributes(self):
+        self.assertEqual(self.subject.extra_state_attributes, {})