[OBSOLETE] Amazon Dash Button

Thanks for this big tutorial. I am admittedly a noob here, in all ways, especially Linux… I am now using

OS: Debian 9.1 (x86-64) (it is a live USB, but that shouldn’t matter I don’t think)
Cinnamin Version: 3.2.7
Linux Kernal: 4.9.0.3-amd64
(CPU) Intel COre i5-2450M

I seemed to have gotten everything setup except I keep getting this error:

user@debian:~/stnp$ sudo node server.js
[2017-09-28T23:37:17.762Z] [stnp] SmartThings Node Proxy listening at http://:::8080
module.js:471
throw err;
^
Error: Cannot find module ‘pcap’
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/home/user/stnp/plugins/dash.js:22:12)
at Module._compile (module.js:570:32)
at Object.Module._extensions…js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

Honestly I have searched far and wide on google and really cannot figure the problem out… some said maybe pcap wasn’t installed (it is as far as I can tell), some said maybe I had duplicate versions, but I have restarted the process repeatedly with a fresh boot (fresh ‘install’ since its a live USB). 5 hours later this is where I have landed.

I got a setup using the buttons on windows that reads IP’s working, but the delay is probably 3-5 seconds on a press. Would be nice to have this go quicker!
Really hope to get it working…

Thanks.

You’re probably missing libpcap… use google to figure out how to install for your system, but most probably: sudo apt-get install libpcap-dev

Once that’s done, do the npm run install:dash

Good luck!

Thanks for the help. It turns out I needed to run the command

sudo apt-get install build-essential

before npm run install:dash

Boy that was an adventure. I had used that command previously when other issues were going on, and forgot to keep using it later… but now there is another issue:

I had this entirely working and I am not sure what has gone astray now… the program now shows that it gets the button push but just refuses to actually do anything. I was getting the error

[2017-09-29T22:52:55.536Z] [stnp] SmartThings Node Proxy listening at http://:::8080
[2017-09-29T22:52:55.906Z] [stnp] Loaded plugin: dash
[2017-09-29T22:52:58.951Z] [dash] {“address”:“fc:a6:67:3d:a3:dd”,“status”:“active”}
[2017-09-29T22:52:58.952Z] [stnp] Notify server address and port not set!

I was trying to figure out which IP to put into the SmartApp, whether the server (pc running debian), the IP of the SmartThings Hub, or the IP of the dash button… I tinkered with the SmartApp settings and believe It was suppose to be the SmartHub because after flipping it from that to other IP’s a few times it finally said some message and it WORKED. It added this:

{
“port”: 8080,
“authCode”: “secret-key”,
“dash”: {
“buttons”: [
“fc:a6:67:3d:a3:dd”
]
},
“notify”: {
“address”: “192.168.1.3”,
“port”: “39500”
}
}

to the config file, and it finally worked as I said…but then I was editing things and now I literally push the button, it recognizes the push, but zero happens. I have tried removing the smart app settings, changing ports, etc, but I am just confused at this point… mostly because I can’t get it repopulate the “NOTIFY” area, and if I give it the original info I had (port 39500 etc) it literally just recognizes the button push and gives me no errors. So obviously those must be incorrect?

Thanks… I thought I was out of the water but then somehow I got back in, lol…

Lol… ok so the easiest way to get this working again is to do the following:

  1. stop STNP
  2. Edit your config.json to include the notify block
  3. start STNP
  4. give it a go

Does this work with the AWS IoT Button? because I’ve got one connected to my wifi, but it seems to have two MAC addresses and the logs imply that it’s constantly being pressed (which it’s not)…

[2017-10-26T03:34:01.737Z] [dash] {“address”:“ac:9e:17:66:87:b8”,“status”:“active”}
[2017-10-26T03:35:34.297Z] [dash] {“address”:“ac:9e:17:66:87:b8”,“status”:“active”}
[2017-10-26T03:35:40.536Z] [dash] {“address”:“ac:9e:17:66:87:b8”,“status”:“active”}
[2017-10-26T03:35:55.097Z] [dash] {“address”:“ac:9e:17:66:87:b8”,“status”:“active”}
[2017-10-26T03:36:20.056Z] [dash] {“address”:“ac:9e:17:66:87:b8”,“status”:“active”}
[2017-10-26T03:36:25.256Z] [dash] {“address”:“ac:9e:17:66:87:b8”,“status”:“active”}
[2017-10-26T03:36:30.456Z] [dash] {“address”:“ac:9e:17:66:87:b8”,“status”:“active”}
[2017-10-26T03:37:08.937Z] [dash] {“address”:“ac:9e:17:66:87:b8”,“status”:“active”}
[2017-10-26T03:37:14.137Z] [dash] {“address”:“ac:9e:17:66:87:b8”,“status”:“active”}
[2017-10-26T03:38:13.416Z] [dash] {“address”:“ac:9e:17:66:87:b8”,“status”:“active”}
[2017-10-26T03:38:39.416Z] [dash] {“address”:“ac:9e:17:66:87:b8”,“status”:“active”}
[2017-10-26T03:39:51.177Z] [dash] {“address”:“ac:9e:17:66:87:b8”,“status”:“active”}
[2017-10-26T03:39:54.300Z] [dash] {“address”:“74:c2:46:20:77:7c”,“status”:“active”}
[2017-10-26T03:39:56.376Z] [dash] {“address”:“ac:9e:17:66:87:b8”,“status”:“active”}
[2017-10-26T03:40:01.576Z] [dash] {“address”:“74:c2:46:20:77:7c”,“status”:“active”}

