Read Time:3 Minute, 2 Second
Alexa Music Lovelace Dashboard
Alexa Music Lovelace Dashboard

Since Covid restrictions are dying down, it is time to start having people over. Parties require music and a way to control it. Let’s walk through how to set up a Home Assistant Alexa System to pump music throughout our house using nothing but our Alexas!

I’ve used Alexa to give me verbal notifications before when I set up my gaming system. However, now we are going to use the Home Assistant Alexa Media Player component in HACS to play music on all of our Alexas at the same time. If you haven’t set up this component before, check out the Wiki for detailed instructions.  

Alexa Setup

The first thing that you want to do is create groups in the Alexa App. I have an “Everywhere” group that I’m going to use for this example.

To Create a speaker group in the Alexa App

Steps to Reproduce

  1. Open the Alexa App
  2. Navigate to Devices
  3. Hit the + in the Upper Right Hand Corner
  4. Click Combine Speakers
  5. Choose Multi-Room Music

In Home Assistant, install the Alexa Media Player and configure it. Once you do, under your integrations, you should be able to find your group.

Home Assistant Setup

We need three “entities” in Home Assistant to set up our system.

  1. An Input Text Helper to tell Alexa what to play
  2. Home Assistant Scripts to tell Alexa what to do
  3. A Lovelace Interface to quickly start the actions

Text Helper

Think of Helpers as variables within our programming.  

  1. Navigate to Configuration -> Helpers.
  2. Create a Text Helper called “Alexa Sound Notification”
Text Helper Setup

Home Assistant Scripts

We will create two types of Scripts, one that takes user input and another set of scripts that we can call with a single button press from our Lovelace Dashboard.

Base Script

Base Script Definition

The base Script (which I’m calling Play Music) uses the Alexa Sound Notification Helper value and creates a data templated command for Alexa. Notice I’m hardcoding “everywhere group,” but you can use another Helper if desired to tell Alexa what group to play on.

I found you have to target one of your Alexa devices to get this to work. Ensure that you are also using `data_template:` in your YAML or Home Assistant won’t know what to do with the templated variable reference.

Hard-Coded Music Types

As discussed in our original article about building your Home Automations, modularity is essential. I’ve created several other scripts to call independently that set the helper text and then run the above script. This modularity allows me to develop independent scripts that I can call on various stimuli.

Smooth Jazz

By separating various types of music into their own scripts, you can also change your lights by applying scenes, timers, etc. I have one script that plays my entry music to create automations off of that as well.   

Personalized Entry Music!!

Home Assistant Lovelace Dashboard

I’ve created a Dashboard to add to my Home Assistant Main Screen to either play a Music Mood or allow for custom entry. You can do so by creating Grid, Stack, or Entities card while editing your Dashboard.

Final LoveLace Dashboard

Now that you have your initial Home Automation Media Setup, you can expand it by adding more conditions to your scripts or set a mood with lights. By incorporating the NFC tag features of Home Assistant, you can kick off your personalized entry music. You can also automate music with Google Home and Home Assistant; make sure to check out that article here.

Previous post Import Your Todoist Tasks into Roam Research
Building a Second Brain Cover Next post Announcing Building Your Personal Metadata Journal!