Move functionality of neohub.connect() into __init__.

This commit is contained in:
Andrius Štikonas 2020-12-31 23:42:02 +00:00
parent da10de2d7a
commit db381d04e4
2 changed files with 5 additions and 7 deletions

View File

@ -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())

View File

@ -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