I haven’t tested it with the IoT button but the mechanics should be the same… Are you sure you’ve got the right MAC address? Note that when you fire up the STNP for the first time with no registered MAC addresses, it will go into “discovery” mode, sniff the network for 60 seconds and list all MAC addresses it finds. Recommend you run it in “discovery” mode and exclude all MAC addresses that are listed multiple times until you narrow it down to the single MAC address associated with your Dash button.

Your right, the MAC address starting with “ac” could be spurious, it’s attributed to ASUStek, so I don’t know what that is.

However the MAC address starting “74” is the dash button, at least according to Macvendors.com

I can ignore the first MAC address, but the “74” MAC address from the button seems to repeat itself after you press it. When I configured it to one of my lamps, it would come on, then go off…

The IoT button has three modes if I remember correctly, single press, long press, double press. I wonder if that causes a difference?

Cheers,

Steve.

There is a difference, but the plugin should be accounting for that… try this…

  1. Run in “discovery” mode (ie. remove all button MACs from the config.json file)
  2. Don’t press your Dash button and let it run for 60 secs.
  3. Record all MAC addresses reported
  4. Stop STNP and start it up again
  5. Wait 5 secs and then press your Dash button once
  6. Wait 5 secs and then stop STNP
  7. Record all MAC address reported
  8. Now do a diff and figure out which one is the real Dash button

Good luck.

Here’s what I’ve got…

pi@raspberrypi:/home/stnp $ sudo node server.js
[2017-10-26T12:42:17.866Z] [stnp] SmartThings Node Proxy listening at http://:::8080
[2017-10-26T12:42:18.068Z] [dash] ** NOTICE ** Dash Button addresses not set in config file!
[2017-10-26T12:42:18.633Z] [dash] Discovering Dash Buttons on local network…
[2017-10-26T12:42:18.644Z] [stnp] Loaded plugin: dash
[2017-10-26T12:43:18.645Z] [dash] Finished discovery on local network
^C
pi@raspberrypi:/home/stnp $ sudo node server.js
[2017-10-26T12:43:28.120Z] [stnp] SmartThings Node Proxy listening at http://:::8080
[2017-10-26T12:43:28.319Z] [dash] ** NOTICE ** Dash Button addresses not set in config file!
[2017-10-26T12:43:28.913Z] [dash] Discovering Dash Buttons on local network…
[2017-10-26T12:43:28.925Z] [stnp] Loaded plugin: dash
[2017-10-26T12:43:34.073Z] [dash] {“address”:“74:c2:46:20:77:7c”,“protocol”:“udp”}
[2017-10-26T12:43:34.081Z] [dash] {“address”:“ac:9e:17:66:87:b8”,“protocol”:“udp”}
[2017-10-26T12:43:42.377Z] [dash] {“address”:“74:c2:46:20:77:7c”,“protocol”:“udp”}
[2017-10-26T12:43:42.378Z] [dash] {“address”:“ac:9e:17:66:87:b8”,“protocol”:“udp”}
[2017-10-26T12:44:28.920Z] [dash] Finished discovery on local network

I pressed the button only once… but it reported a number of times.

Also - as a side question, is it possible to have the button trigger a routine, rather than just turn on or off a switch?

Cheers for your quick replies and help!!

Steve.

Ok - looks like the MAC address may be 74:c2:46:20:77:7c… but let’s double check. According to Amazon, you can do the following to confirm:

Press and hold the button for five seconds until the LED starts flashing blue.

Use your phone or computer to connect to the Button ConfigureMe - XXXX Wi-Fi network. Use the last 8 digits of the serial number of your device as the WPA2-PSK password.

In a browser, navigate to http://192.168.0.1/index.html.

When you go the index.html page, it should have your Dash IoT MAC address listed. Once we have that, set that in the config.json file and give it a go.

It doesn’t but I’m sure it’s the 74… MAC.

But when I press it once, it still registers twice. The lights go off, then a couple seconds later come back on again.

not the greatest of videos, but… https://www.youtube.com/watch?v=2AaZlSlbYx8&feature=youtu.be

Ok… guess I forgot to add support for the timeout in config.json… let’s try this instead. So the plugin has this timeout parameter which forces a quiet period where it will ignore all events from a device for X milliseconds after a button press. The default is 5 secs and it appears that it may not be enough in your case.

To increase the timeout to 10 secs for instance, change line 110 in the dash.js plugin to:

    timeout = timeout || 10000;

Restart the STNP after your change and run another test.

that seems to work!!! thanks!!

Is there a way to trigger a routine / automation rather than just a switch?

Thanks again!!!

Easiest would be to create a virtual switch and extend it with CoRE.

Done and working!!! Thanks for your help!

thinking about getting this done on a rapsberry π.

What kind of delays are you experiencing between the press and light turning off? Does it ever not trigger?

Delay = about a second? And it always triggers.

2 Likes

Anyone get this to work with the Amazon Surprise Sweets button? It seems there’s no way to disassociate the button from an account…The only way it appears you can do it is do the wifi synch and then in ios swipe off the app so it shuts down…It then doesn’t have the button associated with the Surprise Sweets…but…if you press the button, you will get a random email asking you to finish the initialization process…I believe this is the only button you can’t do this with without getting those emails…etc…any luck with this button?

Is there a way to make it auto-start when the Pi is restarted?

1 Like

Any one notice if the are getting the config email even if the have the notification turned off? My dash buttons have been working great since June but sometime in November I started getting the emails.