test
This commit is contained in:
parent
0e81584871
commit
169894dfc3
1 changed files with 2 additions and 0 deletions
|
@ -47,6 +47,7 @@ def powerbar_control(powerbar, outlet, action):
|
|||
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'])
|
||||
tn.write(f"on {outlet}\r\n".encode('ascii'))
|
||||
tn.close()
|
||||
|
@ -59,6 +60,7 @@ def powerbar_control(powerbar, outlet, action):
|
|||
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'])
|
||||
tn.write(f"off {outlet}\r\n".encode('ascii'))
|
||||
tn.close()
|
||||
|
|
Loading…
Reference in a new issue