forked from andrius/neohubapi
Add NeoStat class.
This commit is contained in:
parent
5b590f577a
commit
7511b7b29e
11
neohub.py
11
neohub.py
|
@ -9,6 +9,7 @@ import logging
|
||||||
from enums import ScheduleFormat
|
from enums import ScheduleFormat
|
||||||
from system import System
|
from system import System
|
||||||
from holiday import Holiday
|
from holiday import Holiday
|
||||||
|
from neostat import NeoStat
|
||||||
|
|
||||||
|
|
||||||
class NeoHub:
|
class NeoHub:
|
||||||
|
@ -197,14 +198,18 @@ class NeoHub:
|
||||||
|
|
||||||
async def get_zones(self):
|
async def get_zones(self):
|
||||||
"""
|
"""
|
||||||
Returns list of zones and their ids
|
Get list of all thermostats
|
||||||
|
|
||||||
{"zone1": 1}
|
Returns a list of NeoStat objects
|
||||||
"""
|
"""
|
||||||
|
|
||||||
message = {"GET_ZONES": 0}
|
message = {"GET_ZONES": 0}
|
||||||
|
|
||||||
result = await self._send(message)
|
zones = await self._send(message)
|
||||||
|
result = []
|
||||||
|
for name,zone_id in zones.items():
|
||||||
|
result.append(NeoStat(name, zone_id))
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# SPDX-FileCopyrightText: 2020 Andrius Štikonas <andrius@stikonas.eu>
|
||||||
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
|
|
||||||
|
class NeoStat:
|
||||||
|
"""
|
||||||
|
Class representing NeoStat theormostat
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, name: str, zone_id: int):
|
||||||
|
self._name = name
|
||||||
|
self._zone_id = zone_id
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name(self):
|
||||||
|
""" Zone name. """
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
|
||||||
|
@property
|
||||||
|
def zone_id(self):
|
||||||
|
""" End of holiday. """
|
||||||
|
return self._zone_id
|
Loading…
Reference in New Issue