[Tutorial] How to use Bluetooth Media Button for Sonos


I just figured out how to set up my Satechi Media Button and use it to control my Sonos system via Home Assistant. I found another community article here (thank you @Mountainous) but there was one point where I stucked. So I will sum up my steps here.

Step 1: Pair your device

  1. Establish an SSH connection
  2. Type bluetoothctl for bluetooth configuration.
  3. Scan for bluetooth devices by typing scan on and find out the MAC address of your device XX:XX:XX:XX:XX:XX.
  4. Pair the device with pair XX:XX:XX:XX:XX:XX.
  5. Trust the device by using trust XX:XX:XX:XX:XX:XX.
  6. Connect to the device with connect XX:XX:XX:XX:XX:XX.
  7. Check if your device is paired with paired-devices.

Step 2: Get the device name

Because /dev/input does not exist in my case I tried to get it work by using the device_name.

  1. Using ha hardware info provides enough information. In my case this part was intereesting:
- Satechi Media Button Consumer Control
- Satechi Media Button Keyboard
- Satechi Media Button System Control

I did some research and found out that Satechi Media Button Consumer Control is the device_name which I was searching for.

Step 3: Configuration of keyboard remote

# configuration.yaml
  device_name: 'Satechi Media Button Consumer Control'
  type: 'key_down'

Step 4: Automations

I tried to get the button working first and triggered some light in the room. That worked pretty well so I decided to trigger the media_player service.

The key_codes for the button are the following:

  • 164: Play/Pause
  • 163: Next track
  • 165: Previous track
  • 115: Volume up
  • 114: Volume down

Just as an example this is how the Play/Pause automation looks like.

# automations.yaml
- id: '1608668662363'
  alias: Sonos Mediaplayer (Play/Pause)
  description: ''
  - platform: event
    event_type: keyboard_remote_command_received
      device_name: Satechi Media Button Consumer Control
      key_code: 164
  condition: []
  - service: media_player.media_play_pause
    data: {}
    entity_id: media_player.kitchen
  mode: single

That’s it.


At the moment I am having the same issue like @Mountainous described here.

My bluetooth multimedia buttons also goes to sleep after 30 seconds of inactivity and disconnects from Bluetooth to conserve battery but I’ve have no problems with the automation working even with it disconnecting and reconnecting (because it’s looking for a keyboard input). I’m sure you could even do an automation with it disconnecting and reconnecting but I have not explored this.

Any suggestions how to solve this?

Cheers Björn


Some more info on how you determined the “input” / Device_info for your device would be really helpful…
I have been looking at the results of ‘ha hardware info’ for more than 6 hours but cant find anything useful

BLE connected to HA

if it works anyways even though it disconnects, what’s the issue then?

btw, thanks for this tutorial

Thanks @bjoernbo for the tutorial!

I have a media controller I picked up on Aliexpress, visually looks identical to the Satechi one mentioned. However, if I try to pair with it, I get prompted for a pin code

Other tutorials say to enter the pin code into the bluetooth device you are connecting, but how can I do that when it is only a media controller and not a keyboard? Eventually the pairing fails due to authentication timeout.

I have also tried adding the mac address as a trusted device before pairing but this does not help. The media controller pairs easily with my phone, no pin code necessary, and the media buttons work exactly as they should straight away.

Any help would be greatly appreciated!




@yan.matthew.88 Did you find a solution for your problem? I’m not entirely sure if I should attempt this or not.

The issue is that the first button press only wakes it up and it takes 4-5 seconds for it to actually work.