telnet
All checks were successful
Deploy powerbar.ti Frontend Portal / Deploy-Tinance2-Frontend-Portal-Production (push) Successful in 7s

This commit is contained in:
Matthew Frost 2023-11-22 10:14:30 +01:00
parent 113cefbe82
commit 9c5ad472c7

View file

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