Add functions to get zones/devices.
This commit is contained in:
parent
d44117d913
commit
b251f0c131
26
neohub.py
26
neohub.py
|
@ -190,3 +190,29 @@ class NeoHub:
|
|||
|
||||
result = await self._send(message, reply)
|
||||
return result
|
||||
|
||||
|
||||
async def get_zones(self):
|
||||
"""
|
||||
Returns list of zones and their ids
|
||||
|
||||
{"zone1": 1}
|
||||
"""
|
||||
|
||||
message = {"GET_ZONES": 0}
|
||||
|
||||
result = await self._send(message)
|
||||
return result
|
||||
|
||||
|
||||
async def get_devices(self):
|
||||
"""
|
||||
Returns list of devices
|
||||
|
||||
{"result": ["device1"]}
|
||||
"""
|
||||
|
||||
message = {"GET_DEVICES": 0}
|
||||
|
||||
result = await self._send(message)
|
||||
return result
|
||||
|
|
5
test.py
5
test.py
|
@ -15,11 +15,8 @@ async def run():
|
|||
hub = neohub.NeoHub()
|
||||
await hub.connect()
|
||||
system = await hub.get_system()
|
||||
print(vars(system))
|
||||
result = await hub.cancel_holiday()
|
||||
result = await hub.get_devices()
|
||||
print(result)
|
||||
result = await hub.get_holiday()
|
||||
print(vars(result))
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
|
Loading…
Reference in New Issue