BalenaSound - Spotify Connect does not connect

Hi folks,

I am struggling with getting BalenaSoud to stay stable on my Raspberry Pi’s to run Spotify Connect with Multiroom-audio.

This is the 3rd or 4th time that the raspberry’s stop playing nice with Spotify Connect. Previously my Pi’s disappeared from Spotify altogether. But currently it’s different:

On my Pi3 I can always see the device in Spotify Connect. But it does not accept any connections from Spotify source devices (laptop/iPhone), it will say “Connecting to Pi3” for a bit, and then stop trying to connect. Airplay does work, but I cannot see the device through bluetooth.

On my Pi4 I can only see the device in Spotify Connect for a few minutes after rebooting/restarting all services. If I try to connect using Spotify Connect my source device (laptop/iPhone) will say “Connecting to Pi4” for a bit, and then not connect and it’ll stop trying. I cannot see this device in Airplay. The Pi4 disappears from the Spotify Connect list, and the BalenaCloud dashboard will tell me that the status is offline.

I have looked around a bit for similar problems, but could not find solutions that worked. Issue 193624 seems storage related, which is not an issue for me.

I might need some guidance in providing the right logs/diagnostics if you folks gain insights from that :slight_smile:

My thanks already for any thoughts and ideas! Because when it does work the whole Multiroom audio is magical!

(A separate thing is that I noticed the lag between Spotify input and music playing got greater over time. when it reached 6-7 seconds I would restart all services to make the delay shorter to a second or so. any ideas would be appreciated :slight_smile: )

Hello there @tuliptrader, I’m glad you are liking balenaSound in spite of the trouble it’s giving you :slight_smile:

Let’s see if I can help you out. First thing you can do is to run the diagnostics checks, that will run a few scripts that will check for a few very common problems. To run it go to the diagnostics page by navigating from your device page sidebar on balenaCloud, you’ll see there is a Diagnostics tab.

Next thing you can do is to share balenaSound logs. To do that go through the following sequence:

  1. go to your devcice page on balenaCloud dashboard
  2. Power cycle your devices (either by unplugging/plugging or rebooting from the dashboard)
  3. Wait for everything to start up
  4. Reproduce the error (i.e: attempt to connect via Spotify Connect or any of the features that were failing)
  5. Download logs and share them here (there is a download button in the dashboard).

Hi tmigone,

Thank you for you quick att

While still tinkering I added SOUND_SPOTIFY_USERNAME and SOUND_SPOTIFY_PASSWORD environmental variables after which the Pi3 started to work with Spotify Connect. attached its log. It also remained working after I removed the Spotify login variables.

With the Pi4 I tried updating BalenaOS, (mind that the previous build was created in October 2021). This didn’t help. Now goes offline or to online (VPN only) really quickly. I am unable to make an attempt to connect and run the Diagnostics so far. I’ll keep trying to get a log, because it would be good for me to understand.

Pi3_Diagnostics_Balena_working_f967c35cf475b9e1661c289e285c8dcf_diagnostics_2021.12.21_21.22.55+0000.txt (616.1 KB)

While typing my previous reply I was doing some googling.

In the Dashboard log I saw something with “Spotify” and “BadCredentials”. This led me a thread to just add a space into the Spotify password in the environmental variable as well as going to Spotify.com to change the password to include a space. Spotify Connect now also works on my Pi4. However, I cannot run the Diagnostics check still to get a log on the Pi4.

Are the below Port forwards to blame? These are only in place for the Pi4. The Pi3 does not have any port forwards related to it. Before I had these the Pi4 would not get an “Online” status. I think it was “Online (Heartbeat)” before. Although I just turned them off, and the Pi4 remained online…

Hey @tuliptrader,

Yes, to run diagnostics a VPN connection must be established between your device and our backend. This requires a few ports to be open in your network as described here: Network Setup on balenaOS 2.x - Balena Documentation.

Regarding the “Online/heartbeat/offline” status, those are eventually correct though they take some time to update because the device only reports status to our backend every 15 minutes (default value) to save bandwidth. So i assume during your testing you checked well before the 15 minute mark so the dashboard would still show device as online.