🔌 Media Player Hook - Control any media player (play/pause, volume, prev/next track) with one of the supported controllers

This blueprint is part of the Awesome HA Blueprints project.
Read more about it on the related Community Forum topic. :rocket:

Updates will be published on the project’s GitHub repository.

:arrow_down: Get Started

Option 1: My Home Assistant

Click the badge to import this Blueprint (needs Home Assistant Core 2021.3 or higher)

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Option 2: Direct Link

Copy this link if you want to import the blueprint in your installation.

:link: Blueprint URL

:page_facing_up: Description

This Hook blueprint allows to build a controller-based automation to control a media player. Supports volume setting, play/pause and track selection.

:closed_book: Full Documentation

Full documentation regarding requirements, inputs and more is available here.

Docs provide all the information you need to properly configure this blueprint on your instance.

:video_game: Supported Controllers

:information_source: Changelog

Updated list of changes and improvements is available here.

Happy automating to everyone! :fire:

1 Like

Looks really cool. Any chance of adding the IKEA Symfonisk remote as a controller?

I’m pretty sure the badge is supposed to go after

Hi @sparkydave,

thank you!
I’ll take a look at this remote and try to implement a Controller blueprint for it, then add support for both the Light and Media Player Hook.

I’ll let you know as soon as the controller is supported. :+1:

Hi @KTibow,

you’re definitely right, thank you for reporting.
Original post has been updated with your suggestion. :slight_smile:

If I add the E1524 blueprint and the media player blue print and I make an automatization with the E1524 (pure linking to ZHA) all my automatization’s crash :frowning:

Hi @Johannes_Aloijsius,

Thank you for reporting here, I’m sorry for what you are experiencing.

Does this setup (E1524 Controller + Media Player Hook) work if you don’t add the pure ZHA automation?
Are there any entries in the Home Assistant Logs related to automations or blueprints?

Hi @sparkydave,

I’m happy to inform you that I’ve just added a Controller blueprint for the IKEA E1744 SYMFONISK remote, you can find it here:

Moreover, support for the remote has been added to the Media Player and Light Hook.

If you have any suggestions or you want to leave a feedback about the blueprint for the E1744 controller, we can continue the discussion there. :slight_smile:

1 Like

Legend! :+1:

1 Like

Hi there,

I’ve published an update for this blueprint, which adds support for the IKEA E1812 Shortcut button and fixes a naming issue for the IKEA E1743 Wireless Dimmer.

:warning: If you had previously used this blueprint with an IKEA E1743 and you’d like to update it, you’ll need to fix your current automations. Please make sure that the value for the Controller model input in automations generated by this Hook is exactly equal to “IKEA E1743 On/Off Switch & Dimmer”.

Happy automating! :tada:

Follow-up of the following question received in another thread:

Hi @roberto87,

thank you for reporting.

Please post here the configuration for both the Controller and Hook automations you’re experiencing issues with.

Moreover, did you notice any entries related to these blueprints in the Home Assistant Logs?

Hi there!

I’ve just published an update for this blueprint. You can now specify the number of steps to go from min to max volume when controlling the volume, both for short actions (button press etc.) and long actions (rotation, button hold). :tada:

This allows to configure a finer and more precise volume control, which you can easily customize for your media player. You can find more about this new feature in the docs.

Happy automating!

The added setting for adjusting the volume control sensitivity is awesome. Thank you!

1 Like

You’re welcome @sparkydave!

Hello,
I have a IKEA E1524 remote and I created 2 automations based on your blueprints :

  • Controller Ikea E1524/E1810 5-Button remote
  • Hook - Media Player
    to try play music/radio on my Echo Dot 3.

Here is their respective yaml :

alias: Kitchen music (Tradfri remote E1524)
description: ''
use_blueprint:
  path: EPMatt/ikea_e1524_e1810.yaml
  input:
    integration: deCONZ
    controller_device: 67bce5a0e24c261314b17ad7b367bc23
alias: Kitchen music Hook Media Player (Tradfri remote E1524)
description: by EPMatt
use_blueprint:
  path: EPMatt/media_player.yaml
  input:
    controller_device: 67bce5a0e24c261314b17ad7b367bc23
    media_player: media_player.kitchen
    controller_model: IKEA E1524/E1810 5-Button remote

