From 9c5ad472c7fb59e36a64a93428962d6543db63bc Mon Sep 17 00:00:00 2001 From: Matthew Frost Date: Wed, 22 Nov 2023 10:14:30 +0100 Subject: [PATCH] telnet --- app/views.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views.py b/app/views.py index baeb112..62a05f7 100644 --- a/app/views.py +++ b/app/views.py @@ -166,7 +166,6 @@ def powebar_group_action(group, action): if action in ['on', 'off']: try: - for device in group["devices"]: powerbar = device["powerbar"] tn = telnetlib.Telnet(powerbars[powerbar]['host'], powerbars[powerbar]['port']) @@ -175,7 +174,7 @@ def powebar_group_action(group, action): print(f"Turning {action} powerbar {powerbar} outlet {outlets}") tn.write(f"{action} {outlets}\r\n".encode('ascii')) tn.close() - for outlet in outlets: + for outlet in powerbars[powerbar]['outlets']: powerbars[powerbar]['outlets'][outlet]['state'] = action print(f"Turned {action} powerbar {powerbar} outlet {outlet}")