From 580f737458a8f97c2a5095786ba9081ac5aa1d46 Mon Sep 17 00:00:00 2001 From: rajlaud <50647620+rajlaud@users.noreply.github.com> Date: Fri, 8 May 2020 05:43:37 -0500 Subject: [PATCH] Add new service calls for Squeezebox (#12067) Co-Authored-By: Franck Nijhof --- source/_integrations/squeezebox.markdown | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/source/_integrations/squeezebox.markdown b/source/_integrations/squeezebox.markdown index 22dd131eea2..929c60fa9e1 100644 --- a/source/_integrations/squeezebox.markdown +++ b/source/_integrations/squeezebox.markdown @@ -75,7 +75,44 @@ This service can be used to integrate any Squeezebox action to an automation. It can also be used to target a Squeezebox from IFTTT (or Dialogflow, Alexa...). For example, to play an album from your collection, create an IFTTT applet like this: + - Trigger: Google assistant, with sentence: `I want to listen to album $` - Action: JSON post query with such JSON body: `{ "entity_id": "media_player.squeezebox_radio", "command": "playlist", "parameters": ["loadtracks", "album.titlesearch={{TextField}}"] }` + This can work with title search and basically any thing. The same wouldn't have worked by calling directly Squeezebox server as IFTTT cannot escape the text field. + +### 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. + +See documentation for this interface on `http://HOST:PORT/html/docs/cli-api.html?player=` where HOST and PORT are the host name and port for your Logitech Media Server. + +| Service data attribute | Optional | Description | +| ---------------------- | -------- | ----------- | +| `entity_id` | no | Name(s) of the Squeezebox entities where to run the API method. +| `command` | no | Command to pass to Logitech Media Server (p0 in the CLI documentation). +| `parameters` | yes | Array of additional parameters to pass to Logitech Media Server (p1, ..., pN in the CLI documentation). + +This service can be used to integrate a Squeezebox query into an automation. For example, in a Python script, you can get a list of albums available by an artist like this: +`hass.services.call("squeezebox", "call_query", { "entity_id": "media_player.kitchen", "command": "albums", "parameters": ["0", "20", "search:beatles", "tags:al"] })` +To work with the results: +`result = hass.states.get("media_player.kitchen").attributes['query_result']` + +### Service `sync` + +Add another player to this player's sync group. If the other player is already in a sync group, it will leave it. + +| Service data attribute | Optional | Description | +| ---------------------- | -------- | ----------- | +| `entity_id` | no | Name(s) of the Squeezebox entities where to run the API method. +| `other_player` | no | Name of the other Squeezebox player to join the sync group. + +### Service `unsync` + +Remove this player from its sync group. + +| Service data attribute | Optional | Description | +| ---------------------- | -------- | ----------- | +| `entity_id` | no | Name(s) of the Squeezebox entities where to run the API method. +=======