Abuse those inexpensive Amazon Dash Buttons to control your Hue Lights (or anything else, really). There are many different programs doing this already, but this one is especially lightweight and free of dependencies since it's only a very short C program which then invokes curl
to talk to the Hue bridge.
- Amazon Dash (~5EUR)
- Always-on Linux computer with a C compiler & curl, Raspberry Pi will do (~25-50EUR)
Setup your buttons like in the official guide, but abort setup before selecting a product to order. This way your button can connect to your WiFi but won't be able to order anything from Amazon.
Next step is configuring the program source (main.c
) with the details of your button(s), Hue bridge and light(s). You'll need to obtain the MAC address of each button (look in the device list of your router after the button is configured), the IP / host name of your Hue bridge, a whitelisted user ID for the Hue API and the light IDs for the lights you want to switch. If you don't know how to do that, read the Getting Started section of the Hue API documentation (registration required). Modify the set_light_state()
function at the top with your Hue details, then modify the MAC addresses and actions at the very bottom.
Then, compile the modified program.
make
That should do it. The program watches for an ARP message from the button that is sent when it wakes up after a button press and reconnects to your WiFi. We need super user privileges to be able to snoop on ARP traffic. Run with
sudo ./out
Since the program needs to be always running, it would be a good idea to run it as a daemon. I use daemontools, also see this great tutorial.
This program is published under the MIT License.
Developed by Tim C. Schroeder, visit my website to learn more.