Skip to content

Commit

Permalink
Fix server mimetype, fix parsing boolean for power, change night mode…
Browse files Browse the repository at this point in the history
… and turn off calendar integration
  • Loading branch information
amcolash committed Dec 7, 2023
1 parent 58810cc commit 3c3c84f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/python/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def __init__(self):
self.NIGHT_MODE_TIMEOUT = 15
self.NIGHT_MODE_START_HOUR = 0 # Starting hour when night mode begins (inclusive)
self.NIGHT_MODE_START_MINUTE = 30 # Starting minute when night mode begins (inclusive)
self.NIGHT_MODE_END_HOUR = 7 # Ending hour when night mode stops (exclusive)
self.NIGHT_MODE_END_HOUR = 23 # Ending hour when night mode stops (exclusive)
self.NIGHT_MODE_END_MINUTE = 30 # Ending minute when night mode stops (exclusive)

self.CYCLE_SPEED = 0.15
Expand Down Expand Up @@ -213,4 +213,4 @@ def update(self):
# Tell Display that things are dirty for next update
self.DIRTY = True

Config = Configuration()
Config = Configuration()
4 changes: 2 additions & 2 deletions src/python/midi_pi.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def update(self):
Config.update()
Leds.updateLeds()
Music.update()
Cal.update()
# Cal.update()
self.Display.update()
updatePendingActions(self.Display)

Expand Down Expand Up @@ -71,4 +71,4 @@ def profile(self):
finally:
MidiPorts.cleanup()
Server.running = False
print('Exit')
print('Exit')
8 changes: 5 additions & 3 deletions src/python/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, path, handler, contentType="application/json"):
'/status': GetRequest('/status', lambda req: status(req)),
'/stop': GetRequest('/stop', lambda req: stop(req)),
'/volume': GetRequest('/volume', lambda req: volume(req)),
'*': GetRequest('/', lambda req: other(req), 'application/html')
'*': GetRequest('/', lambda req: other(req), 'text/html')
}

def brightness(req):
Expand Down Expand Up @@ -121,12 +121,14 @@ def power(req):
query = parse_qs(req.query)

if 'value' in query:
on = bool(query['value'][0])
value = query['value'][0]

if on:
if value == "true" or value == "on":
Power.on()
print("on")
return status(req, "Turning on power")
else:
print("off")
Power.off()
return status(req, "Turning off power")

Expand Down

0 comments on commit 3c3c84f

Please sign in to comment.