neohubapi/example.py

38 lines
938 B
Python
Raw Normal View History

#!/usr/bin/env python3
2021-01-02 22:42:56 +00:00
# SPDX-FileCopyrightText: 2020-2021 Andrius Štikonas <andrius@stikonas.eu>
2020-12-27 19:20:34 +00:00
# SPDX-License-Identifier: MIT
import asyncio
2020-11-21 10:48:09 +00:00
import datetime
import logging
import neohubapi.neohub as neohub
from neohubapi.enums import ScheduleFormat
2020-11-22 10:23:27 +00:00
async def run():
hub = neohub.NeoHub()
2020-11-20 23:39:20 +00:00
system = await hub.get_system()
2021-01-02 22:42:56 +00:00
hub_data, devices = await hub.get_live_data()
print("Thermostats:")
for device in devices['thermostats']:
print(f"Target temperature of {device.name}: {device.target_temperature}")
2020-12-20 22:58:04 +00:00
await device.identify()
2021-01-02 22:42:56 +00:00
print("Timeclocks:")
for device in devices['timeclocks']:
print(f"Timeclock {device.name}: {device.target_temperature}")
print(await hub.set_timer_hold(False, 1, [device]))
print(await hub.target_temperature_step)
2021-01-02 22:42:56 +00:00
def main():
logging.basicConfig(level=logging.DEBUG)
asyncio.run(run())
if (__name__ == '__main__'):
main()