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

This commit is contained in:
Matthew Frost 2023-11-22 10:53:45 +01:00
parent cbfeacb7e1
commit ea551687f8
3 changed files with 11 additions and 10 deletions

View file

@ -1,19 +1,19 @@
groups = [
{
"name" : "Solder Lane",
"name" : "Solder Lane",
"devices" : [ { "powerbar": "powerbar-aux-space", "outlets" : [ 4, 17, 13 ] } ],
},
{
"name" : "Aux Space Lights",
"name" : "Aux Space Lights",
"devices" : [ { "powerbar": "powerbar-aux-space", "outlets" : [ 1, 17, 13] } ],
},
{
"name" : "Main Space Lights",
"devices" : [ { "powerbar" : "powerbar-main-space", "outlets" : [ 5, 6, 7, 8, 9, 10, 11, 12, 15 ] } ],
"name" : "Main Space Lights",
"devices" : [ { "powerbar" : "powerbar-main-space", "outlets" : [ 4, 5, 6, 7, 8, 9, 10, 11, 12, 15 ] } ],
},
{
"name" : "All Space Lights",
"devices" : [ { "powerbar" : "powerbar-main-space", "outlets" : [ 5, 6, 7, 8, 9, 10, 11, 12, 15 ] },
"name" : "All Space Lights",
"devices" : [ { "powerbar" : "powerbar-main-space", "outlets" : [ 4, 5, 6, 7, 8, 9, 10, 11, 12, 15 ] },
{ "powerbar" : "powerbar-aux-space", "outlets" : [ 1, 17, 13] }],
},
]

File diff suppressed because one or more lines are too long

View file

@ -174,9 +174,10 @@ 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 powerbars[powerbar]['outlets']:
powerbars[powerbar]['outlets'][outlet]['state'] = action
print(f"Turned {action} powerbar {powerbar} outlet {outlet}")
for outlet in device['outlets']:
if outlet in powerbars[powerbar]['outlets']:
powerbars[powerbar]['outlets'][outlet]['state'] = action
print(f"Turned {action} powerbar {powerbar} outlet {outlet}")
return jsonify({'status': "200"})
except Exception as E: