Check out my latest project Spotifynd - it monitors your Spotify playback and automatically moves media to play on speakers in the room you are in (based on room presence detection). Then as you move to a different room, your music is transferred to speakers in your new room.
This project started off as an implementation of a new use case that my Comprehensive Room Presence Detection project now allows. As usual, it ended up down many rabbit holes and with screens full of debug nodes in NodeRED. But the end result is pretty fun!
Spotifynd can be let loose to transfer any music you start playing on Spotify (on your phone or desktop clients etc.) to speakers in the room you are in. Then, if you move to a different room, your music will follow you and switch to playing on speakers in the new room. This is all thanks to the great Spotcast integration. All this can happen automatically with no user intervention. Or, Spotifynd can be set to notify you before starting if you’re not quite ready to let it run wild. Actionable notifications give you more detailed control whenever Spotifynd is running.
Whenever the Home Assistant Spotify integration recognises that media is playing, Spotifynd is either started automatically or an actionable notification is sent asking the user to start it. Spotifynd will never start if you are away from home (based on home/away presence detection using the person integration). If you have headphones connected and you’re playing Spotify on your phone, you’ll be asked if you’d like Spotifynd to start even if it’s set to run automatically since you likely don’t want Spotifynd to run in this scenario.
Once running, your music automatically follows you based on your room presence detection entity. Along the way if you enter a room that has no speakers or if a speaker isn’t available, you’ll be notified. While Spotifynd is following you, you’ll see an actionable notification that allows you to stop Spotifynd from following you (but keep media playing), stop media entirely (along with the follow mode) or to stop Spotifynd from following you and to send your music back to the previous room you are in.
Spotifynd works for multiple users simultaneously and handles tracked users entering the same room by giving the last person the option to override whatever is already playing. I’ve also included some examples on how to trigger Spotifynd via scripts for different people in specific rooms so you can easily start playback with the press of a button or by scanning an NFC tag.
All the logic is handled in NodeRED with only a few requirements. I’ve also configured the nodes so that hard coding is only required in 4 areas. In other places, the relevant user is automatically set, and the same flows work for everyone. Naturally, this requires either similar naming conventions or some modifications to the nodes that trigger flows.
This is my second write up of a larger project (after my room presence workflow) that I’ve been working on for a month or two. If you have any questions or suggestions, I’d be happy to try and help.
See my website for an in-depth guide on how it all works and to download the flows for you to try: