From f8803a7b15a052be807b65c243f34d8a0845eadf Mon Sep 17 00:00:00 2001 From: Roberto Cosenza Date: Wed, 23 Jun 2021 11:51:37 +0100 Subject: [PATCH] Lint and fix some subtle bugs --- neohubapi/enums.py | 1 + neohubapi/neohub.py | 7 ++++--- neohubapi/neostat.py | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/neohubapi/enums.py b/neohubapi/enums.py index e14decf..1c21c47 100644 --- a/neohubapi/enums.py +++ b/neohubapi/enums.py @@ -46,6 +46,7 @@ class Weekday(enum.Enum): SATURDAY = "saturday" SUNDAY = "sunday" + class HCMode(enum.Enum): AUTO = "AUTO" COOLING = "COOLING" diff --git a/neohubapi/neohub.py b/neohubapi/neohub.py index f465cf8..fc28c70 100644 --- a/neohubapi/neohub.py +++ b/neohubapi/neohub.py @@ -171,13 +171,16 @@ class NeoHub: message = {"SET_TEMP_FORMAT": temp_format} reply = {"result": f"Temperature format set to {temp_format}"} + result = await self._send(message, reply) + return result + async def set_hc_mode(self, hc_mode: HCMode, devices: [NeoStat]): """ Set hc_mode to AUTO or... """ names = self._devices_to_names(devices) message = {"SET_HC_MODE": [hc_mode.value, names]} - reply = {"result": f"HC_MODE was set"} + reply = {"result": "HC_MODE was set"} result = await self._send(message, reply) return result @@ -560,5 +563,3 @@ class NeoHub: result = await self._send(message, reply) return result - - diff --git a/neohubapi/neostat.py b/neohubapi/neostat.py index eee0758..204c50a 100644 --- a/neohubapi/neostat.py +++ b/neohubapi/neostat.py @@ -8,6 +8,7 @@ from types import SimpleNamespace from async_property import async_property +from neohubapi.enums import HCMode from neohubapi.enums import Weekday @@ -165,7 +166,7 @@ class NeoStat(SimpleNamespace): result = await self._hub.set_target_temperature(temperature, [self]) return result - async def set_hc_mode(self, hc_mode: str): + async def set_hc_mode(self, hc_mode: HCMode): result = await self._hub.set_hc_mode(hc_mode, [self]) return result