This commit is contained in:
Matthew Frost 2023-11-19 01:16:41 +01:00
parent 169894dfc3
commit 45a0b72266

View file

@ -45,7 +45,6 @@ def powerbar_control(powerbar, outlet, action):
abort(404)
if action == 'on':
# Telnet to powerbar and send command
try:
print(f"Turning on powerbar {powerbar} outlet {outlet}")
tn = telnetlib.Telnet(powerbars[powerbar]['host'], powerbars[powerbar]['port'])
@ -55,10 +54,8 @@ def powerbar_control(powerbar, outlet, action):
except Exception as e:
print(f"Telnet error: {e}")
abort(500)
return "200"
if action == 'off':
# Telnet to powerbar and send command
try:
print(f"Turning off powerbar {powerbar} outlet {outlet}")
tn = telnetlib.Telnet(powerbars[powerbar]['host'], powerbars[powerbar]['port'])
@ -68,5 +65,6 @@ def powerbar_control(powerbar, outlet, action):
except Exception as e:
print(f"Telnet error: {e}")
abort(500)
return "200"