Now I’m not sure how to go from there if I wanted to play Spotify or a TuneIn radio stream by clicking the main center button :confused:
Do you have any yaml examples I could copy/paste somewhere ? Thanks !

Hi @JeromeO, thank you for reporting here.

The Media Player Hook maps the center button short press event to the “play/pause media” action. However, you can configure a custom action in the controller automation to run for the center button double press event, which is not used by any of the currently available hook configurations.

Here’s the updated YAML for your controller automation:

alias: Kitchen music (Tradfri remote E1524)
description: ''
use_blueprint:
  path: EPMatt/ikea_e1524_e1810.yaml
  input:
    integration: deCONZ
    controller_device: 67bce5a0e24c261314b17ad7b367bc23
    # sequence to play a TuneIn radio stream
    action_button_center_double:
      -  service: ...
    # remember also to turn on the virtual double press feature
    # on the center button
    button_center_double_press: true

If you want to learn more about controllers, hooks and the different available configuration options, you can give a reading to the Controllers-Hooks Ecosystem documentation. I’m planning to add a TL;DR version of that doc page, as well as a detailed FAQ section. Both of them will act as a quickstart guide for helping users to setup controllers and hooks on their systems. :slight_smile:

Moreover, I can see from your YAML config that you’re using an outdated version for the Media Player hook. I’d like to suggest you updating the blueprint to the latest version (currently 2021-10-29); thanks to the good work of a kind contributor, during the last couple of days I’ve published a major update, adding support for alternate Hook mappings (more of which will be added in the near future for currently supported devices), and fixing a few naming issues for supported controllers in hooks. Since this is a breaking change, I’d suggest you to read the blueprint’s changelog and update your hook configuration accordingly. :wink:

Please let me know if you’re able to achieve the desired setup with my suggestion.
Thank you!

Thank you for pointing out I had an obsolete version of the Media Player blueprint (although I don’t think it changes anything to my problem/misunderstanding) => I updated :slight_smile:

After some more testing, I was able to launch a radio stream when clicking the center button.
I was also able to increase/lower the volume thanks to the up and down buttons but I had to explicitly code those 2 actions when I thought they would be automatically embedded in the Media Player hook => this is where I’m not sure I totally got it :confused:
Maybe it has something to do with the 2 required fields I left blank in the Media Player hook ?..

Another confusing thing (if it can help anyone else) is that you need to call the service media_player.play_media to play a TuneIn stream and NOT media_player.media_play that does exist as well ! (note the reversed words)

Please see the resulting yaml.

Blueprint controller

alias: Kitchen music (Tradfri remote E1524)
description: ''
use_blueprint:
  path: EPMatt/ikea_e1524_e1810.yaml
  input:
    integration: deCONZ
    controller_device: 67bce5a0e24c261314b17ad7b367bc23
    action_button_center_short:
      - service: media_player.play_media
        target:
          device_id: 113364968a2b7f03eae79b27d53c60d1
        data:
          media_content_id: France Info
          media_content_type: TUNEIN
    action_button_up_short:
      - service: media_player.volume_up
        target:
          device_id: 113364968a2b7f03eae79b27d53c60d1
    action_button_down_short:
      - service: media_player.volume_down
        target:
          device_id: 113364968a2b7f03eae79b27d53c60d1

Blueprint Hook

alias: Kitchen music Hook Media Player (Tradfri remote E1524)
description: by EPMatt
use_blueprint:
  path: EPMatt/media_player.yaml
  input:
    controller_device: 67bce5a0e24c261314b17ad7b367bc23
    media_player: media_player.kitchen
    controller_model: IKEA E1524/E1810 5-Button remote
    volume_steps_short: 5
    volume_steps_long: 5

(not much changes in there except the volume steps that I lowered)

Hi @JeromeO, thank you for your feedback.

Exactly, those required inputs allow the Hook automation to “hook” to the controller automation. You should either provide a value for the “Controller Entity” or “Controller Device” input, depending the integration you’re using for setting up your device in Home Assistant (in your case, “Controller Entity” if using Zigbee2MQTT or “Controller Device” if using deCONZ or ZHA).

