[No Longer Maintained] Squeezebox Integration (Logitech Media Server)

Hey folks, I've added support for sync groups. You can create a virtual switch and set it up so that you can sync/unsync players together via a dashboard for example. There's an example of how to do that using Rule Machine in the README in Github. It's working pretty sweet for me :smile:, but let me know if it doesn't work for you.

1 Like

Added some new functions. The integration now supports a method to transfer the current playlist from one player to another. There is also a new configuration option which allows you to select players to have a child switch device added that you can use to switch the alarms on or off (useful if you use a squeezebox as your alarm clock).

Oh wow I have some Original SqueezeBoxes I was going to throw out now that I'm all SONOS'd up but am now reconsidering..

I may be having a bit too much fun with these drivers :grin: I've added methods to allow playing albums, artists or songs by name (actually uses the built-in search methods in squeezebox). Also added repeat and shuffle mode attributes and commands.

If anyone is interested, I have also managed to integrate all of this via Google Assistant, IFTTT and the RESTful Music Players app (also in the xap-code/hubitat repo in Github). It's quite involved and very specific to what I want it to do so not something I would want to support explicitly, but the code's there if anyone wants to use it and I can provide some basic instructions on how to set up IFTTT with it.

3 Likes

Is there a way to turn off the logging ?
Have I missed it ?

If you're running the latest version of the code then you can switch off debug logging for the app and all players via the app config. pages.

There is a toggle switch to enable/disable debug logging on the second settings page.

Sweet. I got the logging turned off now. Thanks. Just had to get the latest version installed.
Cheers,

1 Like

Wow, this is super impressive LMS integration. Got this working and it is very smooth. Haven't played with all functions yet though. I am interested in your side project you just mentioned with IFTTT and RESTful. May have some questions on that later.
Also if anybody knows or has instructions to setup spotify playlists to work with this, I would be truly grateful! I've done some searches but it got messy.

FYR, I use a RASPI3B+ with piCore as my Logitech Media Server and connected various squeeze players on androids and tablets. I'm fairly new to the HE world but been with ST for quite some time.

On ST, I modified the integration to add a command "SetVoice(string param)" so you can make rules to talk in different voices and different languages. I may add to this one if anybody is interested. (for example in webCore I can set voice to english Sali, say something then set to mandarin Voice and say something in Mandarin). I thought it was cool (especially for bilingual homes)

Happy to consider pull requests.

Glad you like the integration :+1:

Finally found the boxes my Squeezeboxes got packed in during our hectic move.

And this integration is working great thanks. Very impressive.

Is there a way to get these Squeeze Player devices to expose more commands to Amazon Alexa? I only seem to be able to turn them on/off via Alexa.

I use Google Home and have a similar restriction. The best way I found of integrating voice commands was by implementing a REST API application in Hubitat and then using IFTTT to invoke the rest service. It's a bit of spit and sellotape to be honest but it works for the most part. I can pause/play/previous/next/volume and some more advanced "Search artist Pearl Jam on Kitchen Player" or "Search album Houses of the Holy on Study Player" type things.

The REST app code is at:
https://github.com/xap-code/hubitat/blob/master/restful-music-players/app/restful-music-players.groovy

2 Likes

That sounds great. I've installed the RESTful Music Players app.

What do I need to setup in IFTTT to get it to invoke the service? I've only setup a simple applet before, so not sure how to proceed.

Once you have added the app, you need to get the URL (with access token) that you will need to use in IFTTT. Click through to the second settings page and you should see the URL you need. You can test the service is working by pasting that URL into a browser and you should see a list of the players you selected in the RESTful Music Players app.

You'll need to have a look at the app source code to get the other URLs. I haven't documented this as it was only intended for my use really. I haven't got Alexa so I can't tell you exactly what to do in IFTTT but what I did was create applets of the form IF { google assistant command } THEN { webhook } where the webhook action is invoking the REST service exposed by the RESTful Music Players app.

With the google assistant support in IFTTT you can extract a string and/or a numeric parameter from the command phrase. You can then include that value in the URL that the webhook invokes.

For example, to mute a player I have:

IF "Say a phrase with a text ingredient" > Make $ mute
THEN "Make a web request" >
URL = https://cloud.hubitat.com/api/{your app id}/apps/347/player/{textField}/mute?access_token={your access token}
Method = POST
Content Type = text/plain

The URL above is based on the one that the app will show you in the second settings page. You just need to swap out the "players" bit for "player/{textField}/mute", and similarly for other commands you want to use - just look at the app source code to see what commands there are.

1 Like

Thanks for the instructions, and sharing the code. Looks great, I'm going to give it a try.

Note for anyone else trying this, after saving the RESTful Music Players app, you need to click on the OAuth butting next to the Save button, in order to enable OAuth. Took me a little while to realise why my token was returning as null, as I hadn't noticed that button before.

I experienced major slow down of my Hubitat hub yesterday. Some actions were taking several minutes to be performed.

This turned out to be due to Squeezebox Connect having trouble connecting to LMS. LMS was running but for some reason stopped accepting connections. I had the Squeezebox Connect "Players Status Refresh Interval" set to 10 seconds, and I think this combined with it failing to connect to LMS caused it to slow the whole hub down somehow. Restarting LMS resolved the issue.

I don't know the exact circumstances that caused this, as trying to reproduce it by just stopping LMS did not cause the hub slow-down. Perhaps it was to do with the way LMS had malfunctioned.

Anyway, just a headsup in case anyone else runs into this issue.

Thanks for letting me know. I think what was probably happening is that the Hubitat was sitting there waiting on a socket connection from LMS. I'm not surprised that stopping LMS didn't produce the same behaviour as my guess would be that Hubitat would then be receiving prompt connection refused messages.

I was using a synchronous HTTP call for the server polling, but there was no actual need for it be synchronous so I've pushed a change to the code so that it now uses an asynchronous HTTP call. That may prevent this from happening again. It all depends on how Hubitat handles waiting for socket connections internally.

I'm using the changed version on my system and all seems to be working properly, please let me know if you have any more issues with it. :slight_smile:

2 Likes

I just noticed that I am getting this error in my logs.

twice per minute.

app:1462019-03-16 04:24:42.115 pm errorjava.lang.IllegalArgumentException: No json exists for response on line 368 (receiveHttpResponse)

app:1462019-03-16 04:24:12.064 pm errorjava.lang.IllegalArgumentException: No json exists for response on line 368 (receiveHttpResponse)

app:1462019-03-16 04:23:42.085 pm errorjava.lang.IllegalArgumentException: No json exists for response on line 368 (receiveHttpResponse)

app:1462019-03-16 04:23:12.072 pm errorjava.lang.IllegalArgumentException: No json exists for response on line 368 (receiveHttpResponse)

Can you check if you are still able to see your player status and control it?

hmm... This might be my doing. I just recently changed my VLANs. The Hubitat and Squeezebox are on the same VLAN. But the Squeezebox server is on a different VLAN. Hubitat is able to see my Squeezebox server and report the Squeezebox player. I am able to play songs to the Squeezebox from my Server but it looks like Hubitat cannot control it.

I tried to set the volume, it is to late to play music.

dev:1132019-03-16 11:36:54.254 pm errorjava.net.NoRouteToHostException: No route to host (Host unreachable) on line 706 (setLevel)

--- Live Log Started, waiting for events ---

@xap Been using Squeezebox connect without a problem for many months...until a recent update (a few weeks ago maybe). Since then my hubitat has been getting lockups every other day or so, bobbyD in support suggested I disable the app and devices to check if that's the culprit. Which it seems to be. Any ideas where to start tracking this down? Today I woke up to hubitat refusing connections. Thx in advance for any help!