Controlling HomeKit with an Amazon Dash Button

Controlling HomeKit with an Amazon Dash Button

Since hooking up Homebridge and controlling lights and LED strips in my living room I've been looking for a physical switch to control it. The only HomeKit enabled switch I've found is the Elgato Eve Light Switch which is pretty reasonable at $50 but is only available in the US due to the requirement of a neutral wire — something UK (and most other international) switches do not have/require.

I wondered if I could get another Wi-Fi button working with Homebridge but couldn't really find anything. There's the FLIC but that needs Bluetooth so was out of the question unless I wanted to hack the protocol it uses and connect it to the Raspberry Pi; a lot of effort for a little switch. There is however the perfect Wi-Fi button that's cheap, self contained and easy to configure — the Amazon Dash.

The Dash Button is designed to order consumable items such as coffee and washing tablets at the click of a button. It's $5/£5 usually and gives you that price off the cost of your first order (it does however require a Prime subscription to buy). I managed to get mine while they were on sale in the UK for 99p so picked a few up.

3 Amazon Dash Buttons

The first thing I did was get that logo off of the Simplehuman button with my trusty Swiss Army knife.

Amazon Dash without label

The older Amazon Dash buttons had screws underneath the label but this newer model just seems to clip the back plate to the front so is nice and clean under that label. Eventually I think I'll print a label to go on this with some sticky back plastic (full Art Attack mode).

The dash is apparently just powered by a AAA battery inside which is likely replaceable. However, considering it's only £5 and lasts for 10,000 clicks it doesn't really matter either way.

Setting up the buttons is easy, you just open up the Amazon app on your iPhone and go to the relevant section in the Your Account tab. Hold down the button for 6 seconds until it flashes blue and then pop in your Wi-Fi password. It's very simple.

Integrating with Homebridge

There was already a plugin available for the Amazon Dash Button so I gave that one a whirl first. It uses libpcap and the node-dash-button to listen to traffic on the local network. Older dash buttons connected with ARP but these new buttons use UDP.

I had a number of issues with the plugin:

  1. Getting it to work on my Pi Zero setup was a nightmare as it froze the wlan shortly after running libpcap. It turns out this was actually the fault of the official Raspberry Pi Wi-Fi dongle. This cheap dongle works perfectly with it.
  2. The plugin uses the StatelessProgrammableSwitch service in HAP-NodeJS which the Home app on iOS doesn't support at all. I think it's programmable in 3rd party apps but that's again something I didn't want to deal with.

To fix the second point I ended up writing my own plugin that you can download on GitHub. The button uses the standard switch service in HomeKit and just stores the state in memory. It's not an ideal scenario as the state can easily but you could always fork it and get the plugin to check the state of the accessories or lights you wish to control with it.

The plugin accepts just a couple of properties in its config: name, mac, and protocol. The name is what will be displayed by default in the Home app, mac is the MAC address of the Amazon Dash and the protocol is udp, arp or all. If you're not sure which button you have use all but if you bought it recently (last 6 months) it's likely to use UDP rather than ARP.

You'll probably be able to find your Dash but monitoring your router's logs when you hit the button and then checking the MAC address on a lookup site. However if you're not comfortable in doing that you can follow the instructions the node-dash-button have in their readme.

Automating with the iOS Home App

Once I'd installed the plugin and swapped out the Wi-Fi dongle for one that doesn't freeze the button popped up in the Home app as expected. It displays as a switch and can be automated to trigger any accessory when the state goes from off -> on and vice-versa.

Amazon Dash automation in iOS Home

Demo

And of course, here's a quick demo of me clicking a button… Exciting eh? 😝


And here it is, nicely seated underneath my light switch. The sticky back wasn't quite sticky enough for my wall so I used some Command Strips to keep it in place.

Amazon Dash Light Switch

✌️

Come Say Hello! Drop me an email, follow me on Twitter, or check out Cocoon (you totally should, we're doing some cool stuff over there).