Further Adventures with Music on Raspberry Pi

I have a Raspberry Pi 3B (not the Plus version) with a HiFiBerry Digi+ DAC HAT attached. This is connected to my old school Sony receiver via TOSLINK fiber. I also have a 10.1″ touchscreen attached. The goal of all of this was to build a digital jukebox to play my music collection through. The music files are stored on the NAS.

I’ve cycled through about every existing version of this that I could find, from Volumio to VLC to Plex to Mopidy to Kodi to all the countless forks and others. They have all left me lacking for such a simple task. They all seem to want to do too much, which means they fail at doing the basics.

After looking at the sad Kodi interface (OSMC, actually) display sitting on the touchscreen, it struck me that it would be a much better use of this resource if it were displaying my Home Assistant dashboard. This way, the whole family could get used to seeing the data that Home Assistant is collecting/displaying, like outside AQI and UV Index for a start. The northeast of the US was recently significantly impacted by wildfires burning across Canada. I found folks that had never paid attention to air quality before were suddenly versed in AQI. With Jenny and Calin’s allergies, I’ve been all up in AQI’s business for a few years now. Because of that, I already have the EPA’s AirNow API beaming data to my Home Assistant.

Anyway, thinking further on the uses I want out of this particular Pi, which is admittedly getting long in the tooth, but the Pi4 shortage remains a real thing for at least another month, I recalled that Home Assistant now handles some basic media player functionalities. Did you catch that? Basic functionalities.

This guy feels my pain, but he wants to keep everything local to the Pi. I want to be able to select the songs from the Pi3B itself, or from any web browser displaying the dashboard.

After years of experimentation with modern media center software I gave up. As usual, the simpler, the better, and cleaner, so welcome back MPD and VLC, and welcome raspotify.

Before I got started on this new adventure, I took one more pass through the Web to see if I could finally get this Pi to boot from SSD without the SD-Card in the slot. I can’t find the exact post that gave me the solution, but it looks like there was a mistake in the documentation. I found this post on Instructables that lists the correct syntax in “Step 2”. I wish I could find the original post that called out the mistake in the official docs. It might have been at the Raspberry Pi forums. Once I made the correction to the /boot/config.txt file, the checks started reporting in as expected. I flashed a fresh copy of RaspberryOS Lite to a 120GB SSD drive, powered down the Pi3B, removed the SD-Card, plugged in the SSD via a USB-to-SATA cable (which I had already been using with the same drive to store the music files locally on the Pi3B), booted up and… no joy.

I then reached for a different USB-to-SATA cable, one that I knew booted a Pi4 before. Powering on the Pi, this made all the difference! No more SD-Card!

I then started following this PiMyLifeUp guide to get Chromium to run on boot and in kiosk mode. I pointed it at my Home Assistant URL rather than the URLs in the guide, of course.

This pointed out a flaw in my logic, as I would need a desktop manager installed in order to launch Chromium, so I had to install that. Not a big deal, and this left me with a very light-weight install, which this Pi3B needs. In fact, I am finding that Chromium is a bit much for it, so I will continue looking for a lighter browser that supports kiosk mode. But, for now, it is working. I’d also like to get touch gestures working in Chromium (while I am using it). It looks like there used to be an add-on called chromeTouch, but it seems to be removed now. 🙁

With Home Assistant showing on the smaller 10.1″ screen, I spent some time updating and refreshing a few of the dashboard pages. I removed items that no longer worked or provided me with the value I was expecting, and streamlined the theme a bit but removing/changing cards that obviously did not seem to fit. I have some work still to go, but it is looking much better already. These are captured on my PC, but you get the gist. They fit perfectly on the smaller screen.

This next part is where things start getting sketchy. I thought that I had read that Home Assistant now has a media player baked in, but as of this release (2023.6.1), that seems to not be true. Or, at least, I have not found it. More research needed on that front, but I did find a media player in the HACS (user created) space.

At this point I found that I needed a refresher on DLNA. This guy’s site does a decent job of explaining it.

  • media server: where the files are stored
  • controller: frontend that allows the user to select which song to play
  • renderer: software that plays the selected file through the speakers

What I need is the server and the renderer to be both on this same Pi3B, if I want to play the files locally. I had already rsynced them all from the NAS to the SSD.
rsync -av --update pi@10.25.68.245:/volume1/music/ /home/pi/Music --iconv=UTF-8 --exclude '@eaDir'
I need to figure out how to do this sans password so that I can set it up in a cron job. I do not add music on the daily, so it isn’t that big a deal to do it manually. Those last two arguments are important. Everything should be UTF8 at this point, but alas. And the –exclude does not copy over the NAS-related metadata, which is considerable.

I then installed and configured minidlna, thus making the Pi3B a media server.

The controller would now be Home Assistant, even when the selection is made on the Pi3B, as it is really just a web page back to the Home Assistant server, which is a Pi4 running in the network rack in the basement.

That left the renderer to get sorted. Zeroing in…from 2014. And what gave the final, only kind of old, solution.

WORKING!

You can see in the bottom right corner that it says the renderer is named Test. That seems to be an artifact from testing (see link directly above) and is coming from Home Assistant. I have renamed it in the actual config file. I am hoping that this gets sorted out on its own eventually, but it is not a massive issue for me.

You can also see that this is a bare-bones operation. I would like to see the option to play an entire album, but, honestly, I rarely have time to listen to more than a song or two at a time these days. Perhaps this a “future will available” option. For now, though, I am reasonably happy with this set up. Way more happy than with OSMC, as this is providing me with all of my Home Assistant goodness and music at the same time.

This entry was posted in Geek and tagged , , , , , . Bookmark the permalink.

If you liked this post, please let me know!

This site uses Akismet to reduce spam. Learn how your comment data is processed.