forked from andrius/neohubapi
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)
|
result = await self._send(message, reply)
|
||||||
return result
|
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()
|
hub = neohub.NeoHub()
|
||||||
await hub.connect()
|
await hub.connect()
|
||||||
system = await hub.get_system()
|
system = await hub.get_system()
|
||||||
print(vars(system))
|
result = await hub.get_devices()
|
||||||
result = await hub.cancel_holiday()
|
|
||||||
print(result)
|
print(result)
|
||||||
result = await hub.get_holiday()
|
|
||||||
print(vars(result))
|
|
||||||
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
Loading…
Reference in New Issue