Z2M - IKEA Symfonisk Gen2 [E2123] Media Control v1.55

Sweet :smiley: Thanks for letting me know!

Hello,
Thank’s for the blueprint.
I have a question please :
I use the ikea controller with android TV (xiaomi box S) but the volume button it’s not work :frowning:
Can you help me please ? May-be with a script (volume up/down) but how add to blueprint ?

Sorry for my english i’m french :slight_smile:

FR :
Bonjour,
Merci pour le blueprint
J’ai une question svp :
j’utilise le bouton IKEA avec une box android TV mais je n’arrive pas à gérer le volume avec le bouton volume up/down cela ne fait rien.
Je pense qu’on peut utiliser un script mais je ne serais pas l’ajouter au blueprint.
Pourriez vous m’aider ?
Merci

Hi,

If the volume buttons show activity in Z2M (ie the integration into HA is working) then there must be a problem in your automation. You can see how I’m doing it in this blueprint. How to create your own is covered in the docs, available here Using automation blueprints - Home Assistant (home-assistant.io)

p.s Nothing wrong with your English :slight_smile:

I also have problem with volume control. It does not work for me when I’m trying to control group or single entity.

Are you using my blueprint or doing like the other guy who was using my code to do something else?

If you’re using my blueprint then you need to check the device has been added properly and is not using the original firmware. Either way going to need you to provide details about your setup and preferably showing that Z2M is detecting the button presses etc

Edit: I forget to ask as I use Sonos exclusively, what is your media player attached to? Something other than Sonos? If so, what is it and can you provide logs from the blueprint showing what happens when you press the volume button?

Hi. I am facing the same issue - all buttons are ok, except of volume control.
The actions are visible in log, but nothing happens. Can someone suggest how to fix it? Thanks a lot!
I use Denon HEOS speakers. I tried as a group and separately, but no result.

I tried a simple button to set the volume from dashboard and it works (to check if there is support to set the volume).

`cards:
  - type: button
    tap_action:
      action: call-service
      service: media_player.volume_set
      service_data:
        volume_level: 0.1
      target:
        entity_id: media_player.na_lednici`

Hmm looks like there’s something different in the media player compared to Sonos. Could you check the automation logs for me please? There might be an error in there?

Could you also check the media player properties (Developer Tools, State, filter to your media player), I’m interested in the group_members property as per the screen grab

Hi, just finished my mod of this blueprint, heres’s my setup:
i’ve an e2123 for each chromecast in the house, and offcourse made a group in google Home to rule them all at once :wink: , i’m also using Music assitant. So, 2 entities per chromecast and group.
Had to mod the blueprints this way, because of the multiple sources i’m using: spotify / direct casting / mass… This one (MusicAssistant) just take control over the others when pressing p.e. ‘next_track’ while the mass_player is selected as the original blueprint player. When it is not, ‘next_track’ action do nothing if MusicAssistant is the source.

Ther’s a mod on the PLay/pause button while group is on, the goal is tu mute/unmute the single player controlled by remote when play/pause button is pressed, instead of pausing music in the whole house.

Code
blueprint:
  name: Media Player + Music Assistant / Z2M / IKEA E2123 Remote
  description: 'IKEA Symfonisk sound controller GEN2 (e2123) via Zigbee2MQTT (Z2M)'
  domain: automation
#-------
  input:
    remote:
      name: Symphonisc Remote
      description: The IKEA remote to use
      selector:
        device:
          integration: mqtt
          manufacturer: IKEA
          model: SYMFONISK sound remote gen2 (E2123)
          multiple: false
    base_topic:
      name: Zigbee2MQTT Base mqtt topic
      description: "Example: zigbee2mqtt"
      default: zigbee2mqtt
    media_player:
      name: Media Player
      description: The single media player to control
      selector:
        entity:
          domain:
            - media_player
          multiple: false
    mass_player:
      name: Music Assistant Player
      description: The MASS player to control
      selector:
        entity:
          domain:
            - media_player
          multiple: false
    media_player_group:
      name: Media Player Group
      description: The generic group to control
      selector:
        entity:
          domain:
            - media_player
          multiple: false
    mass_group:
      name: Music Assistant Group
      description: The MASS group to control
      selector:
        entity:
          domain:
            - media_player
          multiple: false
    volume_steps:
      name: Volume number of steps
      description: Controls the volume scale.
      default: 20
      selector:
        number:
          min: 5.0
          max: 50.0
          step: 5
          unit_of_measurement: Num
          mode: slider
#-------
    single_dot:
      name: Single Dot (Single)
      description: Action to run on single dot press
      default: []
      selector:
        action: {}
    single_dot_double_press:
      name: Single Dot (Double)
      description: Action to run on single dot double press
      default: []
      selector:
        action: {}
    single_dot_long_press:
      name: Single Dot (Long)
      description: Action to run on single dot long press
      default: []
      selector:
        action: {}
    double_dot:
      name: Double Dot (Single)
      description: Action to run on double dot press
      default: []
      selector:
        action: {}
    double_dot_double_press:
      name: Double Dot (Double)
      description: Action to run on double dot double press
      default: []
      selector:
        action: {}
    double_dot_long_press:
      name: Double Dot (Long)
      description: Action to run on double dot long press
      default: []
      selector:
        action: {}
  source_url: https://community.home-assistant.io/t/z2m-ikea-symfonisk-gen2-e2123-media-control/559523
