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}")