Media Hub - Multiple Spotify Accounts, TuneIn Radio and more!

Hi there!

I always wanted a very easy and sophisticated way to interact with my all my media devices in my house.
That’s why I decided to build an iOS shortcut that controls everything with just a few taps.
After a lot of trial and error and months of testing (was developing it in my spare time) it’s ready, working great and I would like to share it with the community that has helped me A LOT!

What is it?
Frontend: An iOS Shortcut
Backend: Node-RED automation flow

What can I do with it?

  • Play your favourite music on any Amazon Echo device using multiple Spotify accounts
  • Listen to your favourite radio stations on any Amazon Echo device
  • Turn on, open apps and control your Apple TV
  • Turn on, open apps and control your TV
  • Turn on and control your gaming consoles, home cinema, tv/cabe TV box and other devices

Scenario:
You (or a family member) want to entertain yourself, listening to your favourite Spotify playlist or one of your favourite radio stations, even resume binge-watching your latest TV Show or simply scroll through Live TV programs.
All you have to do is:

  1. Tap on the “Media Hub”
  2. Select the platform
  3. Select the speaker/set of speakers or service/device
  4. Enjoy life

You want it? Keep Scrolling!
(Screenshots in the end!)

What you’ll need:
Hardware:
iOS device with Home Assistant app installed
Amazon Echo
(Optional) Apple TV
(Optional) Smart TV

On HA side:
Node-Red
Alexa Media Player Integration
(Optional) Web OS integration (LG)
(Optional) Apple TV integration

Configuration:
Node-RED
Import the following flow into Node-Red with one of the 2 options:

iOS
Download the shortcut file and add it to your Shortcuts
Media Hub - iOS Shortcut

What Does It Do?

  1. Select Spotify
  • Select speaker
  • Sends “Spotify Connect” command to speaker (See more in the Bonus Feature)
  • Opens “Spotify” app to select speaker and play content
  1. Select TuneIn
  • Select Speaker
  • Select radio station
  • Starts playing
  1. Select Apple TV
  • Select App (Service)
  • Turns On Apple TV
  • Turns on your TV (HDMI-CEC has to be supported and enabled on your TV)
  • Opens the selected app (Service)
  • (On iOS device) Opens up the 'Remote App" where you can control the Apple TV
  1. Select TV
  • Select App, Source or Device
  • Turns On TV (or Device e.g. Xbox, HDMI-CEC has to be supported and enabled on your TV)
  • Opens the selected app (Service)

How does it work?
The iOS shortcut has 9 menus with options and over 160 “Fire Event” actions.
Every “Fire Event” action sends a payload with data specific for the action you want to fire.
The payloads are:

  • radio
  • spotify
  • tv

The data is in the following format:

{"actionName":"athensdj_bedroom"}

Example:
Tap the “Media Hub” shortcut
Select “TuneIn Radio”
Select “Everywhere”
Select “Love Radio 97.5”

  1. The “Fire Event” will send the “radio” payload with "{"actionName":"love_radio_everywhere"} data, which indicates that the “love_radio” station will be played though “everywhere” set of speakers.
  2. HA receives the event
  3. Node-RED flow is setup to listen to these fire events
  4. Node-RED’s “Event “Radio”” event listener node, receives the event with the payload and data
    a) It redirects it to the “Switch “Radio Station Pool for Everywhere”” switch node
    b) The switch node redirects it to “Love Radio” service node
    c) The service node sends the appropriate command with the following data to the integration,
    "{ "media_content_id":"Love 97,5, everywhere", "media_content_type":"TUNEIN" }

The same procedure is followed for all the rest of the platforms, services and devices.

Bonus Feature:
If you are like me and have a family which has different Spotify accounts and each member wants to use their Spotify account with the Amazon Echo’s around the house, you already know that this has been almost impossible to do without manually creating a family account and adding multiple accounts under it and then manually asking each speaker to change accounts for it to work with the member’s spotify account and possibly ruin all your routines etc.
GOD THIS IS FRUSTRATING RIGHT?

Well there is a solution:

  • Every member has to have Home Assistant application installed and a user in HA
  • Every user has to have the iOS Shortcut installed in their iOS device
  1. All they need to do is tap on the “Media Hub” shortcut
    a) Select Spotify
    b) Select speaker / set of speakers
    c) Then the “Spotify Connect” command will be fired for the specific speaker/set of speakers
    d) The Spotify app opens up on the phone
    e) Select the speaker / set of speakers in the Spotify app
    f) Select what the want to listen to

I know, its magical…
I KNOW!!! (in Monica voice)

What’s Next?

  • You need to edit the Node-RED nodes with your own devices, radio stations and services you want to trigger within the iOS shortcut.
  • You need to edit the iOS Shortcut to reflect the Node-RED configuration.
  • (I think) You can use Google Home if you’re into that ecosystem. If you are familiar with it’s commands then you can find the way to make it work
  • You can use NFC tags to trigger an automation that runs the iOS Shortcut

Suggestions and Feedback
There is always room for improvement so I’m open to your suggestions and feedback!

Screenshots (GIFs)

3 Likes

Hi Manos.
I am Anestis and I’m very new here.
I have learned a lot but I also have to learn much more!

One question my friend!
I’m searching to solve the common problem with media player artwork while changing radio stations.
Not the artist or album artwork, only the station logo, just to know what the current station that is playing right now.

I have seen a lot of tutorials and solutions, none of them working for me.

My player is vlc player and my card is mini media player.

Thnx in advance
Anestis