Problems with Wifi Radio Setup
Moderators: adafruit_support_bill, adafruit
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
- terrapinflyer25
- Posts: 13
- Joined: Thu Aug 22, 2013 3:10 pm
Re: Problems with Wifi Radio Setup
After several attempts to resolve this issue I have hit a dead end. I hope someone can help with this.
- murl
- Posts: 14
- Joined: Fri Aug 02, 2013 2:48 am
Re: Problems with Wifi Radio Setup
Sorry about the delay... It took me a while to figure out how to make mine crash consistently.terrapinflyer25 wrote:After several attempts to resolve this issue I have hit a dead end. I hope someone can help with this.
So, for the quick-fix, try this and see if it fixes your problem:
cd ~/Python-WiFi-Radio
nano PiPhi.py
On line 27, make sure it says:
HALT_ON_EXIT = True # Set to 'True' to shut down system when exiting
Then, way down around line 285, you should see something like this:
pianobar.expect('Get stations... Ok.\r\n'), timeout=30)
Change the timeout to none:
pianobar.expect('Get stations... Ok.\r\n'), timeout=None)
After you make your change, you have to <CTRL-O> to write your changes, and <CTRL-X> to exit the nano editor.
Now the explanation...
The PiPhi.py script uses a module called pexpect to spawn an instance of pianobar and interact with it. After it logs into Pandora, it expects pianobar to respond with a series of messages that ends with the "Get stations... Ok." phrase. The 'timeout=30' portion of the statement is supposed to give pianobar 30 seconds to do its thing before it figures something went wrong.
For some strange reason, whenever I do a hard-reboot of the WiFi radio, the timeout value seems to get ignored. Pianobar seems to be going through its sequence correctly, but pexpect triggers a timeout error before it's finished. I can set the timeout value to 20 minutes and it still crashes at the same point after the same amount of time. In Googling how the pexpect module works, I've found several other instances where people have had problems with the timeout not working correctly. I'm thinking it's some kind of bug internal to the pexpect module.
Also, I can only get this to crash when I do a hard reboot. That's why I asked you to check the 'HALT_ON_EXIT' to make sure it's true. I suspect when you're shutting yours down, it's only stopping pianobar, and not shutting down the Pi all the way.
So, anyway, setting the timeout time to 'None' seems to do the trick for me. Please give it a try and let us know whether it works for you.
Thanks!
- terrapinflyer25
- Posts: 13
- Joined: Thu Aug 22, 2013 3:10 pm
Re: Problems with Wifi Radio Setup
Your amazing! I had been reading through that python script looking for what timing out but I was no where near there yet. Thanks for helping with the process. Now to get a power switch and mount this baby and Im in action! Ill keep you posted on the rest of the project.
- murl
- Posts: 14
- Joined: Fri Aug 02, 2013 2:48 am
Re: Problems with Wifi Radio Setup
Great! Sorry it took so long to get you back on track.
I learned a lot in the process, though.
I learned a lot in the process, though.
-
- Posts: 3
- Joined: Thu Apr 10, 2014 9:48 am
Re: Problems with Wifi Radio Setup
Murl wrote:I had the same problem. Mine had been working, but it started doing what you described. After searching around, I discovered that the problem affects Pianobar 2012.05.06, but not later versions. Unfortunately, the repositories still have the old version, so I had to upgrade it manually.
Here are the steps I took to remove the old version and install the new one with all of it's dependencies:
After finishing this and rebooting, it would get to the point where the LCD said "Retrieving station list..." and then crash.Code: Select all
sudo apt-get update sudo apt-get purge pianobar sudo apt-get install git pkg-config libevent-pthreads-2.0-5 libao-dev libgnutls28-dev libmad0-dev libfaad-dev libjson0-dev libgcrypt11-dev cd sudo git clone git://github.com/prattmic/pianobar.git cd pianobar sudo make clean sudo make sudo make install
It turns out that Pianobar is able to remember the last played station, so it wasn't sending the list of stations that the script was expecting to see on startup. I fixed it by editing the PiPhi.py script, but I found an easier solution here:
http://forums.adafruit.com/viewtopic.ph ... ar#p205959
Hopefully I remembered all the steps correctly. If you run into problems, please post your results and I'll try to remember which steps I forgot. :D
edit: changed make commands due to permissions issues...
This worked Perfectly for me. Mine was working fine for ages then suddenly just stopped :( all fixed thanks to this post cheers very much
- murl
- Posts: 14
- Joined: Fri Aug 02, 2013 2:48 am
Re: Problems with Wifi Radio Setup
Thanks - glad it helped!
- prairietech
- Posts: 51
- Joined: Tue Apr 10, 2012 11:27 pm
Re: Problems with Wifi Radio Setup
Godzookee,
Thanks for the work around. I'd been getting the TLS handshake error for days. Been trying to install the new pianobar version from the source but I'm still pretty new to all this and the repository still has the old version.
Your code fixed my problem!
Thanks for the work around. I'd been getting the TLS handshake error for days. Been trying to install the new pianobar version from the source but I'm still pretty new to all this and the repository still has the old version.
Your code fixed my problem!
- terrapinflyer25
- Posts: 13
- Joined: Thu Aug 22, 2013 3:10 pm
Re: Problems with Wifi Radio Setup
So this is weird but my radio has been working fine for months now until this week. It will start up just fine and play at least one song, sometime a few in a row. The problem is that after that it does not get the next song on that station. I can change stations and I get one or two songs and the same thing happens.
Edit: After ssh into the pi and runnig pianobar I see that it is spitting out this error:
So I was able to get the ALSA error to go away by:
But I dont know about this HTTP error. Any help would be appreciated
Edit: After ssh into the pi and runnig pianobar I see that it is spitting out this error:
Code: Select all
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
/!\ Cannot access audio file: Unknown HTTP status code.
Code: Select all
pi@raspberrypi ~ $ sudo vi /usr/share/alsa/alsa.conf
change the line "pcm.front cards.pcm.front"
to "pcm.front cards.pcm.default"
- pburgess
- Posts: 4161
- Joined: Sun Oct 26, 2008 2:29 am
Re: Problems with Wifi Radio Setup
That's a weird one. Wonder if it might be dropping the WiFi connection?
The guide was recently updated, there's some info on disabling WiFi power management to help with this sort of thing:
https://learn.adafruit.com/pi-wifi-radi ... tup-1-of-3
The guide was recently updated, there's some info on disabling WiFi power management to help with this sort of thing:
https://learn.adafruit.com/pi-wifi-radi ... tup-1-of-3
- terrapinflyer25
- Posts: 13
- Joined: Thu Aug 22, 2013 3:10 pm
Re: Problems with Wifi Radio Setup
Thanks but I already have disabled the WiFi power management to no avail. Last night I had the radio working for about 2 hours without a hick-up. I left it playing when I went to bed and when I got up it was back to acting up again.pburgess wrote:That's a weird one. Wonder if it might be dropping the WiFi connection?
The guide was recently updated, there's some info on disabling WiFi power management to help with this sort of thing:
https://learn.adafruit.com/pi-wifi-radi ... tup-1-of-3
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/