Skip to content
Snippets Groups Projects
Commit ed78085e authored by Johannes Walcher's avatar Johannes Walcher
Browse files

minor fixes for deployment

parent c78bdd21
No related branches found
No related tags found
No related merge requests found
...@@ -27,28 +27,29 @@ class Hackerman: ...@@ -27,28 +27,29 @@ class Hackerman:
""" """
del client del client
try: try:
if 'haspa' in message: if message['haspa'] in ['open', 'offen', 'auf']:
if message['haspa'] in ['open', 'offen', 'auf']: await self.hbf.publish('/haspa/power', {
await self.hbf.publish('/haspa/power', { 'table':1023,
'table':1023, 'fan':1023,
'fan':1023, 'ledstrip':400,
'ledstrip':400, })
}) await self.hbf.publish('/haspa/music/control', {
await self.hbf.publish('/haspa/music/control', { 'play': True
'play': True })
}) elif message['haspa'] in ['close', 'zu', 'closed']:
elif message['haspa'] in ['close', 'zu', 'closed']: await self.hbf.publish('/haspa/power', {
await self.hbf.publish('/haspa/power', { 'table':0,
'table':0, 'fan':0,
'fan':0, 'ledstrip':0,
'ledstrip':0, 'alarm':0,
'alarm':0, })
}) await self.hbf.publish('/haspa/music/control', {
await self.hbf.publish('/haspa/music/control', { 'play': False
'play': False })
}) else:
print("Haspa state undetermined: ", message['haspa'])
except KeyError: 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, _): async def command_action(self, client, message, _):
""" Handle actions like alarm or party """ """ Handle actions like alarm or party """
...@@ -68,7 +69,7 @@ class Hackerman: ...@@ -68,7 +69,7 @@ class Hackerman:
delay = 0.05 delay = 0.05
sounds = [ sounds = [
('56', 3.5), # führer #('56', 3.5), # führer
('97', 4.7), # sonnenschein ('97', 4.7), # sonnenschein
('63', 5), #epische musik ('63', 5), #epische musik
('110', 3.7),#dota ('110', 3.7),#dota
......
...@@ -58,21 +58,21 @@ class Rupprecht: ...@@ -58,21 +58,21 @@ class Rupprecht:
for devid, value in msg.items(): for devid, value in msg.items():
try: try:
if value == 0: if value == 0:
self.imposed_ids[devid].off() await self.imposed_ids[devid].off()
elif value == 1023: elif value == 1023:
self.imposed_ids[devid].on() await self.imposed_ids[devid].on()
except KeyError: except KeyError:
pass pass
async def button_message(self, msg): async def button_message(self, msg):
if msg['open'] and not self.space_is_open: if msg['open'] and not self.space_is_open:
self.space_is_open = True self.space_is_open = True
await self.hbf.publish('/haspa/status', json.dumps({'haspa':'open'})) await self.hbf.publish('/haspa/status', {'haspa':'open'})
self.rupprecht.text("Status: Open") self.rupprecht.text("Status:Open... StuStaNet.e.V....")
elif not msg['open'] and self.space_is_open: elif not msg['open'] and self.space_is_open:
self.space_is_open = False self.space_is_open = False
await self.hbf.publish('/haspa/status', json.dumps({'haspa':'closed'})) await self.hbf.publish('/haspa/status', {'haspa':'closed'})
self.rupprecht.text("Status: Closed") self.rupprecht.text("Status:Closed... StuStaNet.e.V....")
class RupprechtInterface: class RupprechtInterface:
class SerialProtocol(asyncio.Protocol): class SerialProtocol(asyncio.Protocol):
......
...@@ -5,7 +5,7 @@ Before=hauptbahnhof.service ...@@ -5,7 +5,7 @@ Before=hauptbahnhof.service
[Service] [Service]
Type=simple Type=simple
User=johannes User=hauptbahnhof
WorkingDirectory=/usr/local/bin/hauptbahnhof WorkingDirectory=/usr/local/bin/hauptbahnhof
ExecStart=/usr/local/bin/hauptbahnhof/venv/bin/python3 -m %i ExecStart=/usr/local/bin/hauptbahnhof/venv/bin/python3 -m %i
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment