From db381d04e447933470046fadaf9457ced87e25c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Thu, 31 Dec 2020 23:42:02 +0000 Subject: [PATCH] Move functionality of neohub.connect() into __init__. --- example.py | 7 ++++--- neohubapi/neohub.py | 5 +---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/example.py b/example.py index 11bf8b3..bf6f491 100755 --- a/example.py +++ b/example.py @@ -14,13 +14,14 @@ from neohubapi.enums import ScheduleFormat async def run(): hub = neohub.NeoHub() - await hub.connect() system = await hub.get_system() hub_data, thermostats = await hub.get_live_data() for device in thermostats: - print(f"Temperature in zone {device.name}: {device.temperature}") + print(f"Target temperature of {device.name}: {device.target_temperature}") await device.identify() + print(await hub.target_temperature_step) -logging.basicConfig(level=logging.DEBUG) + +#logging.basicConfig(level=logging.DEBUG) asyncio.run(run()) diff --git a/neohubapi/neohub.py b/neohubapi/neohub.py index 8bb081c..0074ab9 100644 --- a/neohubapi/neohub.py +++ b/neohubapi/neohub.py @@ -14,11 +14,8 @@ from neohubapi.neostat import NeoStat class NeoHub: - def __init__(self): + def __init__(self, host='Neo-Hub', port=4242): self._logger = logging.getLogger('neohub') - pass - - async def connect(self, host='Neo-Hub', port='4242'): self._host = host self._port = port