home-assistant.io/source/_integrations/squeezebox.markdown
Raj Laud d66e4f40b6
Update squeezebox.markdown for https support (#27939)
* Update squeezebox.markdown for https support

* Tiny tweak

* Tiny tweak to kick the linter

---------

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
2023-12-20 10:14:48 +01:00

4.6 KiB

title, description, ha_category, ha_release, ha_iot_class, ha_domain, ha_codeowners, ha_config_flow, ha_dhcp, ha_platforms, ha_integration_type
title description ha_category ha_release ha_iot_class ha_domain ha_codeowners ha_config_flow ha_dhcp ha_platforms ha_integration_type
Squeezebox (Logitech Media Server) Instructions on how to integrate a Logitech Squeezebox player into Home Assistant.
Media player
pre 0.7 Local Polling squeezebox
@rajlaud
true true
media_player
integration

The Squeezebox integration allows you to control a Logitech Squeezebox music player from Home Assistant. This lets you control Squeezebox hardware like the Classic, Transporter, Duet, Boom, Radio and Touch and of software players like Squeezelite, SoftSqueeze, SqueezePlayer and SqueezeSlave.

{% include integrations/config_flow.md %}

This platform uses the web interface of the Logitech Media Server (LMS) to send commands. The default port of the web interface is 9000. It is the same port that you use to access the LMS through your web browser.
The integration now supports Logitech Media Servers behind an HTTPS reverse proxy. Please note that Logitech Media Server natively only supports HTTP traffic. Unless you have configured a reverse proxy, do not select the `https` option. If you have configured a reverse proxy, remember to update the port number.

The Logitech Transporter which have two digital inputs can be activated using a script. The following example turns on the Transporter and activates the toslink input interface:

# Turn on Transporter and activate toslink interface
transporter_toslink:
  sequence:
    - service: homeassistant.turn_on
      target:
        entity_id: media_player.transporter
    - service: media_player.play_media
      target:
        entity_id: media_player.transporter
      data:
        media_content_id: "source:toslink"
        media_content_type: "music"

Service call_method

Call a custom Squeezebox JSON-RPC API.

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 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']