mode: restart
max_exceeded: silent
trigger_variables:
  base_topic: !input base_topic
  controller: !input remote
trigger:
- platform: mqtt
  topic: '{{ base_topic }}/+/action'
action:
- variables:
    fname: '{{ device_attr(controller, ''name'') }}'
    player: !input media_player
    massplayer: !input mass_player
    massgroup: !input mass_group
    steps: !input volume_steps
    stepsize: '{{ 1.0 / steps }}'
- choose:
  - conditions:
    - '{{ trigger.payload != ''''}}'
    - '{{ fname in trigger.topic }}'
    sequence:
    - choose:
# =========================================================================== PLAY / MUTE
      - conditions: '{{ trigger.payload == ''toggle'' }}'
        sequence:
        - choose:
          #------- group PLAYING
          - conditions:
            - condition: state
              entity_id: !input media_player_group
              state: "playing"
            sequence:
            - service: media_player.volume_mute
              data:
                is_volume_muted: "{{ not state_attr(player,'is_volume_muted') }}"
              target:
                entity_id: !input media_player
          #------- group NOT PLAYING
          - conditions:
            - or:
              - condition: state
                entity_id: !input media_player_group
                state: "paused"
              - condition: state
                entity_id: !input media_player_group
                state: "buffering"
              - condition: state
                entity_id: !input media_player_group
                state: "idle"
            sequence:
            - service: media_player.media_play_pause
              entity_id: !input media_player
# =========================================================================== PREVIOUS TRACK
      - conditions: '{{ trigger.payload == ''track_previous'' }}'
        sequence:
        - choose:
          #------- group ON
          - conditions:
            - condition: state
              entity_id: !input mass_group
              state: "playing"
            sequence:
            - choose:
              # mass group
              - conditions: "{{ is_state_attr(massgroup,'app_id','mass') }}"
                sequence:
                - service: media_player.media_previous_track
                  entity_id: !input mass_group
              # generic group
              - conditions: "{{ not is_state_attr(massgroup,'app_id','mass') }}"
                sequence:
                - service: media_player.media_previous_track
                  entity_id: !input media_player_group
          #------- group OFF
          - conditions:
            - condition: state
              entity_id: !input mass_group
              state: "off"
            sequence:
            - choose:
              # mass mp
              - conditions: "{{ is_state_attr(massplayer,'app_id','mass') }}"
                sequence:
                - service: media_player.media_previous_track
                  entity_id: !input mass_player
              # mp
              - conditions: "{{ not is_state_attr(massplayer,'app_id','mass') }}"
                sequence:
                - service: media_player.media_previous_track
                  entity_id: !input media_player
# =========================================================================== NEXT TRACK
      - conditions: '{{ trigger.payload == ''track_next'' }}'
        sequence:
        - choose:
          #-------------- GROUP ON
          - conditions:
            - condition: state
              entity_id: !input mass_group
              state: "playing"
            sequence:
            - choose:
              # mass group
              - conditions: "{{ is_state_attr(massgroup,'app_id','mass') }}"
                sequence:
                - service: media_player.media_next_track
                  entity_id: !input mass_group
              # generic group
              - conditions: "{{ not is_state_attr(massgroup,'app_id','mass') }}"
                sequence:
                - service: media_player.media_next_track
                  entity_id: !input media_player_group
          #-------------- GROUP OFF
          - conditions:
            - condition: state
              entity_id: !input mass_group
              state: "off"
            sequence:
            - choose:
              # mass mp
              - conditions: "{{ is_state_attr(massplayer,'app_id','mass') }}"
                sequence:
                - service: media_player.media_next_track
                  entity_id: !input mass_player
              # mp
              - conditions: "{{ not is_state_attr(massplayer,'app_id','mass') }}"
                sequence:
                - service: media_player.media_next_track
                  entity_id: !input media_player
# =========================================================================== VOLUME UP
      - conditions: '{{ trigger.payload == ''volume_up'' }}'
        sequence:
        - service: media_player.volume_set
          target:
            entity_id: !input media_player
          data:
            volume_level: '{% set volume = state_attr(player, "volume_level")
              + stepsize %} {{ 1.0 if volume > 1.0 else volume }}'
      #-------------- HOLD
      - conditions: '{{ trigger.payload == ''volume_up_hold'' }}'
        sequence:
        - service: media_player.volume_set
          target:
            entity_id: !input media_player
          data:
            volume_level: 0.5
        - service: media_player.volume_mute
          data:
            is_volume_muted: false
          target:
            entity_id: !input media_player
# =========================================================================== VOLUME DOWN
      - conditions: '{{ trigger.payload == ''volume_down'' }}'
        sequence:
        - service: media_player.volume_set
          target:
            entity_id: !input media_player
          data:
            volume_level: '{% set volume = state_attr(player, "volume_level")
              - stepsize %} {{ 0.0 if volume < 0.0 else volume }}'
      #-------------- HOLD
      - conditions: '{{ trigger.payload == ''volume_down_hold'' }}'
        sequence:
        - service: media_player.volume_set
          target:
            entity_id: !input media_player
          data:
            volume_level: 0.3
        - service: media_player.volume_mute
          data:
            is_volume_muted: false
          target:
            entity_id: !input media_player
# =========================================================================== SINGLE DOT
      - conditions: '{{ trigger.payload == ''dots_1_short_release'' }}'
        sequence: !input single_dot
      - conditions: '{{ trigger.payload == ''dots_1_double_press'' }}'
        sequence: !input single_dot_double_press
      - conditions: '{{ trigger.payload == ''dots_1_long_press'' }}'
        sequence: !input single_dot_long_press
# =========================================================================== DOUBLE DOT
      - conditions: '{{ trigger.payload == ''dots_2_short_release'' }}'
        sequence: !input double_dot
      - conditions: '{{ trigger.payload == ''dots_2_double_press'' }}'
        sequence: !input double_dot_double_press
      - conditions: '{{ trigger.payload == ''dots_2_long_press'' }}'
        sequence: !input double_dot_long_press

Hope this could help someone! Bye!

Here is the screen.

Might be issue, I have only one “group member” in the group?

I modified the blueprint a bit - instead of calling the group and its items, I call the media_player and it works.I have two speakers grouped in Heos app as stereo - those show up in home assistant as 2 speakers, but I can add only to HA.

Thanks for the screengrab, one member in a group is fine. In the Sonos implementation group_members is always populated with something even if you only own one speaker (or a stereo pair, seen as one device).

On your setup, the HEOS implementation has group_members as empty, that’s the cause of the issue. I’ll take a look at updating the blueprint when I finish work later today.

1 Like

I’ve updated the Blueprint to support volume correctly on media player integrations that either don’t support the group_members attribute, don’t populate it for single players or do the grouping a different way to the Sonos integration.

I believe this will solve your issue, please try it out and let me know :slight_smile:

Hi, this might not be the right thread but I’m having trouble connecting this remote to HA via ZHA. After I reset the remote with 4 quick taps of the pairing button, It shows up pretty quickly in the ZHA screen but stays stuck on the “configuring” step.

I do get a device for it tho, but that device has no entities or anything.

I have also tried holding the big play button while it is connecting, but that doesn’t seem to work either.

Yup, wrong thread as this Blueprint is for Z2M, however these devices can be a bit strange when adding them. Try removing it and re-adding but keep repeatedly pressing one of the buttons on it until it’s fully registered and see if that helps.

Just a quick note that at least the Roon media player integration sets the group members to an empty array for me which causes the state_attr(player, ''group_members'') != none check to fail, but changing it to state_attr(player, ''group_members'') != [] works.

Also, the volume hold sequences don’t work if there aren’t any members (needs to have similar checks as the volume press items and target player as the entity ID).

//Tomi B.

Thanks for the info, I’ll look at updating when I can find a minute. It’s frustrating that there’s such differences between players that can be grouped.

Ah I missed the volume hold on the last update, thanks!

@docBliny Hi, I’ve updated the blueprint, would you be able to give it a try for me please?

@Shawsky - Thanks for this blueprint!

Coincidentally stumbled in here today while you’re in the process of working with @docBliny on what looks like the same issue I’m running into, which relates to Roon integration.

I’m trying to target a single Roon player and volume control isn’t working (play/pause and track fwd/back do work). I’m on your latest Blueprint, but it doesn’t have the fix that @docBliny proposed even though you wrote that you updated the blueprint. I still see:

- conditions: "{{ trigger.payload == 'volume_up' and state_attr(player, 'group_members') != none }}"

My player entity info is below. Did you mean update the blueprint with the empty array test that @docBliny proposed?

Thanks again!

Hi, yes the changes are in the latest version. I’ve moved the code into blocks, one for media players that use the group_members the way Sonos does and a group for other players that don’t support it. Makes it easier for me to manage if there are further changes.

Is it not working for you? You’ll need to reload the blueprint if you haven’t already.

Sorry, the updated version doesn’t resolve the volume issue. The check for state_attr(player, 'group_members') != none will trigger that flow since [] != none. May need to check for array length being zero there or something.

Edit: The following should work:

- conditions: "{{ trigger.payload == 'volume_down' and state_attr(player, 'group_members') != none and state_attr(player, 'group_members') != [] }}"

//TB

Ah that’ll teach me to try and get a fix in quick. I can see what you mean now :smiley: Will update shortly. Thanks.