Refactor api access

This commit is contained in:
Andre Basche 2023-04-09 20:50:28 +02:00
parent eb6741145a
commit 36fad84ee2
7 changed files with 107 additions and 85 deletions

View file

@ -11,7 +11,7 @@ from pprint import pprint
if __name__ == "__main__":
sys.path.insert(0, str(Path(__file__).parent.parent))
from pyhon import HonAPI
from pyhon import Hon, HonAPI
_LOGGER = logging.getLogger(__name__)
@ -104,8 +104,8 @@ async def main():
user = input("User for hOn account: ")
if not (password := args["password"]):
password = getpass("Password for hOn account: ")
async with HonAPI(user, password) as hon:
for device in hon.devices:
async with Hon(user, password) as hon:
for device in hon.appliances:
print("=" * 10, device.appliance_type, "-", device.nick_name, "=" * 10)
if args.get("keys"):
data = device.data.copy()