start
All checks were successful
Deploy powerbar.ti Frontend Portal / Deploy-Tinance2-Frontend-Portal-Production (push) Successful in 7s
All checks were successful
Deploy powerbar.ti Frontend Portal / Deploy-Tinance2-Frontend-Portal-Production (push) Successful in 7s
This commit is contained in:
parent
b78cc4066a
commit
80f6d34ed2
1 changed files with 4 additions and 4 deletions
|
@ -4,7 +4,7 @@ from app.utils import run_telnet_command
|
|||
|
||||
scheduler = APScheduler()
|
||||
|
||||
@scheduler.task('interval', id='do_periodic_serial_job', seconds=4)
|
||||
@scheduler.task('interval', id='do_periodic_serial_job', seconds=3, max_instances=3)
|
||||
def periodic_serial_job():
|
||||
print("Running Sync Job")
|
||||
for powerbar in powerbars:
|
||||
|
@ -16,7 +16,7 @@ def periodic_serial_job():
|
|||
for outlet in powerbars[powerbar]['outlets']:
|
||||
outlet_status = powerbars[powerbar]['outlets'][outlet].get('state', 'unknown')
|
||||
|
||||
if outlet_status is not "unknown":
|
||||
if outlet_status != "unknown":
|
||||
if outlet_status == "on":
|
||||
on_command += f"{outlet},"
|
||||
|
||||
|
@ -25,11 +25,11 @@ def periodic_serial_job():
|
|||
|
||||
print(f"Turning on outlets: {on_command.rstrip(',')}")
|
||||
|
||||
if on_command is not "On ":
|
||||
if on_command != "On ":
|
||||
print("Running On command")
|
||||
run_telnet_command(powerbar, on_command.rstrip(','))
|
||||
|
||||
print(f"Turning off outlets: {off_command.rstrip(',')}")
|
||||
if off_command is not "Off ":
|
||||
if off_command != "Off ":
|
||||
print("Running Off command")
|
||||
run_telnet_command(powerbar, off_command.rstrip(','))
|
Loading…
Reference in a new issue