PDA

View Full Version : Anyone using Google Home, IFTTT and Home Assistant to control LMS?



itm
2018-01-16, 05:40
I've been trying to use the example here to control LMS via Google Home/IFTTT/Home Assistant, but Home Assistant doesn't like the request that I'm throwing at it:
https://home-assistant.io/components/media_player.squeezebox/

Has anyone tried this successfully?

Paul Webster
2018-01-16, 07:32
Not one that I have tried - but since it did not work first them then I suggest trying it in stages.
e.g. find a way to invoke the HA->LMS integration without having to use Google->IFTTT->HA
and check the logs for each stage.

itm
2018-01-16, 07:47
Not one that I have tried - but since it did not work first them then I suggest trying it in stages.
e.g. find a way to invoke the HA->LMS integration without having to use Google->IFTTT->HA
and check the logs for each stage.

Thanks for the suggestion. It's tricky as the only way to invoke the integration is with a JSON post query, and an IFTTT webhook seemed like the easiest way of constructing such a query!

itm
2018-01-18, 04:30
So I finally cracked it, and have Google Home controlling my LMS server/players. If anyone else should try this, here's an example of the type of IFTTT request that you need to send to home-assistant - this one plays the track that you specify:
URL: "https://yourdyndnsoripaddress:8123/api/services/media_player/squeezebox_call_method?api_password=yourHomeAssist antAPIpassword"
Method: POST
Content Type: application/json
{ "entity_id": "media_player.yourmediaplayername", "command": "playlist", "parameters": ["loadtracks", "track.titlesearch={{TextField}}"] }

It's not the easiest thing in the world to set up, but it's great to finally control my music with only my voice :0)

ModelCitizen
2018-01-18, 07:00
Hi itm.

I would dearly love to use my GH to voice control my Squeezebox stuff. I have IFTTT installed on my handheld devices but don't have any clue how to implement the info from your post above. Can you provide any pointers to where I might get more info?

Thanks for any help

itm
2018-01-18, 07:32
Hi itm.

I would dearly love to use my GH to voice control my Squeezebox stuff. I have IFTTT installed on my handheld devices but don't have any clue how to implement the info from your post above. Can you provide any pointers to where I might get more info?

Thanks for any help

