Thanks to @Bill’s presence script for WRT, I got my router to notify my OpenHab about the dash’s status changes. Basically, the dash doesn’t stay connected to the internet, but it wakes only to send it’s request to Amazon, then goes back to sleep (it disconnects from wifi). The script then posts a request using curl to openhab, for an unbinded item.
Great … Unfortunately it’s still not available in Germany
Yeah, I had my friend’s boss bring a couple from the US.
Very nice. I wrote a similar script awhile back (posted here). My hope was I could use the Dash as a garage door opener. It just sniffs the network for the Dash ARP packets which it sends out when it first tries to connect and posts it to OH using MQTT.
But I found the range to be too poor and the latency to be too high to be acceptable for my purposes.
Having seen your demo I wonder if moving the functionality to the router like you have would solve at least the latency issue. The range issue still makes it unusable for a garage door controller but perhaps I can use it for something else.
I’d want to share my experience connecting Amazon Dash to openHAB
My WIFI router uses OpenWRT firmware and DHCP server installed there (dnsmasq) has an option to specify script called every time when new device is connected to WIFI network
Actually it should work for routers using DD-WRT as well
I’ve created script at /root/dhcpscript.sh with contents like
if [ "$1" == "add" ] then wget http://openhab.home:8080/CMD?DHCPConnectedId=$2/$4 -O - fi
(where $2 is MAC of connected device and $4 - its own name(usually empty)) and configured dnsmasq to use it (/etc/config/dhcp -> config dnsmasq -> option dhcpscript ‘/root/dhcpscript.sh’)
Now openHAB is notified every time when new WIFI device is connected.
And you can add handlers for events
- Amazon Dash button is pressed
- unknown device is connected
- somebody using phone with WIFI is at home
It’s the same principle I’ve used for my setup. Only difference is that @Bill’s script is a bit more complex, but fundamentally, it does the same thing.