Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't play music (error no devices) #66

Closed
XEROxMEXICANO opened this issue Jul 31, 2022 · 87 comments
Closed

Can't play music (error no devices) #66

XEROxMEXICANO opened this issue Jul 31, 2022 · 87 comments

Comments

@XEROxMEXICANO
Copy link

Hello I've finally got Spot to auto start and a bunch of other problems fixed but when I try to play a song it gives me this error

"playing spotify:album:6Bp2ojsBc8CtNaYipdxCLt spotify:track:3ZcLmonVVD1MTQtmQb8yf3
error! no devices"

I saw in the Github issue #4 someone had this error but they fixed it so I applied the fix to mine and it didn't do anything. Got a solution or an idea?

@doris1347
Copy link
Collaborator

Had any Luck Yet?

@XEROxMEXICANO
Copy link
Author

Had any Luck Yet?

Nope

@doris1347
Copy link
Collaborator

doris1347 commented Aug 16, 2022

When I try to play a playlist or track it indexes 3 seconds and drops out to no devices (no audio) would you have any ideas?

@XEROxMEXICANO
Copy link
Author

Having the same issue,currently just messing around with the code if I find a solution I'll post it here

@XEROxMEXICANO
Copy link
Author

Hello @doris1347 I don't if you tried this but on step 12 when configuring raspotify it says comment and fill:
OPTIONS="--username --password "
where it says USERNAME and PASSWORD, did you try entering your username and password. I tried it and it didn't work am I suppose to leave "<>" those in or not I tried both and none worked.

@doris1347
Copy link
Collaborator

doris1347 commented Sep 16, 2022

No Do Not Leave Them In you must delete them!!! "<>"

Yes, when I was using a Zero version 1w I tried step 12 and issue #4 with negative results - I'm now using a Zero 2w which has a different config file due to the upgraded (Raspotify/librespot) "/etc/default/raspotify" doesn't exist in versions after 0.31.3.
The Zero 2W boots up really fast however poor on power consumption!

https://developer.spotify.com/documentation/web-api/reference/#/operations/transfer-a-users-playback

Perhaps the above?

https://community.spotify.com/t5/Spotify-for-Developers/active-a-playback-device-with-API/td-p/4963267

Obtaining "device id"

@XEROxMEXICANO
Copy link
Author

Sorry I've been a little busy today. Thank you so much for the new information and the links I think just from reading the articles I have an idea that could possibly solve this issue (.01% my idea works). I'll have ti try it when I get home.

1 similar comment
@XEROxMEXICANO
Copy link
Author

Sorry I've been a little busy today. Thank you so much for the new information and the links I think just from reading the articles I have an idea that could possibly solve this issue (.01% my idea works). I'll have ti try it when I get home.

@doris1347
Copy link
Collaborator

doris1347 commented Sep 17, 2022

Perhaps it's a router/firewall issue? 🤔

@XEROxMEXICANO
Copy link
Author

I don't think it could be that, I think it could be that the dependencies were updated and this github isn't up to date on it.

@doris1347
Copy link
Collaborator

doris1347 commented Sep 17, 2022

Hmmm ... Interesting!
Now that gives me an iDea!
However I think it's the "Spot App." that's not up to date on it (incompatible with Bullseye & Raspotify versions above 0.31.8).

@XEROxMEXICANO
Copy link
Author

My idea failed, I tried all possible ideas and just can't think of anything. I think im going to take a break from this project and I'll come back to this project some other time. Thank you so much for the information and your help, you've been amazing.

@XEROxMEXICANO
Copy link
Author

Nope never seen this, im going to try it out right now

@XEROxMEXICANO
Copy link
Author

XEROxMEXICANO commented Sep 19, 2022

No I've never tried that, but I did put the device id of the ipod itself in line 282 device id = "1234" in Spotify_manager and when I selected a song on the ipod it loaded the song name on the now playing screen and played for 3 seconds no audio unfortunately.

@XEROxMEXICANO
Copy link
Author

XEROxMEXICANO commented Sep 20, 2022

Thanks for the information I will certainly try this out once I'm home. If you have any trouble with the bluetooth try this it helped me a lot: https://github.com/bablokb/pi-btaudio

And if your Bluetooth speaker isn't connecting at all try this command it helped me:
sudo apt-get install pulseaudio pulseaudio-module-bluetooth

and to test it out just load an mp3 file in it and download a mp3 player to test it
(for mp3 player I used mpg123 here is a way to install it)

sudo apt-get update
sudo apt-get install mpg123
mpg123 your-music.mp3

@doris1347
Copy link
Collaborator

doris1347 commented Sep 20, 2022

Thanks! ... for the command line mp3 player

Here's The Solution:

I'm now using the desktop version of Legacy Raspberry PiOs Buster v.10 & Raspotify 14.0 on my Zero 2W ... Issue Solved!!!
The Zero 2W boots up really fast however poor on power consuption!

Good idea your considering Retro - Dependency.

@XEROxMEXICANO
Copy link
Author

Congratulations on solving the issue!! I can't wait to try it once I'm home. Thank you so much for helping me and guiding me, couldn't have done this without you.

@doris1347
Copy link
Collaborator

doris1347 commented Sep 23, 2022

The latest is that it does work!
You must have a Spotify Premium Account!!!
Use Raspberry OS imager to image Legacy Buster 10 & download and install Raspotify 14.0 everything works as Stand-Alone!! ---- Raspotify 15.0 or 16.0 probably will work as well, however for me 0.14.0 worked best ... nothing higher worked for me the config file at "/etc/default/raspotify" doesn't exist in versions after 0.31.3.

The config file at /etc/default/raspotify does exist in v. 14.0, 15.0 and 16.

If you get a “PIL” error do the below:
sudo apt-get install python3-pil python3-pil.imagetk

File "spotifypod.py", line 13, in
from PIL import ImageTK, Image
ImportError: cannot import name 'ImageTK' from 'PIL' (/usr/lib/python3/dist-packages/PIL/init.py

It might be necessary to delete pycache from the frontend folder and reboot to make everything work ( rm -r pycache ) it will be recreated automatically upon rebooting.

Note: From Spotify "A Device ID is unique and persistent to some extent (and for some clients). However, this is not guaranteed and any cached device_id should periodically be cleared out and re-fetched as necessary."

Note: You will need "bluealsa" (Alsa with Bluetooth) to be operational for Bluetooth audio in this older version. (This part is tricky however do-able)!
Note: bluealsa does not play mp3 files!

You must have bluealsa installed and configured correctly for Bluetooth Audio and the SpoT to work!
(see below links):
https://sigmdel.ca/michel/ha/rpi/bluetooth_n_buster_01_en.html
https://sigmdel.ca/michel/ha/rpi/bluetooth_in_rpios_02_en.html

pulseaudio needs to be disabled not removed!

Check with: sudo systemctl status pulseaudio

@XEROxMEXICANO
Copy link
Author

Thank you, right now I got some free time and will try it out your way, again thank you so much couldn't have gotten this far without you!

@doris1347
Copy link
Collaborator

doris1347 commented Sep 25, 2022

Your Welcome: - I think eventually the "Spot Program's" Python code will probably need to be re-written using latest Python so it can be compatible with the latest versions of Raspberry pi OS (Bullseye) and the latest versions of Raspotify.

@rsappia
Copy link
Contributor

rsappia commented Sep 25, 2022

Hi guys, not sure if this was already discussed but this issue looks like the one I had at the very beginning and it was solved by going premium on Spotify. I had my set up running for the last 1.5 years with no issues... Let me know if you want .e to share any part of the code or set up i have running ;)

@doris1347
Copy link
Collaborator

doris1347 commented Sep 25, 2022

Hi Ricardo!!! ... I have and always have had a Premium account ... I read your article very nice.
When you boot your "Spot" is it ready to play tracks or do you need to first need to with your cellphone/computer to Select the "Spot" ... and is that selecting at times difficult?

I am using the 2.0' Adafruit screen. and the Latest Pi Zero 2W running 32bit Raspbian10 Buster & 32bit Raspotify 0.14.0. the problems occurred with the original Zero W as well ... The Zero 2W boots up really fast poor on power consumption.

My "Spot" is working now and with Bluetooth audio using older Raspbian Legacy Buster 10 desktop version and older Raspotify 14.0 newer versions wouldn't work for me probably due to new Python code. however, 0.15.0 & 0.16.0 probably would work as well.

Thanking Guy & Yourself! - for all your hard work!

@doris1347
Copy link
Collaborator

doris1347 commented Sep 26, 2022

Guy, Ricardo and others had to be using Raspberry PiOs Buster 10 and Raspotify 14, ... 15 or 16 since they originally did their builds over 1.5 years ago the same versions that I'm using now that works!

They were all busy building their "Spots" and (refining the install instructions) around Jan - March of 2021 when Raspotify 16.0 would have been current Buster 10 as well.
Things broke in November of the same year with the updates, so anyone building the "Spot" after October 2021 would have problems that so many of us had the only plays for 3 seconds, no devices and no bluetooth audio issue since we were all attempting to install on Bullseye 11 and Raspotify v.0.31.1 or higher.

@XEROxMEXICANO
Copy link
Author

XEROxMEXICANO commented Sep 26, 2022

Thanks for the info, Yeah I installed Rasbian buster lite with raspotify 14.0 I was to get it to run but I still have the problem that it won't play music individually and wont output audio. In your previous post I noticed you said "Had to use my e-mail address instead of the 7 digit number for user id in /etc/default/rasspotify which does exist in v. 14.0." What did you mean by that?

edit: Do I have to use Pi os buster desktop?

@XEROxMEXICANO
Copy link
Author

XEROxMEXICANO commented Sep 26, 2022

Correct I am using a pi zero w, When i select a song using raspotify nothing plays. Yes the audio does work i tested it using a mp3 file.

@rsappia
Copy link
Contributor

rsappia commented Sep 27, 2022

Hi Ricardo !!! ... I have and always have had a Premium account ... I read your article ... Guy and Yourself are Geniuses !

1. May I ask which version of Rasberry Pi OS and Raspotify your using?

