diyhue / diyHue

Main diyHue software repo
https://diyhue.org/
Other
1.58k stars 279 forks source link

diyHue support for USB 2.4GHz remotes? #394

Open sneak-thief opened 4 years ago

sneak-thief commented 4 years ago

Is it possible to map buttons from wireless USB remotes to diyHue functions such as turning light groups on/off, dimming and changing scenes?

Device info:

There are many cheap (4 euro / $5 USD) 2.4GHz USB wireless remote controls available that would be great for controlling diyHue when connected to a Pi (or even openWRT) running diyHue, eg:

image

More info:

With the remote I got, the VID is 248a and the PID is 168e.

Getting the keycodes for any of them is easy using the linux xev command - in this case:

keycode 150 (keysym 0x1008ff2f, XF86Sleep) keycode 180 (keysym 0x1008ff18, XF86HomePage)

keycode 113 (keysym 0xff51, Left) keycode 111 (keysym 0xff52, Up) keycode 114 (keysym 0xff53, Right) keycode 116 (keysym 0xff54, Down) keycode 36 (keysym 0xff0d, Return)

keycode 135 (keysym 0xff67, Menu) keycode 9 (keysym 0xff1b, Escape)

keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume) keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume)

mariusmotea commented 4 years ago

We need to add support for 2.4Ghz controller and this can be made more easy after https://github.com/diyhue/diyHue/pull/390 will be done.

alexyao2015 commented 4 years ago

That would be an interesting feature, for now, pretty sure esp8266 buttons work.

sneak-thief commented 4 years ago

ESP8266 buttons work fine, but there's definitely a barrier for getting an affordable ergonomic control. Even as a long time DIY-er of exceedingly complex projects and manufactured PCB's, making a remote is simply too much effort once you figure in fabricating a respectable case.

There's the Hugo remote on Tindie but it's 27 euro including shipping but it only has 4 buttons.

Now compare that to all these cheap, light, ergonomic, AAA-powered USB remotes, and you'll immediately see why it's a very attractive alternative.

In the meantime, I was wondering if there are any CLI scripts or CURL lines that could be invoked via macros triggered by a USB remote.

mariusmotea commented 4 years ago

The most generic controllers for 2.4ghz on market are based on nRF24L01 chip. Not sure what python libraries are available.

sneak-thief commented 4 years ago

Isn't it less complicated to listen to the output of a specified HID device? eg. https://learn.pimoroni.com/tutorial/robots/controlling-your-robot-wireless-keyboard

Controlling Your Robot: USB HID/Wireless Keyboards - Pimoroni Yarr-niversity
This article walks you through controlling a Pi-powered Robot with a USB HID Keyboard or similar USB input device.