diff --git a/hackerman/hackerman.py b/hackerman/hackerman.py index f3a67e55d87993065e33881e124af25580eaf3a6..b623d51ed76a56da311c0c081bdcbd9043f177be 100644 --- a/hackerman/hackerman.py +++ b/hackerman/hackerman.py @@ -27,28 +27,29 @@ class Hackerman: """ del client try: - if 'haspa' in message: - if message['haspa'] in ['open', 'offen', 'auf']: - await self.hbf.publish('/haspa/power', { - 'table':1023, - 'fan':1023, - 'ledstrip':400, - }) - await self.hbf.publish('/haspa/music/control', { - 'play': True - }) - elif message['haspa'] in ['close', 'zu', 'closed']: - await self.hbf.publish('/haspa/power', { - 'table':0, - 'fan':0, - 'ledstrip':0, - 'alarm':0, - }) - await self.hbf.publish('/haspa/music/control', { - 'play': False - }) + if message['haspa'] in ['open', 'offen', 'auf']: + await self.hbf.publish('/haspa/power', { + 'table':1023, + 'fan':1023, + 'ledstrip':400, + }) + await self.hbf.publish('/haspa/music/control', { + 'play': True + }) + elif message['haspa'] in ['close', 'zu', 'closed']: + await self.hbf.publish('/haspa/power', { + 'table':0, + 'fan':0, + 'ledstrip':0, + 'alarm':0, + }) + await self.hbf.publish('/haspa/music/control', { + 'play': False + }) + else: + print("Haspa state undetermined: ", message['haspa']) except KeyError: - raise # because - fuck you sender! i will die now, silently. + print("/haspa/status message malformed: ", message) async def command_action(self, client, message, _): """ Handle actions like alarm or party """ @@ -68,7 +69,7 @@ class Hackerman: delay = 0.05 sounds = [ - ('56', 3.5), # führer + #('56', 3.5), # führer ('97', 4.7), # sonnenschein ('63', 5), #epische musik ('110', 3.7),#dota diff --git a/rupprecht/rupprecht.py b/rupprecht/rupprecht.py index 07768d3d2ca81de8c75ea928a7d82555bf1ea8b6..11e36ffbd93c2c849e9c0ee64ee5145564eb5ec2 100644 --- a/rupprecht/rupprecht.py +++ b/rupprecht/rupprecht.py @@ -58,21 +58,21 @@ class Rupprecht: for devid, value in msg.items(): try: if value == 0: - self.imposed_ids[devid].off() + await self.imposed_ids[devid].off() elif value == 1023: - self.imposed_ids[devid].on() + await self.imposed_ids[devid].on() except KeyError: pass async def button_message(self, msg): if msg['open'] and not self.space_is_open: self.space_is_open = True - await self.hbf.publish('/haspa/status', json.dumps({'haspa':'open'})) - self.rupprecht.text("Status: Open") + await self.hbf.publish('/haspa/status', {'haspa':'open'}) + self.rupprecht.text("Status:Open... StuStaNet.e.V....") elif not msg['open'] and self.space_is_open: self.space_is_open = False - await self.hbf.publish('/haspa/status', json.dumps({'haspa':'closed'})) - self.rupprecht.text("Status: Closed") + await self.hbf.publish('/haspa/status', {'haspa':'closed'}) + self.rupprecht.text("Status:Closed... StuStaNet.e.V....") class RupprechtInterface: class SerialProtocol(asyncio.Protocol): diff --git a/systemd/hauptbahnhof-module@.service b/systemd/hauptbahnhof-module@.service index 282a6b1df61c167d02aaeb0c2908b834b819b413..7eeeb8364269b41747ffc83ed72a3ed561b84c55 100644 --- a/systemd/hauptbahnhof-module@.service +++ b/systemd/hauptbahnhof-module@.service @@ -5,7 +5,7 @@ Before=hauptbahnhof.service [Service] Type=simple -User=johannes +User=hauptbahnhof WorkingDirectory=/usr/local/bin/hauptbahnhof ExecStart=/usr/local/bin/hauptbahnhof/venv/bin/python3 -m %i