summaryrefslogtreecommitdiffstats
path: root/Reaktor/commands/licht_resolver
diff options
context:
space:
mode:
authortv <tv@iiso>2011-09-27 00:12:49 +0200
committertv <tv@iiso>2011-09-27 00:12:49 +0200
commitecc173f3f472efcabf12693e17866930768af82b (patch)
tree59a1098d3f147d7fa09c84807e415535dcf6679e /Reaktor/commands/licht_resolver
parentf541b6139ca8ecbc64c736179604280e3006bede (diff)
parent592331580802ace9e96f3e4369bc9019f8e484b9 (diff)
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'Reaktor/commands/licht_resolver')
-rwxr-xr-xReaktor/commands/licht_resolver37
1 files changed, 37 insertions, 0 deletions
diff --git a/Reaktor/commands/licht_resolver b/Reaktor/commands/licht_resolver
new file mode 100755
index 00000000..5bdb6510
--- /dev/null
+++ b/Reaktor/commands/licht_resolver
@@ -0,0 +1,37 @@
+#! /usr/bin/python
+# -*- coding: utf-8 -*-
+
+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'
+ }
+}
+
+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]
+arrow = map['->']
+print ' '.join([device, arrow, state])