diff options
author | lassulus <lassulus@lassul.us> | 2018-06-28 19:05:27 +0200 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2018-06-28 19:05:27 +0200 |
commit | 284e77bfe5d4a68f021a311041cc4576b7be912a (patch) | |
tree | 6bd0761e82f664d27128a299ca48f5c3f14088c7 /reaktor/commands/licht_resolver | |
parent | 139a1116c35f57888853ebb3ff585e28921780ff (diff) |
Make Flake (somewhat) happy
Diffstat (limited to 'reaktor/commands/licht_resolver')
-rwxr-xr-x | reaktor/commands/licht_resolver | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/reaktor/commands/licht_resolver b/reaktor/commands/licht_resolver index 90d06c8..c86243e 100755 --- a/reaktor/commands/licht_resolver +++ b/reaktor/commands/licht_resolver @@ -1,37 +1,36 @@ #! /usr/bin/env python # -*- coding: utf-8 -*- +import json +from os import environ as env +from struct import unpack map = { - 'shackspace': { - 'device': { - 0: 'Licht0, Zickenzone; Fenster', - 1: 'Licht1, Sofaecke; Fenster', - 2: 'Licht2, Zickenzone; Ghetto', - 3: 'Licht3, Sofaecke; Ghetto', - 4: 'Licht4, Richtung Getränkelager', - 5: 'Licht5, Porschekonsole', - 6: 'Licht6, Tomatenecke', - 7: 'Licht7, Ghetto', - 10: 'Hauptschalter' - }, - 'state': { - 0: 'aus', - 1: 'an', - 2: 'aus in T-10s' - }, - '->': 'ist' - } + 'shackspace': { + 'device': { + 0: 'Licht0, Zickenzone; Fenster', + 1: 'Licht1, Sofaecke; Fenster', + 2: 'Licht2, Zickenzone; Ghetto', + 3: 'Licht3, Sofaecke; Ghetto', + 4: 'Licht4, Richtung Getränkelager', + 5: 'Licht5, Porschekonsole', + 6: 'Licht6, Tomatenecke', + 7: 'Licht7, Ghetto', + 10: 'Hauptschalter' + }, + 'state': { + 0: 'aus', + 1: 'an', + 2: 'aus in T-10s' + }, + '->': 'ist' + } } -from struct import unpack -import json -from os import environ as env - location = "shackspace" map = map[location] -print (env["payload"]+"") -did, sid= unpack('BB', json.loads(env['payload'])) -device,state = map['device'][did], map['state'][sid] +print(env["payload"]+"") +did, sid = unpack('BB', json.loads(env['payload'])) +device, state = map['device'][did], map['state'][sid] arrow = map['->'] -print ' '.join([device, arrow, state]) +print(' '.join([device, arrow, state])) |