Raspberry Pi Spotify Display - Nowify, Homebridge, and More!
Project continues here:
Setup
A while ago, I set up a Raspberry Pi 3B and cheap touchscreen display to show the song I'm currently listening to on Spotify. I did this by installing Raspbian, and then running Jon Ashcroft's Nowify on the display, albeit with some slight modifications.I customized a couple of things. One, the "no music is currently playing" screen is now black, and less attention-grabby. Secondly, the font size got bumped up a little (a requirement for this tiny 7" screen, but still not enough!).
I also added one other helpful feature, though this one isn't a part of the Nowify site. I added integration with Apple Homekit through Homebridge, which allows me to remotely turn on and off the display from my phone. Hitting buttons on my phone sends a signal to my computer hosting the Homebridge server, which sends a command over SSH to the Raspberry Pi to enable or disable the screen. I can also automate this a little. I've found that I normally don't listen to music before the afternoon, and I don't listen after about 10:00pm, so I've automated the screen to turn on at about 1 or 2pm, and turn back off at around 10 or 11pm.
Previous Attempts
It took a bit to get to this point though. I tried a number of ways of displaying the Spotify status on here. At first, I installed a Raspbian desktop and just installed the Spotify app, which was a bit difficult, as the Raspberry Pi's normal desktop OS lacks some of the DRM features that Spotify requires. I was able to show Spotify in the browser, but that wasn't too interesting. It also didn't display well on the small screen.
Next up, I tried installing Android and running the Spotify app. This almost worked perfectly! It ran, it displayed what I was playing, the ui was built for small screens, it seemed perfect! But I ran into a bizarre issue: every time a song that had Spotify lyrics support would play, it would scroll down to show that and stop displaying the album art, song name, and artist. Not so perfect. I then wound up displaying Nowify on Android, which absolutely worked, but limited my remote access abilities. Android does has ADB, even wireless ADB, but it's not really the same as just proper SSH access. Or maybe I'm just not familiar enough with it.
So now we get to where I am now, a Raspbian desktop again, but this time just displaying Nowify. It works pretty great, I have full SSH (and VNC!) access to the Raspberry Pi, and there's more online help available since there's not too much support for Raspberry Pis running Android.
Goals
Now, I'm starting work on the most interesting and useful feature: a way to turn off the screen when nothing is playing. This will work by running a Java webserver on the Raspberry Pi, which can directly execute a command to kill and another command to re-enable the HDMI video ("vcgencmd display_power 0" to disable, and "vcgencmd display_power 1" to enable).
Status
At this point I have both the Raspberry Pi running the Nowify screen, Homebridge integration, as well as the Java webserver, but for the time being the Nowify site and Java webserver do not communicate with each other. A project for next time!
Comments
Post a Comment