By the way, I can see from your YAML that you correctly provided a value for the “Controller Device” input in the media player hook. The issue might be with the controller_model input. Version 2021-10-26 introduced a breaking change for this input, as described in the blueprint’s changelog:

  • 2021-10-26:
  • Standardize blueprints structure and inputs naming across the whole collection.
  • Improve blueprint documentation.
  • :tada: Add support for alternate mappings. Additional mappings for currently supported controllers will be added from now on. Refer to the documentation of your controller for more details.
  • :warning: Breaking Change: update controller names in the Controller Model input, to match the full name of controllers, prevent ambiguities and enable support for alternate mappings. After updating this blueprint, please reconfigure your automations by selecting again the value for the Controller Model input, matching the full name of the controller you’re using with this hook.
  • Fix typo for IKEA E1524/E1810 center button long press action in mapping definition.

Please select a valid value for the controller_model input while configuring the blueprint from the UI. The value should match the full name of your device. You should then be able to control the media player’s volume without having to configure custom actions. :slight_smile:

Thank you Matt for taking the time to guide me !

I updated the Controller blueprint to 2021-10-26 and created a new automation based on it.
I also added the missing required “Controller model” in the Hook Media Player automation like you mentioned.

I now have those 2 yaml but the TuneIn station won’t launch anymore :frowning:
(it does launch in a basic automation without the blueprint)

Controller

alias: Kitchen music (with Tradfri remote E1524)
description: Based on 2021.10.26 blueprint
use_blueprint:
  path: EPMatt/ikea_e1524_e1810.yaml
  input:
    integration: deCONZ
    controller_device: 67bce5a0e24c261314b17ad7b367bc23
    action_button_center_short:
      - service: media_player.play_media
        data:
          media_content_id: France Info
          media_content_type: TUNEIN
        target:
          entity_id: media_player.kitchen

Hook Media Player

alias: Kitchen music Hook Media Player (with Tradfri remote E1524)
description: Based on 2021.10.29 blueprint
use_blueprint:
  path: EPMatt/media_player.yaml
  input:
    controller_device: 67bce5a0e24c261314b17ad7b367bc23
    controller_model: IKEA E1524/E1810 TRÅDFRI Wireless 5-Button Remote
    media_player: media_player.kitchen

If I click “Run actions” in the Controller, nothing happens either.
In its Trace Timeline, I have the following error :

Stopped because an error was encountered at November 5, 2021, 10:45:13 PM (runtime: 0.07 seconds)

UndefinedError: 'dict object' has no attribute 'event'

See anything I’ve done wrong ?..

[Update] I have another Ikea remote (E1810 that one) using your Controller/Light blueprints.
It was working fine until I decided to update the Hook Light to version 2021.10.29.
I re-recreated 2 automations from scratch for this remote/light to no avail…
The error in the Trace Timeline of the Hook Light is also :
UndefinedError: 'dict object' has no attribute 'event'
So my problems might have the same root cause.

I understood my mistake : I was missing the required Helper - Last Controller Event field in the automation based on the Controller blueprint.
I created a dummy input text helper in the /config/helpers page called input_text.dining_room_lights_last_controller_event (as Entity ID) and used it as the Helper - Last Controller Event.
I can now toggle on/off my group of dining room lights :slight_smile:

The up/down buttons do not change brighten/dim the lights though.
The left/right buttons (arrows) do not change the kelvin either.
What am I missing ? :thinking:
(although I see the “trigger_action”: 2002, “trigger_action”: 5002, etc… in the Trace Timeline with no errors)

[Update] Hmm, I was a little too enthusiastic and I have a funky behavior with that Center button (toggle on/off) : once I start using that button, the group of lights remain “on” in the Lovelace interface, even when they’re off (they’re literally off and my LIFX app shows them as off) and I cannot turn them off through the virtua button in Lovelace :confused:
I went to the Developer tools and emptied the value of my new input_text.dining_room_lights_last_controller_event helper, reloaded Input Texts in the Server Controls but none of that unblock the status in Lovelace.
Only when I restart HA does it reset the status lights to its real off status :expressionless:
Dunno if this has anything to do with either the new input text helper or the fact that I am dealing with a group of lights and not not a single bulb (I would have to try that second option)

[Update 2] Ok, nevermind the funky on/off behavior. It’s working fine now. Must have been a temporary glitch.
It’s just the left/right and up/down buttons that do nothing :-/