[HowTo] Use a WR1043ND (v4) or similar Router as WLAN-Squeezeplayer

[HowTo] Use a WR1043ND (v4) or similar Router as WLAN-Squeezeplayer

(And please excuse my not-so-perfect english as I'm german.)

Background: I really liked my little red SqueezeBox Radio from Logitech and was very sad, when they dropped production. I had set up a LMS already on my little Homeserver and over time added a Raspberry Pi (piCorePlayer) and an Android Tablet (Squeeze Player, which is not free, sadly).

As the ancient tablet was getting slower and slower due to app upgrades (I think?), I started looking for a replacement. A Raspberry Pi is still quite expensive and I had some TP-Link TL-WR1043ND and a VIGO Supreme USB-Soundcard laying around, which is known to work in Linux.

So, my goal was to get the WR1043ND running as a Squeezeplayer using the WLAN. I knew that there was a squeezelite package, but was astonished that no one seemed to have written a tutorial - and setting this up was not that self-explanatory.

So, here it is, a little HowTo.

In our example, the normal network is setup at 192.168.1.0/24 with a Router that acts as DHCP- und DNS-Server at 192.168.1.1.

Hardware used:

  • TP-Link WR1043ND v4 (any WLAN-Router with 8 MB flash should work, though)
  • USB-Soundcard supported by Linux (e.g. Speedlink Vigo Supreme used, Speedlink Vigo works as well)
  • Some speakers
  • Perhaps an amplifier (I use a Lepai LP-2020 with the android tablet and really like it)

We start with a freshly flashed OpenWRT 19.02.7.

Connect your computer to the router using a LAN-Cable. Do not connect the Router to the LAN itself, as OpenWRT uses the Network 192.168.1.0/24 and IP 192.168.1.1 as default.

Open your webbrowser, access http://192.168.1.1 and set your password.

Got to “Network” -> “Interfaces”, select “LAN” “Edit” and change “IPv4 address” to an IP in another subnet like “192.168.2.1”. Click on “Save”, then the DropDown Arrow “near “Save & Apply”, select “Apply unchecked” and click on that red button.

Disconnect the LAN cable, wait around ten seconds and connect again. Your computer will get a new IP address in the 192.168.2.0/24 range.

Now we’ll set up the WLAN. Close and open your webbrowser again and access http://192.168.2.1 (or whatever you entered in the step before), the new IP of your router. Click on “Network” -> “Wireless”, “Remove” your current SSID. Select “Scan” and select your WLAN with “Join Network”.

At “Joining Network” check “Replace wireless configuration”, enter your “WPA passphrase” and make sure that “Assign firewall-zone” is set to “wan”. At the next page you can leave everything as it is and “Save”. Lastly, click “Save & Apply”. Congratulation! Your computer and your router should now be able to reach the internet!

Now it’s time to get USB-audio running. Select “System” -> “Software”, “Update lists…” to get the package list. Check for errors and “Dismiss” (if there are errors, you probably messed up while connecting to the WLAN). Filter for “kmod-usb-audio” and “Install…” this package. You’ll get a short overview of the packages that will be installed and confirm by clicking “Install”. Check for errors again and “Dismiss”.

Lastly we install squeezelite itself: Filter for “squeezelite” and install “squeezelite-full” using “Install…”. Confirm clicking “install” again, check for errors and “Dismiss”.

Connect your speakers / amplifier to the USB-Soundcard and put it into your USB port of the router.

If you would restart the router now, squeezelite would start at Startup but would only scan the LAN-interface for your Squeezeserver instead or the WLAN-interface (i.e. it scans the 192.168.2.0/24 range while the LMS will be at 192.168.1.0/24). Sadly, there is no luci-interface for squeezelite and not even a manual at the packages homepage at https://github.com/openwrt/packages/tree/openwrt-19.07/sound/squeezelite . But I figured it out myself (sigh):

Connect to your router using SSH (Windows users will normally refer to PuTTY or MobaXterm). Remember your routers IP (which should be 192.168.2.1 if you have stuck to this HowTo). Now, you have to know the IP of your LMS (which you should know when you use one). Let’s assume the Logitech Media Server runs at 192.168.1.254.

While connected to your router, use the commands

uci set squeezelite.options.server_addr='192.168.1.254'
uci commit squeezelite

to add the server-adress to your squeezelite installation. You can check with

uci show squeezelite

if it was entered correctly. And while we’re at it, you can check with

squeezelite -l

if your soundcard was recognized correctly.

Finally, Reboot your router using LUCI “System” -> “Reboot” -> “Perform Reboot” or at the ssh with a simple

reboot

You may disconnect your computer now and pray, that everything works correctly.


Final thoughts: Perhaps it is useful for future access to add Port Forwards for the ports 80 (HTTP, LUCI) and 22 (SSH) to your localhost / 192.168.2.1. Otherwise you had to connect each time using a LAN-cable.

Just tested this with a really ancient TL-WR1043ND v1.0.

Works great! :slight_smile:

EDIT: Well, not that much. As the v1.0's WLAN is still crappy, it loses signal from time to time.

Tested the USB-only Logitech S-150 speakers together with a WR1043ND v2.1.

Well this works great. The buttons of the speaker do not work. But volume and sound is great.

So now: Just plug in the power supply of the Router, plug in the speakers, have fun.

The volume buttons on the speaker can be made usable through a HID event package such as triggerhappy.

Do you know of a HowTo anywhere?

I'm really no Linux-Pro. :wink:

Greetings from Germany

René

Info concerning triggerhappy can be found here:

https://openwrt.org/docs/guide-user/hardware/hardware.button#hid_buttons
https://manpages.debian.org/stretch/triggerhappy/thd.1.en.html


EDIT:

Beware! You have not only to install

opkg install triggerhappy kmod-hid

(info from the OpenWRT-Wiki) but also

opkg install kmod-hid-generic kmod-usb-hid


Also:
Sadly when controlling the Volume of the LS-150 directly with

squeezelite -V PCM

it's always very very loud, even if you set the volume to just 10% or so.

And controlling the volume of squeezelite via it's integrated software function doesn't seem possible (didn't find anything at https://manpages.debian.org/buster/squeezelite-pa/squeezelite.1.en.html).

To continue my semi-monologue:

You can control the volume of squeezelite using the LMS.

If your LMS is accessible at http://192.168.1.254:9000, you can pause play using:

curl --silent --output /dev/nul --referer 'http://192.168.1.254:9000/status.html' 'http://192.168.1.254:9000/status.html?p0=pause&player=[MAC-adress of player]'

The referer is vital, as LMS won't accept the settings otherwise. So you cannot use uclient-fetch and have to install curl using

opkg install curl

Increase volume by 2%:

curl --silent --output /dev/nul --referer 'http://192.168.1.254:9000/status.html' 'http://192.168.1.254:9000/status.html?p0=mixer&p1=volume&p2=%2B2&player=[MAC-adress of player]'

Decrease volume by 2%:

curl --silent --output /dev/nul --referer 'http://192.168.1.254:9000/status.html' 'http://192.168.1.254:9000/status.html?p0=mixer&p1=volume&p2=-2&player=[MAC-adress of player]'

So if you want to pause the player on "MUTE" of the LS-150 and increase or decrease the volume of the LS-150 via it's button, you may use triggerhappy and a config like:

# /etc/triggerhappy/triggers.d/squeezecontrol.conf
#
#
KEY_MUTE      1       curl --silent --output /dev/nul --referer 'http://192.168.1.254:9000/status.html' 'http://192.168.1.254:9000/status.html?p0=pause&player=[MAC-adress of player]'
KEY_VOLUMEUP  1       curl --silent --output /dev/nul --referer 'http://192.168.1.254:9000/status.html' 'http://192.168.1.254:9000/status.html?p0=mixer&p1=volume&p2=%2B2&player=[MAC-adress of player]'
KEY_VOLUMEDOWN        1       curl --silent --output /dev/nul --referer 'http://192.168.1.254:9000/status.html' 'http://192.168.1.254:9000/status.html?p0=mixer&p1=volume&p2=-2&player=[MAC-adress of player]'

Don't forget your

service triggerhappy restart

Some info I have used is from
http://arduino-projects4u.com/squeezebox/ („status.txt” has to be “status.html”)
http://tutoriels.domotique-store.fr/content/54/95/fr/api-logitech-squeezebox-server-_-player-http.html (Info regarding cauth is out of date, use --referer instead)

Hope this helps someone in the future.

René

Please beware:

[MAC-address of player] must replace ":" with "%3A"

and perhaps one should replace "-" with "%2D"