aboutsummaryrefslogtreecommitdiffstats
path: root/reaktor/commands/licht_resolver
blob: c86243e26ea804f2279ae37b6e48dc8b92ea9a06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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'
    }
}

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]))