Hi!
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
- Establish an SSH connection
- Type
bluetoothctl
for bluetooth configuration. - Scan for bluetooth devices by typing
scan on
and find out the MAC address of your deviceXX:XX:XX:XX:XX:XX
. - Pair the device with
pair XX:XX:XX:XX:XX:XX
. - Trust the device by using
trust XX:XX:XX:XX:XX:XX
. - Connect to the device with
connect XX:XX:XX:XX:XX:XX
. - 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
.
- Using
ha hardware info
provides enough information. In my case this part was intereesting:
input:
- 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
keyboard_remote:
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/Pause163
: Next track165
: Previous track115
: Volume up114
: 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: ''
trigger:
- platform: event
event_type: keyboard_remote_command_received
event_data:
device_name: Satechi Media Button Consumer Control
key_code: 164
condition: []
action:
- service: media_player.media_play_pause
data: {}
entity_id: media_player.kitchen
mode: single
Thatās it.
Issue
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