Day 4 — Almost finished!

Published at: July 26, 2020
Last modified: September 10, 2020
cd ..

So, I spent two days doing all the software (now available in GitHub), and this is how it works:

The editor

This is a webpage hosted in Vercel (because I don’t want to use so much CPU of the RasPi): this one. Here, you tell the page the IP of the RasPi and HTTP to it (later I’ll explain it) to get all the settings.

If you’re no signed in with Spotify, the editor itself will handle the Authorization Flow and will POST to the RasPi with the credentials.

It has a dashboard-like interface, with all the values to change. When you are finished editing the settings, it will POST the changes.

Finally, it has and API endpoint that returns the all the Spotify data of the song that will be played.

The Editor

The Wake-up-ator (WUA)

This is made of two parts: the firt one is the editor server, that is the one the Editor is talking to. It only has two methods: GET and POST, which sends and recieves-writes the settings.

The second part is all the Python scripts than control the lights and the music. Each 15 minutes, a cron executes, and it decides what to do depending on the time: it can turns the lights on, changes it colors, or plays the alarm.


Login Flow
Settings change Flow
Get Song Flow

Things that shouldn’t be that way

← Day 3 | Day 5 →