-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Cyr-ius/develop
Develop
- Loading branch information
Showing
6 changed files
with
44 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,33 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
''' | ||
""" | ||
This example can be run safely as it won't change anything in your box configuration | ||
''' | ||
""" | ||
|
||
import asyncio | ||
import logging | ||
|
||
from heatzypy import HeatzyClient | ||
from heatzypy.heatzy import HeatzyClient | ||
|
||
logger = logging.getLogger() | ||
logger.setLevel(logging.DEBUG) | ||
# create console handler and set level to debug | ||
ch = logging.StreamHandler() | ||
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') | ||
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") | ||
ch.setFormatter(formatter) | ||
logger.addHandler(ch) | ||
|
||
username = "my-login" | ||
password = "my-password" | ||
USERNAME = "my-login" | ||
PASSWORD = "my-password" | ||
|
||
api = HeatzyClient(username, password) | ||
devices = api.async_get_devices() | ||
for device in devices: | ||
data = api.async_get_device_info(device["did"]) | ||
logger.info("Heater : {} , mode : {}".format(data.get("dev_alias"), data.get("attr").get("mode"))) | ||
async def main(): | ||
api = HeatzyClient(USERNAME, PASSWORD) | ||
devices = await api.async_get_devices() | ||
for device in devices: | ||
name = device.get("dev_alias") | ||
data = await api.async_get_device(device["did"]) | ||
mode = data.get("attr").get("mode") | ||
logger.info("Heater : {} , mode : {}".format(name, mode)) | ||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Heatzypy | ||
requests>=2.20.0 | ||
aiohttp>=3.8.1 |