2. Do you ever have trouble selecting your ({["Spot" as a (is_active)"]}=True) device? ;)

3. When you boot your "Spot" is it ready to play tracks or do you need to first be logged in to your Spotify app. with your cellphone or PC and then Select the "Spot" ... is that selecting at times difficult?

4. If you would be willing to share the "Low Battery signal code" and would be willing to explain how and where to define an internal pull-up/down resistor  in the code that would be great.

I am using the 2.0' Adafruit screen. and the Latest Pi Zero 2W running 32bit OS & 32bit Raspotify. the problems occurred with the original Zero W as well.

My "Spot" is working now using older PiOS Legacy Buster 10 desktop version and older Raspotify 14.0 newer versions wouldn't work for me probably due to new Python code could you remember which your using & did you upgrade to Pi OS Bullseye 11 and 0.42.6 Raspotify circa November/2021?

Thanking Guy & You! - so much for all your hard work! and your offer for assistance.

Hi there, sorry for the delay.

  1. May I ask which version of Rasberry Pi OS and Raspotify your using?
    I am running Raspbian GNU/Linux 10 (buster) and raspotify/unknown,now 0.16.0~librespot.v0.1.3-37-g0adb851 armhf

  2. Do you ever have trouble selecting your ({["Spot" as a (is_active)"]}=True) device? ;)
    Can you elaborate on that? It has been a while since I played around with the code and I am not sure about what part are you referring to

  3. When you boot your "Spot" is it ready to play tracks or do you need to first be logged in to your Spotify app. with your cellphone or PC and then Select the "Spot" ... is that selecting at times difficult?
    I don't need to be loged on to my Spotify app, I just turn it on, and is ready to go :). On the other hand, I can see that my Spot is listed as a device if I open the cellphone app.

  4. If you would be willing to share the "Low Battery signal code" and would be willing to explain how and where to define an internal pull-up/down resistor in the code that would be great.
    I am not sure if I actually fully implemented this function, I need to double-check on the code and come back later to you ;)

@XEROxMEXICANO
Copy link
Author

Right now I've been busy and haven't had time to apply the fixes. I might have time later today, But if you were able to get it working then I should be able to.

@XEROxMEXICANO
Copy link
Author

Oh no worries, sometimes I work on this project then I get upset that it doesn't work then i leave the project abandoned. I'm sorry if I caused you any worries.

@doris1347
Copy link
Collaborator

doris1347 commented Dec 4, 2022

No worries, I just attributed it to your being 17!

@doris1347
Copy link
Collaborator

doris1347 commented Dec 4, 2022

Can you now boot right into "Spot" operation (like Ricardo) without going through the trial-and-error process ???

@XEROxMEXICANO
Copy link
Author

yes when I turn on the pi it boots right into the program, in order to use it I need my phone before choosing a song

@doris1347
Copy link
Collaborator

doris1347 commented Dec 4, 2022

You're saying that you still have to select it from the Spotify Connect Device List? and does it select successfully immediately and can you do so repeatedly???

@XEROxMEXICANO
Copy link
Author

it works on the first try

@doris1347
Copy link
Collaborator

doris1347 commented Dec 4, 2022

Did you try more than once ???

@XEROxMEXICANO
Copy link
Author

No once I put the code you gave me all i have to do is just click it once

@doris1347
Copy link
Collaborator

So it's working (like Ricardo's) without going through the trial-and-error process repeatedly??
Can you shut down your Spot reboot and try again and let me know the outcome!

@XEROxMEXICANO
Copy link
Author

When I reboot it, it does take a while to establish a connection, so i can't just load music off boot

@doris1347
Copy link
Collaborator

doris1347 commented Dec 4, 2022

However it did reconnect when you used the Spotify Connect device list?
After approx. how many attempts?

@XEROxMEXICANO
Copy link
Author

I didn't count but around 5 minutes

@doris1347
Copy link
Collaborator

doris1347 commented Dec 4, 2022

What returns with the below command?
alsamixer -D bluealsa

@XEROxMEXICANO
Copy link
Author

It loads a program with the speaker volume in the middle

@doris1347
Copy link
Collaborator

doris1347 commented Dec 4, 2022

You can select an audio card with F6.

Did you uninstall pulesaudio?

@XEROxMEXICANO
Copy link
Author

when I ran the code it just gives me error that the file doesn't exist so I think I uninstalled

@XEROxMEXICANO
Copy link
Author

when i press F6 i get the option defualt and hdmi 1 and enter device name, which one should i click?

@doris1347
Copy link
Collaborator

doris1347 commented Dec 4, 2022

Use the Default:

@XEROxMEXICANO
Copy link
Author

its ok I will try to find the information on my own, Thank you very much for your help!

@doris1347
Copy link
Collaborator

doris1347 commented Dec 4, 2022

https://github.com/dtcooper/raspotify/wiki/Play-via-Bluetooth-Speaker

https://github.com/Arkq/bluez-alsa

https://sigmdel.ca/michel/ha/rpi/bluetooth_n_buster_01_en.html

https://sigmdel.ca/michel/ha/rpi/bluetooth_in_rpios_02_en.html

There's a section on bluealsa configuration near the bottom of the below link:
https://github.com/bablokb/pi-btaudio

See - below:

Bluealsa Configuration:

After installation, nano /etc/asound.conf and insert the MAC address of your bluetooth-device in the line starting with defaults.bluealsa.device:

pcm.!default "bluealsa"
ctl.!default "bluealsa"
defaults.bluealsa.interface "hci0"
defaults.bluealsa.device "xxxxxxxxxxx"
defaults.bluealsa.profile "a2dp"

Note that you can run

bluetoothctl devices

which should give you the MAC-address of your bluetooth-speaker.

That's it for configuration, all scripts and daemons will use this MAC-address.

Now is the time to restart your system. After booting has finished and all daemons are up and running, your Pi should automatically connect to your speaker or headset. If not, run btaudio-connect.

Create the below file if it isn't there!

sudo nano /etc/asound.conf

and add:

pcm.!default "bluealsa"
ctl.!default "bluealsa"
defaults.bluealsa.interface "hci0"
defaults.bluealsa.device "XXXXXXXXXXX" Your MAC address!
defaults.bluealsa.profile "a2dp"

@XEROxMEXICANO
Copy link
Author

XEROxMEXICANO commented Dec 4, 2022

thank you, you've been super helpful

@XEROxMEXICANO
Copy link
Author

I'm going to close this issue now

@XEROxMEXICANO
Copy link
Author

XEROxMEXICANO commented Dec 4, 2022

yeah I got the audio to work now, couldn't have done it without you

@XEROxMEXICANO XEROxMEXICANO reopened this Dec 4, 2022
@XEROxMEXICANO
Copy link
Author

Yes when I went on the devices page it took a while for the pi to show up but I did get the pi device id

@XEROxMEXICANO
Copy link
Author

Currently I'm away from my pi but from what I remember is I can safely disconnect my phone from the pi. The speaker I am using are the airpods first gen

@XEROxMEXICANO
Copy link
Author

Yes I can

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants