Squeezebox - new services in HA 0.110 discussion

Squeezebox users - there are new services in the 0.110 release, as well as a refactor of the integration code. A new code owner has taken over which means it looks like the code will be regularly maintained. All good news.

The new services are squeezebox.sync and squeezebox.unsync, which are for synchronisation. There is also squeezebox.call_query. The purpose of this thread is to allow people to share info about how they are being used.

The sync/unsync seem relatively easy. This will hopefully allow, for example, mini media player card to have speaker groups like it does for sonos.

The call_query has a lot of potential for querying and playing with the query results. The sample data for the query (you can find this in the services tab of dev tools) is

command: albums
parameters: '0,20,Revolver'

The results are store in the query_result attribute of the player, in my case:

query_result: 
count: 2
albums_loop:
  - album: Revolver
    id: 9247
  - album: The Sellout
    id: 9025

Revolver is the Beatles album, The Sellout is an album with a song “Kissed It feat. Velvet Revolver”

What I then do with this data to play it, or present it as choices to play is beyond me right now, and it is bedtime!

Happy playing.

3 Likes

It would be nice if the new integration would recognize players when they are powered off while HA starts.

The old integration had the same problem. All players must be online at the startup.
Currently I’m using an old custom component for squeezebox in order to define the players manually in yaml.

In my experience that is not the case. But do you mean soft “off” or completely denied of power so it is no longer connected to the network? Most squeezebox devices are actually still running and connected to the LMS server when turned “off” at the device or via the LMS web client or via home assistant. This means you can turn it on via the network too.

I mean completly powered off.
I have smart plugs at each of my squeezebox-radios (raspberries) and power them on or off in one room or another.

In this case HA doesn’t find the devices when they are powered on later.

Do you know if LMS pushes some sort of notification when a client/player is added, or would HA need to poll the LMS server to see if any new players are added?

Do the powered off entities show in the LMS interface?

I would love to see some application of these query as well. I use it in my house and it is integrated in home assistant but not really used because like you I don’t know how/what to do with it.

I’m on 0.110.1 and my squeezebox players aren’t showing up anymore. Anyone else having issues? I’m on LMS 8.0 now. Everything works outside of HA

Logger: pysqueezebox.pysqueezebox
Source: main.py:356
First occurred: 5:29:53 PM (1 occurrences)
Last logged: 5:29:53 PM

Failed communicating with LMS: <class ‘concurrent.futures._base.TimeoutError’>

I think HA needs to pull this information in order to get all the players. I don’t think that the LMS sends a notification when a new player is added.

The offline players are not listed in the LMS. In HA they are listed with the attribute “restored”.

By the way @kalkih, author of the great mini-media-player lovelace card tells me he is working on getting squeezebox sync into his player. (It can already group and ungroup sonos, soundtouch , snapcast , bluesound and yamaha_musiccast.)

1 Like

You can also group players with the group player plugin in the LMS server. Basically creates a sync for you and becomes another squeezebox platyer. Are you experiencing any issues now with 0.110? It seems whenever I restart the HA server there isn’t enough time for them to populate. Every once in a while I get them to show up but it seems they changed things to speed up startup.

Can you give a little more example of how this search might work in the UI? I did a query via the developer tools, but didn’t see the query result in the player state.
If you don’t have time to flush out something complete just let me know how I might put this into the front end.

Also do you know if Squeezebox will eventually be able to use the new media browser 0.115? https://www.home-assistant.io/blog/2020/09/17/release-115/#media-browser

In the docs:

SERVICE CALL_QUERY

Call a custom Squeezebox JSON-RPC API. The result of the query will be stored in the ‘query_result’ attribute of the player.

Has anyone tried to use the “media_player.clear_playlist” service on .115? I’m getting the following error:

TypeError: 'NoneType' object is not subscriptable

This happens with any call that returns no results.

I know this is not updated for a year but i do try:
I did get the query working and get the results in the media player:

media_artist: Chic
shuffle: false
repeat: ‘off’
query_result:
artists_loop:
- id: 47
artist: De Dijk
count: 1

but how do I get that into a sensor? I want to use the sensor for starting the media player with that specific artist/album/favorite etc.

I do get the other attributes like ‘media_artist’ or ‘shuffle’ but the query seems to be different because of the sub attributes maybe?

found it out:

value_template: ‘{{((state_attr(“media_player.piCorePlayer”, “query_result”).artists_loop[0].artist))}}’

1 Like