Skip to content

Control your Logitech / Squeezeserver players from Home Assistant and Google Home

Notifications You must be signed in to change notification settings

veeriz/LMS_Controls

 
 

Repository files navigation

LATEST CHANGES ....

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

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 40 times in the .yaml file.

Upgrade of HA from 0.99 to 0.101 required re-creation of Long Lived Tokens

Please note, with the upgrade of HA from 0.99 to 0.101 I had to re-create my long lived tokens for the shell scripts (stored in env_var.sh) and in the fulfillment section of Dialogflow project to ensure proper authentication with Home Assistant.

LMS Controls Project Updated - Dialogflow Support for V2 API - October 24, 2019

Dialogflow V1 api will be deprecated on October 23, 2019. If you are still using the V1 API, it is recommended to change your settings in Dialogflow to use the V2 API. No changes to your intents yaml configuration need to take place after upgrading to the V2 API.

To update the dialogflow project, in Dialogflow console, simply press the gear icon and change from V1 to V2. Give it a try.

LMS Controls Project Updated - January 27, 2019

Updated Spotify query shell script config/shell/spot_playlist.sh to randomly pick 1 of the top 10 playlists returned from the query. This way you get a bit more variety when asking for a Spotify playlist rather than always getting the top playlist returned.

LMS Controls Project Updated - January 24, 2019

Updated package file lmscontrols.yaml changing platform: time to platform: time_pattern due to breaking change in Home Assistant 0.86+

LMS Controls:

Control your Logitech / Squeezeserver players (LMS) from Home Assistant (HA) and Google Home (GH). A little audio demo is available. Also see the Home Assistant GUI below.

Some example commands include:

  • "Hey google ask LMS Controls to play album Dog and Butterfly by Heart in the kitchen with shuffle on"
  • "Set volume to 50" or "Set sleep timer to 30 minutes" or "Set shuffle on"
  • "Link the garage with the mediaroom"

What Can It Do:

Allows voice control for your Logitech Media Server (LMS) from Google Home (GH) or Google Assistant (GA) with Home Assistant (HA) acting as the middle man. Using these tools, you can do the following:

  • Perform queries for songs, albums, artists and playlists from the LMS server or from the music source Spotify
  • Functionality includes:
    • Play queried items
    • Add to current playlist
    • Set music source (local LMS database or Spotify (using spotty)
    • Set volume
    • Set sleep timer
    • Set shuffle on / off
    • Set repeat on / off
    • Next track
    • Pause and re-start players
    • Sync / Link squeeze players
    • Provide audio feedback of player status and query results
  • A HA GUI front-end for the query tool is also included for use inside Home Assistant
  • Using HA you can further enhance the LMS tools to create home automation scenes (ie: play your favorite radio station when you get home, turn down the lights when listening to music

See the following link for some examples of the voice commands available: example_commands.md

Basic Concepts and Data Flow:

The following outlines how the LMS Controls project works, the systems involved and the data flow:​

  • Voice Intents are handled by Dialogflow (DF) where you define the following:
    • LMS command you want (set volume, play artist, etc..)
    • Set the details of the query (artist name, song title, etc.)
    • Set the player name and any additional parameters like shuffle on, etc..
    • DF then sends a web hook to HA software containing all the information outlined above
  • HA receives the web hook from DF and:
    • Determines the values sent from DF
    • If this is music query function:
      • Performs required queries against either LMS DB or Spotify using shell scripts
      • Shell scripts return the desired link(s) based on the above query parameters by posting the results in sensors or input entities
      • The returned links are then queued to the proper player using HA's Logitech Squeezebox component
    • If this a set function (volume, shuffle, repeat) Home Assistant simply sets the value using the Media Control or Logitech Squeezebox component as required
    • The HA package also contains a Lovelace and Traditional GUI front-end to perform the same functions as the GH voice system provides
    • In addition, HA allows automation routine extensions to the LMS system. These can include:
      • Synchronize squeeze players
      • Launch favorite audio when you get home
      • Automatic setting of scenes when players start playing (ie: dim the lights, switch on certain outlets)
      • Paging / general announcements throughout the home

Prerequisites:

To make this work, you need the following:

  • Logitech Media Server
  • Hass.io or Home Assistant - open source home automation package.
  • Google Home (or google assistant)
  • Developer account for Dialogflow for the voice activation part
  • Optional Spotify account with Client_ID and Client_Secret to allow processing of Spotify music source

Installation:

Before starting the installation, please ensure the following:

  • You have a working version Logitech Media Server with some players defined

Follow the details included in the Installation Instructions.md file.

Home Assistant GUIs for LMS Player Controls Tool:

Lovelace GUI:

LoveLace GUI

Traditional HA GUI:

Traditional GUI

Troubleshooting:

See the following link for some useful troubleshooting tips troubleshooting.md

Some Useful Links:

Logitech Squeezebox Server: Wonderful full featured media server supporting tons of features, almost all protocols, most music sources, allowing you to listening to what you want, where you want throughout your home on one or many players at the same time.

Home Assistant: Home Assistant is an open source home automation platform running on Python 3. It is able to track and control all devices at home and offers a platform for automating control.

Dialogflow: Dialogflow is a conversational platform that gives users new ways to interact with their products by building engaging voice and text-based conversational interfaces, such as voice apps and chatbots, powered by AI. It features an easy-to-use front-end, natural language understanding (NLU), machine learning, and more.

Spotify Developer: Where music meets code. Exposes powerful APIs, SDKs and widgets for integration of simple and advanced applications.

Our Support Communities:

Squeezebox Community Forums: Anything you need to know about your LMS server is here.

Home Assistant Community Forums: All about Home Assistant. Lots of development and support going on here.

Dialogflow Support: Helpful if trying to publish your tools to a wider audience.

About

Control your Logitech / Squeezeserver players from Home Assistant and Google Home

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%