LMS Controls - Google Home / Home Assistant Voice Command for Squeezebox Players

Glad to hear that worked out for you. If you provide me a copy of the revised portions of the code, I will consider integrating that feature to the next revision. My email is [email protected]

Enjoy.

Dec. 12, 2019 Breaking Change - Upgrade of HA to version 0.103 requires Squeezebox service syntax change

Please note, with the upgrade of HA to Version 0.103 the syntax has changed for Squeezebox service calls. In the script lmscontrols.yaml the command media_player.squeezebox_call_method needs to be changed to squeezebox.call_method. This command appears 41 times in the .yaml file.

Been using this for a while now and all was ok until I configured my system to use Nabu Casa.
This involved turning off port forwarding and changing my configuration back to:

http:
  base_url: http://192.168.1.63:8123

After this I can no longer select radio stations from the playlist by typing in the radio station name and selecting ‘play playlist’ from the LMS Player Controls UI

As a work around I changed the my_domain= line in env_var.sh to point to my nabu.casa address and now it all works.

I’m assuming this outside connection is for voice control, as I don’t use any voice assistants is there was a better work around as changing the my_domain= line to 192.168.1.63:8123 didn’t work, even tried it without the port number.

denver, I have just set this up with Nabu Casa. I used trial and and quite a bit of error. This may not be the best way but this works for me. I am using Google Assistant voice control and I have port forwarding set up on the router.

env_var.sh. For my_domain I am using my Nabu Casa remote control address but I had to change it from https to http.
my_domain=http://???.ui.nabu.casa/

configuration.conf I am using the address given when configuring Webhook for DialogFlow. The ??? string is not the same as the one used in env_var.sh.

http:
base_url: http://hooks.nabu.casa/???

Hope this helps / makes sense.

Interesting, I deleted the ‘https://’ bit from the nabu.casa address so my_domain looks like this:

my_domain=rp##########redacted########d.ui.nabu.casa

with my

http:
  base_url: http://192.168.1.63:8123

Hi, desperately stuck at the restoring intents from the zip into new agent - anyone seen the weird DialogFlow stuckness once you get dropped LMS_Contol_Agent - Sanitized.zip into Restore/Import dialogs ? Tried different machines, recreated agent, played with agent options - still same result - nothing got imported/restored from the zip, no error returned, dialog just stuck with grayed ui.

Did you type the word RESTORE in the dialog box and then press the restore button. If importing then type the word IMPORT the press the import button. Tried it it worked for me.

This is a great project indeed, very useful
Is there any plans to move to v2 of DialogFlow? If I read right version 1 will stop working in March?

If you already have a V1 agent running, you should be able to just change it to V2 in the settings and it will work. Otherwise if building from new then:

  • create a V2 agent
  • import or restore the LMS_Control_Agent - Sanitized.zip file

I will try to create a bit of an update for the full project sometime in the next month or so but my free time for this type of thing is pretty much non-existent these days.

2 Likes

Hi everyone ,
Sorry i just need your help because i am stucked on the config between HA & LMS

I followed github dot com/ynot123/LMS_Controls/blob/master/Installation%20Instructions.md this link , and i would start avoiding the controls from google , i will implement them later.
I wanted just to implement the control of the LMS into HA to manage the selection of the music.
I have 2 players running , 1 lms on synology , HA on docker , but i cannot get the commands play pause to work.

I have a couple of questions :
Shall i need the 443 forwarding to work even if i do not use google voice?

my_domain=xxx.synology.me does this need any port ?
HA_Token=yyy
lms_ip=xx.xx.xx.xx does this need any port ?

Hass.io or Home Assistant must support the following commands in order for the shell commands to work:

curl, jq, nc, socat (for secure LMS only). Note: if your system doesn’t support nc, netcat can be used but the shell files will need to be modified to reflect this change.

shall i need to install something more ?

I can see the players , control from another card i made ,

But on lms , i am stucked , with no answer from the server , i cannot even pause

thanks all

As mentioned in the Squeezebox forum, try using lower case media player names: (ie: Livingroom should be livingroom). That’s how HA names the entities by default. That should fix the play pause issue

Ok , i ll try , just to be more detailed i have also tride the bash command but nothing happen as well from the terminal , has to be installed something more ?
nothing happens if i start from the lms web , i hear music , i go to ha , i see playing , but if i press pause… just do nothing

Error running command: bash /config/shell/qry_player_stat.sh {{text1}}, return code: 2

