philippe44 / AirConnect

Use AirPlay to stream to UPnP/Sonos & Chromecast devices
Other
3.46k stars 217 forks source link

Need some guidance installing on Raspberry Pi #320

Closed cluelessuser closed 3 years ago

cluelessuser commented 3 years ago

Hi, I'm looking to set up a Raspberry Pi to enable airplay over older Sonos speakers. I have the Pi setup with the Raspbian OS, but after that I'm not sure what files are required from your project to get AirConnect up and running. I have very little experience using linux based systems so any guidance is very much appreciated.

bradleythedeveloper commented 3 years ago

@cluelessuser So pretty much I went to the GitHub page of the program AirConnect (it's a good idea to read the GitHub page as this gives some more info, philippe44/AirConnect: Use AirPlay to stream to UPnP/Sonos & Chromecast devices (github.com)) and downloaded the files 'aircast-arm' and 'airupnp-arm' from it. Choose the correct files for your OS though, these files are just for ARM devices, like the Raspberry Pi. (AirConnect/bin at master · philippe44/AirConnect (github.com))

Then I just ran the file with the commands './aircast-arm' and './airupnp-arm' (in a separate terminal and it found my devices. Then I ran the same commands but with '-z' at the end so it could run in the background.

Then I used this tutorial (How to Run a Raspberry Pi Program on Startup - learn.sparkfun.com) to get it to start automatically at boot with rc.local, but AirUPnP didn’t work, so I have to start that manually.

That's pretty much it, although it took a lot of tinkering to get this to work, and I am writing this a few weeks after doing this, which means that this might be wrong but I think it is correct.

pwt commented 3 years ago

Hi, I'm looking to set up a Raspberry Pi to enable airplay over older Sonos speakers. I have the Pi setup with the Raspbian OS, but after that I'm not sure what files are required from your project to get AirConnect up and running. I have very little experience using linux based systems so any guidance is very much appreciated.

An easy way to set this up in a well-configured manner is to use Docker.

First, install Docker on your Raspberry Pi using the following commands in a terminal:

$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
$ sudo usermod -aG docker <your-user>

Replace <your-user>, with your Raspberry Pi user name (perhaps pi) in the final command. Start a new terminal for the command to take effect.

Next, run the quickstart installation for my Sonos-optimised Docker AirConnect image described at: https://github.com/pwt/docker-airconnect-arm/blob/master/README.md, by running the command line below:

$ docker run -d \
  --net=host \
  --name=airconnect \
  --restart=unless-stopped \
  -e SUPPRESS_FLUSH=TRUE \
  -e INCLUDE_AIRCAST=TRUE \
  psychlist/docker-airconnect-arm

This will give you an AirConnect installation that starts automatically when you start your Pi, and which is easy to keep up to date.

I keep the image up to date with new AirConnect versions (after I've tested them). The instructions on updating are in the quickstart.

bradleythedeveloper commented 3 years ago

Hi, I'm looking to set up a Raspberry Pi to enable airplay over older Sonos speakers. I have the Pi setup with the Raspbian OS, but after that I'm not sure what files are required from your project to get AirConnect up and running. I have very little experience using linux based systems so any guidance is very much appreciated.

An easy way to set this up in a well-configured manner is to use Docker.

First, install Docker on your Raspberry Pi using the following commands in a terminal:


$ curl -fsSL https://get.docker.com -o get-docker.sh

$ sudo sh get-docker.sh

$ sudo usermod -aG docker <your-user>

Replace <your-user>, with your Raspberry Pi user name (perhaps pi) in the final command. Start a new terminal for the command to take effect.

Next, run the quickstart installation for my Sonos-optimised Docker AirConnect image described at: https://github.com/pwt/docker-airconnect-arm/blob/master/README.md, by running the command line below:


docker run -d \

  --net=host \

  --name=airconnect \

  --restart=unless-stopped \

  -e SUPPRESS_FLUSH=TRUE \

  -e INCLUDE_AIRCAST=TRUE \

  psychlist/docker-airconnect-arm

This will give you an AirConnect installation that starts automatically when you start your Pi, and which is easy to keep up to date.

I keep the image up to date with new AirConnect versions (after I've tested them). The instructions on updating are in the quickstart.

I didn't know that actually, thanks @pwt !

cluelessuser commented 3 years ago

Hi Both, thanks so much for the prompt replies. I've just attempted the docker run part and I'm getting an error regarding permissions (see below). Probably something I've not done correctly, but I think I've followed the process as set out above.

Any ideas

Thanks again.

pi@raspberrypi:~ $ docker run -d \

--net=host \ --name=airconnect \ --restart=unless-stopped \ -e SUPRESS_FLUSH=TRUE \ -e INCLUDE_AIRCAST=TRUE \ psychlist/docker-airconnect-arm docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create?name=airconnect: dial unix /var/run/docker.sock: connect: permission denied. See 'docker run --help'.

cluelessuser commented 3 years ago

Just tried the process again, and it seems to be downloading now, probably a picnic moment.

pwt commented 3 years ago

Just tried the process again, and it seems to be downloading now, probably a picnic moment.

Great.

Maybe you didn't start a new terminal after the sudo usermod -aG docker pi, to allow it to take effect. That would have caused the Docker permission errors.

jolimk commented 3 years ago

Hello, I’m not sure if I can comment here or a new post is preferred. I tried installing this on my Raspi but when I run aircast, I only get 3 lines, the last one just says Start:727 Binding to , and doesn’t list all my devices that are connected. What am i doing wrong?

pwt commented 3 years ago

Hello, I’m not sure if I can comment here or a new post is preferred. I tried installing this on my Raspi but when I run aircast, I only get 3 lines, the last one just says Start:727 Binding to , and doesn’t list all my devices that are connected. What am i doing wrong?

I'm inferring that you're using the docker-airconnect-arm Docker package?

If so, what's the output of docker logs airconnect?

cluelessuser commented 3 years ago

@pwt Just a quick thank you, the advice you gave worked perfectly. All speakers detected and runs on reboot of Pi. Even have it running on the same pi as Homebridge, it doesn’t like when I have Sonos streaming and video doorbell via hb simultaneously, but I can certainly live with that!

thanks again

pwt commented 3 years ago

@pwt Just a quick thank you, the advice you gave worked perfectly. All speakers detected and runs on reboot of Pi.

Great, thanks for following up. In my experience, this is very solid setup: AirConnect runs indefinitely for me without needing to be restarted.

Even have it running on the same pi as Homebridge, it doesn’t like when I have Sonos streaming and video doorbell via hb simultaneously, but I can certainly live with that!

I'm not familiar with homebridge, but perhaps this has nothing to do with it running on the same Pi as AirConnect? Could it be that the video doorbell is interrupting the AirPlay stream on the iOS device?

You may want to close this issue now (@jolimk has created a new issue for his problem).

cluelessuser commented 3 years ago

@pwt that’s a very good point re the interrupt, I’d not even thought of that. Will give it a try on separate iOS devices. Many thanks again for all of your help. I’ll close this thread now.