Bluetooth Button (Remote) support

cheap bluetooth remote buttons are available for example here:

would be nice if those could be used to trigger things in hats

Sorry, I couldn’t resist… But this would actually be a really nice feature.

2 Likes

autocorrection fail

1 Like

But in the best possible way…

I’m upvoting your request. (But only if you leave the autocorrect error intact, LOL)

Okay so I have exactly one of those…(yes @rpitera here I am again xD).

Currently I have it attached to the wall next to my wall mounted tablet and use it to toggle the light in my room with Tasker and AutoInput on android, If you want I could easily write up what I did.

I think as this device in particular only sends a keyboard input via bluetooth you should already be able to handle the input with the keyboard component maybe. Although all of those buttons send the same input “Home Key” so you could only use one of those.

Instant-Edit:
I do not have exactly this one I have one with only one function (Home Button). But the reasoning stays the same.

EDIT2:
I just read up on the keyboard component and it is not what I expected it to be after reading the title…apparently it can only send keyboard commands not react to them. So what we actually need is a keyboard_input component which fires events for the keyboard inputs. :slight_smile:

Greetings

I second @PhyberApex idea of a keyboard input component. There are tons of interesting Bluetooth remotes (and keyboards) out there that could be interesting controllers for Home-assistant

1 Like

I read some more into this topic and it seems to me that this is not an easy task to do in python with cross-compatibility in mind. It would be far easier to accomplish this by binding the media keys on your installed OS to a service call in HA.

If I would implement this on my raspberry pi I would use either python with evdev or I would use something like ebindkeys and call a script via POST on the HA API.

But if someone were to find a way to make a keyboard_input component possible it would be great :slight_smile:

Greetings

1 Like

Has any one managed to get this work now we have a keyboard option?

I just took a look at it and it is totally possible to do with that component. You just have to get the keycode of the button you want to fetch. Also please be aware that this is linux only. If you need further advice be free to ask away.

Cheers

1 Like

Hello,

I am trying something new here. But it sounds very similar to what is going on in this thread. I have a harmony remote + hub. I am able to control a PC via bluethooth. I have paired the harmony remote and raspberry pi 3. My goal is to be able to manually control lights with certain buttons on the harmony remote. I was able to map everything in the remote (seems I can only send “HID Direction Up/down/left/right”. However, I am hoping with the keyboard component I can still make use of this.

I used the all in one installer on my raspberry pi. Originally I saw event0 in the /dev/input/ directory. Now I just see ‘mice’. That changed after I “sudo pip install evdev”.

I can see my bluetooth mapped, and is connected, but I don’t know how to properly configure the configuration.yaml

This is what I currently have, and clearly it is incorrect.

# Keyboard #

keyboard_remote:
  device_descriptor: '/dev/input/'
  key_value: 'key_up'

Could someone help me with this?

Hello @Bakefy! Long time ago but I’m curious to if you got this to work? I have my harmony hub connected via bluetooth to my raspberry pi as a keyboard but it does not appear in /dev/input/by-id.
Did you find a solution? :slight_smile:

I ended up taking a different route. I could not get it to connect, probably still possible though. I also no longer use a raspberry pi as my host.

Thanks!
I ended up using the virtual hue component. It doesnt allow me to program specific buttons on the remote but it works ok…

Neat little remote, I’ll have a look to see how an integration is possible.
I suppose an universal bluetooth receiver component that publish an event each time a bluetooth command is received must be possible.

BTW they are also available on Aliexpress for 8,74€

https://www.aliexpress.com/item/FORNORM-Wireless-Bluetooth-Remote-Control-Media-Button-for-Car-Steering-Wheel-Motorcycle-Bike-Handlebar-for-iPhone/32832953326.html

Here’s a simple and cheap remote

I got it working. the device is probably something like /dev/input/event0but the problem is that this BT remote button somehow disconnects after some time and then does not reconnect. So it is not really reliable.

1 Like

Hey guys, for everyone looking for a solution I have come up with my own python script. It currently uses the same device as a location tracker too to tell me whether I am home or away and is connected to my keys. Once Im home, the pi connects to the device and the button can be configured to control anything on HA. Complete instructions can be found here https://github.com/araa47/hass_bletracker. Happy hacking :wink:

Hi,
With a combination of bluetoothctl pair, trust and connect, I got to ¿successfully? connect a Hama BRS3, which is just a branded version of a normal bluetooth remote/shutter (which are physically similar to the iTAG devices, but work different. I also have 2 iTAGs in the drawer though.

image
image

However, no event is passed through to Home Assistant (running latest HA OS on a x86 mini PC), even when adding this to configuration.yaml as per this tutorial

keyboard_remote:
  device_name: 'hama BRS3'
  type: 'key_down'

Note: using device_name as per the tutorial, since it’s not generating any /dev/input/eventX

The device seems properly connected, and it connects/disconnects properly when turning it on & off (as in bluetoothctl devices Connected will show it or not as expected).

Any idea what to do from here?
I believe I’m much closer than yesterday (device didn’t really connect, blinked a lot, and was getting
Failed to pair: org.bluez.Error.AuthenticationFailed
when attempting to pair). Luckily I moved past that as mentioned at the beggining.

Thank you