Sunday 22 May 2022

HA : Practical Music Solution

 I can probably spend months tinkering with Home Assistant and Google Assistant without having something practical.  I need to remember that the solution needs to help me in practice rather than include clever esoteric features which I wont use.

Home Assistant

I settled on two HA dashboard screens, the first is for MPD playlists and the second for radio/music  streams.

My existing, excellent, solution for music is an RPI running MPD with an extensive music database.  In most cases I will use a webpage to choose music so I include this webpage on my dashboard.

Any specific selections I want to have under voice control are set up with an input select card.  Initially I set this up for three albums and a charts playlist but I can easily add more options if they prove useful.  Only these four music selections are available using voice control, but that is ok.  I do have voice control for general purpose changes such as volume up/down, next track, play, pause, shuffle on/off. 



My second screen is for Pure Jongo Job control.  Typically I use this for playing radio stations so I set it up for common stations I listen to together with a few music streams which I may expand later.  Jongos dont have so many control options but pause / resume will be important.

Both the MPD and Jongo options run through my Sony amplifier so I have options to switch between the two music sources and amplifier volume up/down.


Google Assistant

The Home Assistant configuration has given us various capabilities to control music using Linux Music Player and Pure Jongos.  However we had this capability previously and our main objective is to have voice control of sounds.  Home Assistant provides us with an automated IR (infrared) remote control to "press buttons" so the final piece is to add voice control.

Google Assistant controls some devices with voice and Google Home lets us setup routines for "Hey Google" commands which carry out a wider variety of activities.  Activities provided within Google Home are very limited for my devices; I can only turn lights on/off and tell the Nest Mini to say things.  However I can import all scripts from HA to GH and invoke any of them with a voice command.

This provides exactly what we need; as long as we have a HA script for a function we can invoke it using a voice command.  To start off with my Broadlink HA integration allows me to change the volume and switch between MPD and Jongo output and HA can pause / resume devices.
Google Home doesn't allow me to specify parameters / variables so I need to set up a script in HA for each playlist / album / radio station I want to control with voice.  Once these have been imported into Google Assistant I can easily add voice commands.

It is easy to get carried away add functions, which I wont use.  For voice control it is even easier to add commands which I don't remember so I cant use.  The sensible way forward is to limit voice control to frequently used functions such as playing radio stations and changing the volume.  I set them up in a spreadsheet so that I can keep track of what is available to me.


I should also mention that Google Assistant provides an alternative to many web browser functions.  I can easily ask it for the weather forecast, information and news, although it is more difficult to phrase requests so that I get something meaningful.
Perhaps the most useful function is "hey google, where is my phone" which causes my phone to ring.





No comments:

Post a Comment