I’ve always appreciated how friends can tell their big tech smart speakers to play some artist-or-song and the speaker would play the requested material, sourced from their music streaming service. But my goal has always been to integrate voice with our media player to play from our in-house digital music collection over our home A/V system.
I had long pinned my hopes on MyCroft, which went unrealized when MyCroft imploded early in 2023. But then became so excited as Year of the Voice progressed!
And it actually works pretty marvelously on our Wyoming satellite speaker. I can now request Nabu to “play some Rolling Stones” or “play upbeat tunes” or “play Everybody Wants to Rule the World”, and our home A/V system+Kodi will do it!
Here’s what I did to make it work:
- wrote an on-demand process to extract the metadata from our digital music files, to produce a flat file
- wrote a second on-demand process that consumes the flat file to populate a custom search index
- created a web service on our webserver that accepts keywords, then searches the index to find the best matching playlist or song file, and instructs the media player to play it, via the Kodi API
- wrote a short shell script in Home Assistant that forwards keyword requests to the webservice
- established a Home Assistant conversation automation triggered from the word “play” that passes the spoken text to the shell script service - which I feared might be the difficult part, but was wonderfully easy
I’ve also conversation automation(s) to do play/pause/next/previous/stop/shuffle/repeat. I have it work through the Logitech Harmony integration, but it would be pretty easy to direct these at the Kodi through the API.
I must admit I’ve never looked into Home Assistant’s built-in media player, mostly as I’ve assumed it wouldn’t work with the Kodi system. And so I can’t currently request “play the album with the rainbow cover”, though that is really cool.