From eea381a3626655f8a10614a117666c0330070582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Skowron?= Date: Sat, 4 May 2024 20:05:52 +0200 Subject: [PATCH] Make more standard set comfocollmode --- aiocomfoconnect/comfoconnect.py | 5 +++-- aiocomfoconnect/const.py | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/aiocomfoconnect/comfoconnect.py b/aiocomfoconnect/comfoconnect.py index e75d55e..c807168 100644 --- a/aiocomfoconnect/comfoconnect.py +++ b/aiocomfoconnect/comfoconnect.py @@ -27,6 +27,7 @@ VentilationSetting, VentilationSpeed, VentilationTemperatureProfile, + ComfoCoolMode, ) from aiocomfoconnect.exceptions import ( AioComfoConnectNotConnected, @@ -397,9 +398,9 @@ async def get_comfocool_mode(self): async def set_comfocool_mode(self, mode: Literal["auto", "off"], timeout=-1): """Set the comfocool mode (auto / off).""" - if mode == "auto": + if mode == ComfoCoolMode.AUTO: await self.cmd_rmi_request(bytes([0x85, UNIT_SCHEDULE, SUBUNIT_05, 0x01])) - else: + elif mode == ComfoCoolMode.OFF: await self.cmd_rmi_request(bytestring([0x84, UNIT_SCHEDULE, SUBUNIT_05, 0x01, 0x00, 0x00, 0x00, 0x00, timeout.to_bytes(4, "little", signed=True), 0x00])) async def get_temperature_profile(self): diff --git a/aiocomfoconnect/const.py b/aiocomfoconnect/const.py index 256e5ff..536f3e0 100644 --- a/aiocomfoconnect/const.py +++ b/aiocomfoconnect/const.py @@ -207,3 +207,9 @@ class VentilationSpeed: LOW = "low" MEDIUM = "medium" HIGH = "high" + +class ComfoCoolMode: + """Enum for ventilation settings.""" + + AUTO = "auto" + OFF = "off"