Parcourir la source

Add support for Qoto Sprinkler controller / water valve.

Issue #71
Jason Rumney il y a 4 ans
Parent
commit
a483f637d6

+ 1 - 1
ACKNOWLEDGEMENTS.md

@@ -14,7 +14,7 @@ Further device support has been made with the assistance of users.  Please consi
 - [botts7](https://github.com/botts7) for support towards widening Kogan SmartPlug support.
 - [awaismun](https://github.com/awaismun) for assistance in supporting Andersson heaters.
 - [FeikoJoosten](https://github.com/FeikoJoosten) for development of support for Eurom heaters.
-- [Xeovar](https://github.com/Xeovar) for assistance in supporting Purline M100 heaters and Garden PAC pool heatpumps.
+- [Xeovar](https://github.com/Xeovar) for assistance in supporting Purline M100 heaters, Garden PAC pool heatpumps and Qoto sprinklers.
 - [paulmfclark](https://github.com/paulmfclark) for assistance in supporting Remora Inverter pool heatpumps
 - [cartman10](https://github.com/cartman10) for assistance with BWT FI 45 pool heater.
  - [superman110](https://github.com/superman110) for assistance in supporting Eanons/purenjoy humidifier.

+ 3 - 0
README.md

@@ -107,6 +107,9 @@ the device will not work despite being listed below.
 - Other brands may work with the above configurations
 - Simple Switch - a switch only, can be a fallback for many other unsupported devices, to allow just power to be switched on/off.
 
+### Miscellaneous
+- Qoto 03 Smart Water Valve / Sprinkler Controller
+
 ---
 
 ## Installation

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

@@ -0,0 +1,51 @@
+name: QOTO 03 Sprinkler Controller
+primary_entity:
+  entity: number
+  dps:
+    - id: 102
+      type: integer
+      name: value
+      range:
+        min: 0
+        max: 100
+      mapping:
+        - step: 5
+secondary_entities:
+  - entity: sensor
+    category: diagnostic
+    name: Open
+    dps:
+      - id: 103
+        name: sensor
+        type: integer
+        unit: "%"
+  - entity: sensor
+    category: diagnostic
+    name: Timer
+    dps:
+      - id: 104
+        name: sensor
+        type: integer
+        unit: s
+  - entity: number
+    category: config
+    name: Timer
+    dps:
+      - id: 105
+        type: integer
+        name: value
+        range:
+          min: 0
+          max: 86399
+  - entity: binary_sensor
+    name: Error
+    category: diagnostic
+    class: problem
+    dps:
+      - id: 108
+        name: sensor
+        type: integer
+        mapping:
+          - dps_val: 0
+            value: false
+          - value: true

+ 8 - 6
custom_components/tuya_local/translations/en.json

@@ -33,10 +33,10 @@
 		    "select": "Include a select entity",
 		    "sensor": "Include a sensor entity",
 		    "switch": "Include a switch entity",
-		    "binary_sensor_continuous_heat", "Include continuous heat alarm as a binary_sensor entity",
+		    "binary_sensor_continuous_heat": "Include continuous heat alarm as a binary_sensor entity",
 		    "binary_sensor_defrost": "Include defrost as a binary_sensor entity.",
-		    "binary_sensor_high_temperature", "Include high temperature alarm as a binary_sensor entity",
-		    "binary_sensor_low_temperature", "Include low temperature alarm as a binary_sensor entity",
+		    "binary_sensor_high_temperature": "Include high temperature alarm as a binary_sensor entity",
+		    "binary_sensor_low_temperature": "Include low temperature alarm as a binary_sensor entity",
 		    "binary_sensor_tank": "Include tank as a binary_sensor entity",
 		    "binary_sensor_water_flow": "Include water flow warning as a binary_sensor entity",
 		    "climate_dehumidifier_as_climate": "Include a climate entity for the dehumidifier (deprecated, recommend using humidifier and fan instead)",
@@ -73,6 +73,7 @@
 		    "sensor_floor_temperature": "Include floor temperature as a sensor entity",
 		    "sensor_current": "Include current as a sensor entity",
 		    "sensor_voltage": "Include voltage as a sensor entity",
+		    "sensor_open": "Include open as a sensor entity",
 		    "switch_adaptive": "Include adaptive as a switch entity",
 		    "switch_air_clean": "Include air clean as a switch entity",
 		    "switch_ionizer": "Include ionizer as a switch entity",
@@ -112,10 +113,10 @@
 		"select": "Include a select entity",
 		"sensor": "Include a sensor entity",
 		"switch": "Include a switch entity",
-		"binary_sensor_continuous_heat", "Include continuous heat alarm as a binary_sensor entity",
+		"binary_sensor_continuous_heat": "Include continuous heat alarm as a binary_sensor entity",
 		"binary_sensor_defrost": "Include defrost as a binary_sensor entity.",
-		"binary_sensor_high_temperature", "Include high temperature alarm as a binary_sensor entity",
-		"binary_sensor_low_temperature", "Include low temperature alarm as a binary_sensor entity",
+		"binary_sensor_high_temperature": "Include high temperature alarm as a binary_sensor entity",
+		"binary_sensor_low_temperature": "Include low temperature alarm as a binary_sensor entity",
 		"binary_sensor_tank": "Include tank as a binary_sensor entity.",
 		"binary_sensor_water_flow": "Include water flow warning as a binary_sensor entity",
 		"climate_dehumidifier_as_climate": "Include a climate entity for the dehumidifier (deprecated, recommend using humidifier and fan instead)",
@@ -152,6 +153,7 @@
 		"sensor_floor_temperature": "Include floor temperature as a sensor entity",
 		"sensor_current": "Include current as a sensor entity",
 		"sensor_voltage": "Include voltage as a sensor entity",
+		"sensor_open": "Include open as a sensor entity",
 		"switch_adaptive": "Include adaptive as a switch entity",
 		"switch_air_clean": "Include air clean as a switch entity",
 		"switch_ionizer": "Include ionizer as a switch entity",

+ 8 - 0
tests/const.py

@@ -562,3 +562,11 @@ STIRLING_FS1_FAN_PAYLOAD = {
     "5": False,
     "22": "cancel",
 }
+
+QOTO_SPRINKLER_PAYLOAD = {
+    "102": 100,
+    "103": 100,
+    "104": 10036,
+    "105": 10800,
+    "108": 0,
+}

+ 61 - 0
tests/devices/test_qoto_03_sprinkler.py

@@ -0,0 +1,61 @@
+"""Tests for the Quto 03 Sprinkler."""
+from homeassistant.components.binary_sensor import DEVICE_CLASS_PROBLEM
+
+from ..const import QOTO_SPRINKLER_PAYLOAD
+from ..mixins.binary_sensor import BasicBinarySensorTests
+from ..mixins.number import MultiNumberTests
+from ..mixins.sensor import MultiSensorTests
+from .base_device_tests import TuyaDeviceTestCase
+
+TARGET_DPS = "102"
+CURRENT_DPS = "103"
+COUNTDOWN_DPS = "104"
+TIMER_DPS = "105"
+ERROR_DPS = "108"
+
+
+class TestQoboSprinkler(
+    BasicBinarySensorTests,
+    MultiNumberTests,
+    MultiSensorTests,
+    TuyaDeviceTestCase,
+):
+    __test__ = True
+
+    def setUp(self):
+        self.setUpForConfig("qoto_03_sprinkler.yaml", QOTO_SPRINKLER_PAYLOAD)
+        self.setUpBasicBinarySensor(
+            ERROR_DPS,
+            self.entities.get("binary_sensor_error"),
+            device_class=DEVICE_CLASS_PROBLEM,
+            testdata=(1, 0),
+        )
+        self.setUpMultiNumber(
+            [
+                {
+                    "name": "number",
+                    "dps": TARGET_DPS,
+                    "max": 100,
+                    "step": 5,
+                },
+                {
+                    "name": "number_timer",
+                    "dps": TIMER_DPS,
+                    "max": 86399,
+                },
+            ]
+        )
+        self.setUpMultiSensors(
+            [
+                {
+                    "name": "sensor_open",
+                    "dps": CURRENT_DPS,
+                    "unit": "%",
+                },
+                {
+                    "name": "sensor_timer",
+                    "dps": COUNTDOWN_DPS,
+                    "unit": "s",
+                },
+            ]
+        )