Error while executing automation automation.lms_gui_update_player_values. Invalid data for call_service at pos 2: expected float for dictionary value @ data[‘value’]

Please confirm your Home Assistant media player entity names. Looking at your picture in post previous to this one, looks like the names would be media_player.pi1 and media_player.pi2 not “Living Room” and “Bedroom”. They seem to show the correct status. The entity names can be confirmed in HA using the States tab under Developer Tools.

A few choices rename the entity to suit or change the input_select in the script to reflect the names pi1 and pi2

Thanks ,
You are so right , so in the list of players should i put media_player.pi1 2 3 etc… or just pi1 2 3
Very kind

image

i have this now… set all player as media_player.pi1 2 3 … let’s see

Ok , now play pause works! thanks … the search for the album / song / artist still no…
Error running command: bash /config/shell/qry_player_stat.sh {{text1}}, return code: 2
Error while executing automation automation.lms_gui_update_player_values. Invalid data for call_service at pos 2: expected float for dictionary value @ data[‘value’]

in the sync tab i have this.

I moved forward on the sh part and i tried
bash-5.0# bash-4.4# bash qry_alb.sh _metallica _one

bash: bash-4.4#: command not found
I think i miss something… but i do not know what :slight_smile:

a bit fwd…

: No such file or directoryg/shell/env_var.sh

lms_username is:

qry_alb.sh: line 108: syntax error near unexpected token `$’\r’’

'ry_alb.sh: line 108: `if [[ $zero_chk == “0” ]]

and in the HA log i still have
Error while executing automation automation.lms_gui_update_player_values. Invalid data for call_service at pos 2: expected float for dictionary value @ data[‘value’]

Error running command: bash /config/shell/qry_player_stat.sh {{text1}}, return code: 2

Your message is a bit cryptic so not sure I understand where you are at with the shell command issue. But you can:

See the following link (Shell command section) for troubleshooting the shell script files. If you open a shell and run the script that should give us a good idea of what’s wrong. https://github.com/ynot123/LMS_Controls/blob/f742ea608899896b85cc85ba50693e47894f22b7/troubleshooting.md

The following commands should be run in your HA config/shell directory and if you provide the output we should be able to see what’s going on (assume you have Supertramp breakfast in America in your LMS database, if not pick something else):

bash qry_alb.sh _supertramp _breakfast_in_america

That command will return the artists and album ID and publish it as a sensor for HA to use.

This next command will return the status of the player with mac address: bb:BB:4e:4a:d4:ea. Use lower case mac address please:

bash qry_player_stat.sh bb:bb:4e:4a:d4:ea

If the results aren’t obvious, feel free to send the output of the commands to my email ([email protected]) for review.

What if anything can be done about the breaking changes to group functionality as of 0.107? Namely view and control options are removed.

From now on, Lovelace is the only front-end available. The group section was used to automatically create a States UI page for LMS Controls. That is no longer allowed so simply delete the group section from the code.

I will eventually send out an update to the code which takes care of the deprecated issues and adds a few user requested features. But for now, I’m isolating at a cabin in the woods in Northern Ontario with very limited Internet service. Take care and stay safe. Ynot.

2 Likes

Hi , is there an explanation on how to use the sqeezebox commands with HA? , im just referring using the normal Sqeezebox integration and media player . I found the information on the HA docs not clear to make most commands to work properly , i then tryed to use sqeezebox_call method service , but it seams is deprecated , so it won work for the most important commands , any lead to the right track appreciated. tks

You can go through this code to see the use of the squeezebox_call method. lmscontrols.yaml

See a few examples below:

Change Volume

    - service:  squeezebox.call_method
      data_template:
        entity_id: "media_player.{{states.input_select.lms_player.state}}"
        command: "mixer"
        parameters: ["volume", "{{states.input_number.lms_volume.state}}"]

Play Song (Spotify uri ID):

        - service:  squeezebox.call_method
          data_template: 
            entity_id: "media_player.{{states.input_select.lms_player.state}}"
            command: playlist
            parameters: ["play","{{states.sensor.spotify_uri.state}}"]

Add Playlist:

        - service:  squeezebox.call_method
          data_template: 
            entity_id: "media_player.{{states.input_select.lms_player.state}}"
            command: playlistcontrol
            parameters: ["cmd:add","playlist_id:{{states.sensor.playlist_id.state}}"]

Finally the details of Squeezeserver commands can be found in the Help section of Squeezeserver web frontend under Help > Technical Information > Command Line Interface.

2 Likes