I needed to install Home Assistant (https://home-assistant.io/) on a PC at home to enable this (it will run on Windows, Linux and also Raspberry Pi). Basically I've got Google Home talking to IFTTT, and IFTTT sending requests to my Home Assistant server (using the format above).
A brief overview of Home Assistant's Squeezebox platform can be found here:
https://home-assistant.io/components/media_player.squeezebox/

Paul Webster
2018-01-18, 08:41
and you HA installation needs to be reachable from the outside world (so that IFTTT can reach it).
The HA piece explains more.
https://home-assistant.io/components/ifttt/
It does not explain how it is secured (and I have not looked - I don't use HA) so take care.

itm
2018-01-18, 08:45
and you HA installation needs to be reachable from the outside world (so that IFTTT can reach it).
The HA piece explains more.
https://home-assistant.io/components/ifttt/
It does not explain how it is secured (and I have not looked - I don't use HA) so take care.

Security isn't ideal TBH. I've set up an SSL endpoint on my HA server but I can't find a way to avoid embedding the HA API password in the URL that you specify to IFTTT.

Mark Miksis
2018-01-19, 17:56
So I finally cracked it, and have Google Home controlling my LMS server/players.

Very cool - thanks for documenting this. I'm looking forward to trying this when I have time to set it up.

oyvindo
2018-02-03, 05:02
Hi All,

I have configured my LMS in the HA config file, and run the config check : no errors, and then restarted HA: no errors.
But then what?
What should I expect?
No GUI element for LMS shows up, and the HA Overview Page, and my LMS doesn't show up anywhere in the HA States List.

So where do I go from here?

itm
2018-02-03, 05:48
Hi All,

I have configured my LMS in the HA config file, and run the config check : no errors, and then restarted HA: no errors.
But then what?
What should I expect?
No GUI element for LMS shows up, and the HA Overview Page, and my LMS doesn't show up anywhere in the HA States List.

So where do I go from here?

I have this in my configuration.yaml and my Squeezebox devices are listed as media_player entities in the States page of the HA interface:

media_player:
- platform: squeezebox
host: 192.168.1.45


I'm running HA 0.61.1 (on Ubuntu)

oyvindo
2018-02-03, 05:55
I have this in my configuration.yaml and my Squeezebox devices are listed as media_player entities in the States page of the HA interface:

media_player:
- platform: squeezebox
host: 192.168.1.45


I'm running HA 0.61.1 (on Ubuntu)

That's exactly what I also have in my yaml, but nothing is listed in the States page.
I'm running 0.62.1 in a docker container on a QNAP NAS. Everything else works just fine with my HA. Just not LMS.

itm
2018-02-03, 05:59
That's exactly what I also have in my yaml, but nothing is listed in the States page.
I'm running 0.62.1 in a docker container on a QNAP NAS. Everything else works just fine with my HA. Just not LMS.

Is your LMS password-protected? (in which case you'll need to add authentication details to configuration.yaml). HA also defaults to port 9000 for LMS web server access - if your LMS server uses a different port you'll need to include that in the HA config as well

oyvindo
2018-02-03, 08:20
Is your LMS password-protected? (in which case you'll need to add authentication details to configuration.yaml). HA also defaults to port 9000 for LMS web server access - if your LMS server uses a different port you'll need to include that in the HA config as well

Thank you for helping. All of that is covered in detail at https://home-assistant.io/components/media_player.squeezebox/, and no - my LMS has no password and yes, I'm using port 9000 (Default).
So, there is something less obvious, causing this problem.

atca
2018-02-04, 03:51
So I finally cracked it, and have Google Home controlling my LMS server/players. If anyone else should try this, here's an example of the type of IFTTT request that you need to send to home-assistant - this one plays the track that you specify:
URL: "https://yourdyndnsoripaddress:8123/api/services/media_player/squeezebox_call_method?api_password=yourHomeAssist antAPIpassword"
Method: POST
Content Type: application/json
{ "entity_id": "media_player.yourmediaplayername", "command": "playlist", "parameters": ["loadtracks", "track.titlesearch={{TextField}}"] }

It's not the easiest thing in the world to set up, but it's great to finally control my music with only my voice :0)Where / how do you setup the iftt command?

I have hass connected to LMS.

I have iftt on my phone.

Not sure how to setup the trigger....

Sent from my Pixel 2 using Tapatalk

atca
2018-02-04, 04:28
Where / how do you setup the iftt command?

I have hass connected to LMS.

I have iftt on my phone.

Not sure how to setup the trigger....

Sent from my Pixel 2 using TapatalkOk looks like you create IFTT with a google assistant trigger and a webhook (not maker) action.

Question the url

https://yourdyndnsoripaddress:...rHomeAssistantAPIpassword

Should "...." Be your port number?

I.e. Https://192.168.1.100:8123password ?

Should there be a separator between the port and password?

Also do you hardcode the squeezebox name into he json request?

If not how do you pass the squeezebox target in?

Sent from my Pixel 2 using Tapatalk

atca
2018-02-04, 15:35
Ok managed to get HA and IFTTT setup.

Main stumbling block is Google assistant won't trigger IFTTT. I've tried several different permutations and cases of phrase for the trigger with no luck.

Google assistant is working with some pre built IFTTT apps.

So frustrating. :(

Sent from my Pixel 2 using Tapatalk

dimmer
2018-02-12, 13:17
IFTTT does need to be linked with your google assistant in order to be triggered ... assume you go that.
Also, you need to use command triggers that won't be interpreted by google as a trigger.
I basically preface all my IFTTT trigger with "LMS"
ex. "hey google" "LMS play"

I have documented how I got this working with IFTTT without needing home assistant at the following link.
http://forums.slimdevices.com/showthread.php?108388-LMS-with-Google-Home-Chromecast-and-IFTTT-(maybe)&p=906727#post906727

I have attached a spreadsheet with the URL commands that I use also ... even if you use home assistant,you may find the spreadsheet helpful.

atca
2018-02-24, 06:46
IFTTT does need to be linked with your google assistant in order to be triggered ... assume you go that.
Also, you need to use command triggers that won't be interpreted by google as a trigger.
I basically preface all my IFTTT trigger with "LMS"
ex. "hey google" "LMS play"

I have documented how I got this working with IFTTT without needing home assistant at the following link.
http://forums.slimdevices.com/showthread.php?108388-LMS-with-Google-Home-Chromecast-and-IFTTT-(maybe)&p=906727#post906727

I have attached a spreadsheet with the URL commands that I use also ... even if you use home assistant,you may find the spreadsheet helpful.Not sure I like that solution as LMS is exposed to the internet. Even passworded I don't think I like that.

LMS was never intended to be publicly exposed and mherger has iterated that LMS should not be exposed to WAN.

I'd be more comfortable exposing home automation software which is more modern and design for WAN access.

Thanks for the cross reference tho.

Sent from my Pixel 2 using Tapatalk

itm
2018-02-24, 08:16
IFTTT does need to be linked with your google assistant in order to be triggered ... assume you go that.
Also, you need to use command triggers that won't be interpreted by google as a trigger.
I basically preface all my IFTTT trigger with "LMS"
ex. "hey google" "LMS play"

I have documented how I got this working with IFTTT without needing home assistant at the following link.
http://forums.slimdevices.com/showthread.php?108388-LMS-with-Google-Home-Chromecast-and-IFTTT-(maybe)&p=906727#post906727

I have attached a spreadsheet with the URL commands that I use also ... even if you use home assistant,you may find the spreadsheet helpful.

I've been trying out this method, and have been having problems with the Skip command (i.e. to skip to the next track). Here's an example of the request that I'm using to skip to the next track:

http://mydyndns:9000/status.html?player=12:34:56:78:90:01&p0=playlist&p1=jump&p2=+1

The first time I make this request it works fine - i.e. playback skips to the next track in the playlist. Subsequent requests don't work though - they just cause the currently playing track to start playing again from the start. Also, the playlist then never moves onto the next track - it keeps replaying the current track.

Is the above syntax incorrect for skipping to the next track?

dimmer
2018-02-25, 14:53
I've been trying out this method, and have been having problems with the Skip command (i.e. to skip to the next track). Here's an example of the request that I'm using to skip to the next track:

http://mydyndns:9000/status.html?player=12:34:56:78:90:01&p0=playlist&p1=jump&p2=+1

The first time I make this request it works fine - i.e. playback skips to the next track in the playlist. Subsequent requests don't work though - they just cause the currently playing track to start playing again from the start. Also, the playlist then never moves onto the next track - it keeps replaying the current track.

Is the above syntax incorrect for skipping to the next track?

I ran into the same issue. The "+" is getting interpreted before getting to LMS ... you need to escape it with ascii representation. "+" = "%2b".

If you use the spreadsheet in my link above, it will create a working string.

I am currently controlling my LMS using Google Home. I can easily bring up artists and playlist, next, prev, volume, etc ... the ease and accuracy is impressive.
I like it so much that I bought a Google home mini for the bedroom. The one thing that I don't like is that actions are not "context aware". That is, if I'm in the bedroom, I would like it to know enough to control the bedroom's music. Instead, I have had to create a separate set of applets for the bedroom that get triggered by voice command info. For example "LMS play in bedroom" . There are a number of complaints like this for controlling lights ... so I would expect to see the ability to add some logic based on the location in the house. I did consider setting up the second google home with a separate account, but I have enough user accounts and logins to content with.

In any case, this is working well for me and has a "wow" factor when the friends come over. It's also great for some laughs if you use IFTTT to get it to respond to queries like "Hey Google, tell me about Michael Hunt?"

itm
2018-02-26, 05:09
I ran into the same issue. The "+" is getting interpreted before getting to LMS ... you need to escape it with ascii representation. "+" = "%2b".

If you use the spreadsheet in my link above, it will create a working string.


Brilliant - that fixed it. Thanks!

The only issue I have is that there's no way of directing it to play a specific version of a track. For example, if I ask it to play "Brown Sugar" it will pick a random version from a live album, rather than the one from Sticky Fingers that I want. Do you know of a way of directing it to a specific album track? (e.g. "Hey Google, play Brown Sugar from the album Sticky Fingers")

dimmer
2018-02-26, 18:16
Brilliant - that fixed it. Thanks!

The only issue I have is that there's no way of directing it to play a specific version of a track. For example, if I ask it to play "Brown Sugar" it will pick a random version from a live album, rather than the one from Sticky Fingers that I want. Do you know of a way of directing it to a specific album track? (e.g. "Hey Google, play Brown Sugar from the album Sticky Fingers")

yeah ... I found the search capability somewhat limited also.
With IFTTT allowing only one text and one numeric variable within the Google assistant hook, doing compound searches is tough.

I was able to use playlists to get a little more out of it ... for example, the wife's favorite morning radio station is in a playlist that she can call up.

However, the technology is just getting off the ground ... I suspect that we'll see so much more in the near future.

itm
2018-02-27, 04:14
yeah ... I found the search capability somewhat limited also.
With IFTTT allowing only one text and one numeric variable within the Google assistant hook, doing compound searches is tough.

I was able to use playlists to get a little more out of it ... for example, the wife's favorite morning radio station is in a playlist that she can call up.

However, the technology is just getting off the ground ... I suspect that we'll see so much more in the near future.

It's frustrating as the CLI for LMS does seem to allow for it - I got details of how to do it here:
http://forums.slimdevices.com/showthread.php?108606-CLI-web-command-to-search-for-track-from-specific-album&p=904931#post904931

It's just the voice front end that lacks the sophistication at the moment

atca
2018-03-31, 15:20
I now have this working with Google Assistant > IFTTT > HomeAssistant (HASS) > LMS. Difficult to set up HASS with SSL, IFTTT integration and Google Assistant integration but once done = Very very cool.

I now have near seamless control of my Squeezebox by voice.

Here are some of my IFTTT applet configs:
All use Google Assistant as Trigger.
All use WebHooks as Action.


URL

https://YOURHASSDOMAIN:PORT/api/services/media_player/squeezebox_call_method?api_password=YOURHASSAPIPAS SWORD

Method:POST

Content Type:Application/JSON

Then Body varies as follows, with one IFTTT applet, with one body for each separate command.
Ensure you change sbhifi_touch to your player name, this is shown in the HASS terminal - it seems to escape spaces with _ .
Yes, you need separate IFTTT command applets for each player.

Play Artist $
Trigger command:HiFi Play Artist $

{ "entity_id": "media_player.sbhifi_touch", "command": "playlist", "parameters": ["loadtracks", "contributor.namesearch={{TextField}}"] }

Play Track $
Trigger command:HiFi play $

{ "entity_id": "media_player.sbhifi_touch", "command": "playlist", "parameters": ["loadtracks", "track.titlesearch={{TextField}}"] }

Play Next Track
Trigger command:HiFi Play Next

{ "entity_id": "media_player.sbhifi_touch", "command": "button", "parameters": "fwd"}

Stop
Trigger command:HiFi stop

{ "entity_id": "media_player.sbhifi_touch", "command": "stop"}

Play
Trigger command:HiFi play

{ "entity_id": "media_player.sbhifi_touch", "command": "play"}

Power off
Trigger command:HiFi Power Off

{ "entity_id": "media_player.sbhifi_touch", "command": "power", "parameters": "0"}

Play radio
Trigger command:HiFi Play Radio 6

{ "entity_id": "media_player.sbhifi_touch", "command": "playlist", "parameters": ["play","iplayer://live?dash=dash://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/dash/uk/dash_full/ak/bbc_6music.mpd"]}

castalla
2018-03-31, 16:07
I now have this working with Google Assistant > IFTTT > HomeAssistant (HASS) > LMS. Difficult to set up HASS with SSL, IFTTT integration and Google Assistant integration but once done = Very very cool.

I now have near seamless control of my Squeezebox by voice.

Here are some of my IFTTT applet configs:
All use Google Assistant as Trigger.
All use WebHooks as Action.


URL
https://YOURHASSDOMAIN:PORT/api/services/media_player/squeezebox_call_method?api_password=YOURHASSAPIPAS SWORD

Method:POST

Content Type:Application/JSON

Then Body varies as follows, with one IFTTT applet, with one body for each separate command.
Ensure you change sbhifi_touch to your player name, this is shown in the HASS terminal - it seems to escape spaces with _ .
Yes, you need separate IFTTT command applets for each player.

Play Artist $
Trigger command:HiFi Play Artist $

{ "entity_id": "media_player.sbhifi_touch", "command": "playlist", "parameters": ["loadtracks", "contributor.namesearch={{TextField}}"] }

Play Track $
Trigger command:HiFi play $

{ "entity_id": "media_player.sbhifi_touch", "command": "playlist", "parameters": ["loadtracks", "track.titlesearch={{TextField}}"] }

Play Next Track
Trigger command:HiFi Play Next

{ "entity_id": "media_player.sbhifi_touch", "command": "button", "parameters": "fwd"}

Stop
Trigger command:HiFi stop

{ "entity_id": "media_player.sbhifi_touch", "command": "stop"}

Play
Tigger command:HiFi play

{ "entity_id": "media_player.sbhifi_touch", "command": "play"}

Power off
Tigger command:HiFi Power Off

{ "entity_id": "media_player.sbhifi_touch", "command": "power", "parameters": "0"}

Interesting - but way above my pay-grade, I'm afraid,

itm
2018-03-31, 16:11
atca could you please confirm the URL that you used - maybe with code tags around it as the URL in your previous post was shortened

atca
2018-03-31, 16:16
atca could you please confirm the URL that you used - maybe with code tags around it as the URL in your previous post was shortenedUpdated

Sent from my Pixel 2 using Tapatalk

atca
2018-03-31, 16:25
Updated

Sent from my Pixel 2 using TapatalkStill have to embed the API password :(


Sent from my Pixel 2 using Tapatalk

itm
2018-03-31, 16:43
Still have to embed the API password :(


Yeah that's a pain :0(

atca
2018-12-03, 16:02
Change volume


{ "entity_id": "media_player.PLAYERNAME", "command": "mixer", "parameters": ["volume", "{{NumberField}}"] }