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 = [ groups = [
{ {
"name" : "Solder Lane", "name" : "Solder Lane",
"devices" : [ { "powerbar": "powerbar-aux-space", "outlets" : [ 4, 17, 13 ] } ], "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] } ], "devices" : [ { "powerbar": "powerbar-aux-space", "outlets" : [ 1, 17, 13] } ],
}, },
{ {
"name" : "Main Space Lights", "name" : "Main Space Lights",
"devices" : [ { "powerbar" : "powerbar-main-space", "outlets" : [ 5, 6, 7, 8, 9, 10, 11, 12, 15 ] } ], "devices" : [ { "powerbar" : "powerbar-main-space", "outlets" : [ 4, 5, 6, 7, 8, 9, 10, 11, 12, 15 ] } ],
}, },
{ {
"name" : "All Space Lights", "name" : "All Space Lights",
"devices" : [ { "powerbar" : "powerbar-main-space", "outlets" : [ 5, 6, 7, 8, 9, 10, 11, 12, 15 ] }, "devices" : [ { "powerbar" : "powerbar-main-space", "outlets" : [ 4, 5, 6, 7, 8, 9, 10, 11, 12, 15 ] },
{ "powerbar" : "powerbar-aux-space", "outlets" : [ 1, 17, 13] }], { "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}") print(f"Turning {action} powerbar {powerbar} outlet {outlets}")
tn.write(f"{action} {outlets}\r\n".encode('ascii')) tn.write(f"{action} {outlets}\r\n".encode('ascii'))
tn.close() tn.close()
for outlet in powerbars[powerbar]['outlets']: for outlet in device['outlets']:
powerbars[powerbar]['outlets'][outlet]['state'] = action if outlet in powerbars[powerbar]['outlets']:
print(f"Turned {action} powerbar {powerbar} outlet {outlet}") powerbars[powerbar]['outlets'][outlet]['state'] = action
print(f"Turned {action} powerbar {powerbar} outlet {outlet}")
return jsonify({'status': "200"}) return jsonify({'status': "200"})
except Exception as E: except Exception as E: