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

made hackerspace light even more versatile

parent d73a63c4
No related branches found
No related tags found
No related merge requests found
......@@ -88,6 +88,14 @@ class Babel(Hauptbahnhof):
f'Got error {e}.')
def handle_message(self, topic, payload, ttl):
# Handle /haspa/licht = 0 messages seperately, and turn _everything_ off
if topic == '/haspa/licht' and payload == 0:
# send a 0 message to every configured base channel
baseconfig = self.make_baseconfig_tree(self.config['basechannels'], "")
for channel in baseconfig:
self.send_message(channel, payload)
return
if ttl <= 0:
raise RuntimeError("ttl exceeded")
if topic in self.config['translation']:
......
......@@ -36,7 +36,15 @@ class Hackerman(Hauptbahnhof):
return
if message['haspa'] in ['open', 'offen', 'auf']:
self.publish('/haspa/licht', 400)
# set the best of all possible light settings
self.publish('/haspa/licht/w', 400)
self.publish('/haspa/licht/c', 100)
self.publish('/haspa/licht/tisch', 1)
self.publish('/haspa/tisch/r', 160)
self.publish('/haspa/tisch/g', 100)
self.publish('/haspa/tisch/b', 70)
self.publish('/haspa/tisch/w', 90)
self.publish('/haspa/music/control', {
'play': True
})
......
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