awesome-ha-blueprints icon indicating copy to clipboard operation
awesome-ha-blueprints copied to clipboard

Enhancement - Hook with selectable media players

Open nagyrobi opened this issue 3 years ago • 1 comments

Blueprint name

Media Player Hook for rotary controllers (could apply to lights too).

Description

Currently the Controller - IKEA E1744 SYMFONISK Rotary Remote together with Hook - Media Player allow controlling only one fixed media player which can be chosen when creating the automation from the blueprint.

It would be nice, with the addition of an input_select to pre-select on the fly which media player we want to actually control. This could be useful for multiroom systems which actually appear as different media players for each room, but the user would like to be able to choose that the actual rotary controller would apply to which media player.

Use case: I take the controller with me to Room 1, I want the controller to operate there with me as we spend time there. Later, we move back to Room 2, let me back to operate in the new location. Could apply to dimming lights too for setting only the level preset, having local controls only for on/off.

Automation YAML config

- service: media_player.volume_up
        entity_id: >
            {% if is_state("input_select.media_players_list", "Room 1") %}
              media_player.sound_room_1
            {%-elif is_state("input_select.media_players_list", "Room 2") %}
              media_player.sound_room_2
            {%-elif is_state("input_select.media_players_list", "Room 3") %}
              media_player.sound_room_3
            {%-elif is_state("input_select.media_players_list", "Room 4") %}
              media_player.sound_room_4
            {%-elif is_state("input_select.media_players_list", "Room 5") %}
              media_player.sound_room_5
            {% endif %}

Implementation

No response

Additional Details

  • [ ] I'd like to help developing this feature/improvement.

Useful resources

No response

Additional context

No response

nagyrobi avatar Jul 25 '21 19:07 nagyrobi

As a workaround, I created the same automation using the same controller for all the different rooms, and written a manual automation to enable/disable the automations created by the hook blueprint, according to the state of the input_select but this is kinda brute-force way to do it:

  - id: symfonisk_rotary_select_for_which_player
    alias: Ikea Symfonisk Rotary Media Player Selector
    initial_state: 'on'
    trigger:
    - platform: state
      entity_id: input_select.media_players_list
    action:
      - service: automation.turn_off
        target:
          entity_id:
            - automation.hook_media_player_ikea_controller_room_1
            - automation.hook_media_player_ikea_controller_room_2
            - automation.hook_media_player_ikea_controller_room_3
            - automation.hook_media_player_ikea_controller_room_4
            - automation.hook_media_player_ikea_controller_room_5
      - service: automation.turn_on
        target:
          entity_id: >
            {% if is_state("input_select.media_players_list", "Room 1") %}
              automation.hook_media_player_ikea_controller_room_1
            {%-elif is_state("input_select.media_players_list", "Room 2") %}
              automation.hook_media_player_ikea_controller_room_2
            {%-elif is_state("input_select.media_players_list", "Room 3") %}
              automation.hook_media_player_ikea_controller_room_3
            {%-elif is_state("input_select.media_players_list", "Room 4") %}
              automation.hook_media_player_ikea_controller_room_4
            {%-elif is_state("input_select.media_players_list", "Room 5") %}
              automation.hook_media_player_ikea_controller_room_5
            {% endif %}

nagyrobi avatar Jul 25 '21 20:07 nagyrobi