[OBSOLETE] Amazon Dash Button

Seriously, I cannot wait until I get home to try your lower case Mac address suggestion. Stnp can sniff the dash button correctly, everything seems to work fine until I run server.js. I did the same thing copying and pasting the Mac address from the direct connect dash button config page. Really hoping this works. Thank you for your suggestion @coedshowers

For users trying to get this to install on windows but getting errors, I was able to get the node running by opening a command prompt as admin then typing:

npm install --global --production windows-build-tools

NOTE: this will install python and overwrite the directory to Users/.windows-build-tools/python27, so be aware

this was after I installed Winpcp, but before I was able to install:dash.

I was able to get the MAC address of the dash button through my router, but my PC still doesnā€™t detect the packets. Not sure if it is a port forwarding issue, but I tried using nodejs, and I tried using a python script with scapy library to no avail. Any troubleshooting tips would be appreciated.

1 Like

I tried on both Windows 10 and on a Mac. Able to get it to run in both cases. Neither device can discover the dash button. on the Windows 10 device I installed and can see it on wireshark issue an arp request but for some reason it isnā€™t caught but the server.js

any suggestions?

pcap not installed correctly? not in promiscuous mode?

got this working. I had to hard code the interface to open in dash.js

Genius! I have a pile of IOT Dev buttons lying around from a few different projects Iā€™ve worked on with various companies and that pile is now doing all sorts of stuff! Thanks!

The Nice thing about the dev button, is that itā€™s not attached to an order. I just put in a bogus endpoint and picked any of the random AWS regions on button setup.

The video did not suck. I found it very informative and useful. Especially the explanation behind all the steps.
(although I agree about the vi bit haha)

Hi there. I have Google WiFi (3 of them) and you can accomplish the same thing by putting the Dash buttons under "Family WiFiā€™ section in the Settings and ā€˜pausingā€™ them. That will prevent them from going out to Amazon and works well. Just remember to unpause if you have to re-set them up again from scratch or else the app wonā€™t finish the setup.

I was finally able to get this to work on one of my Dash buttons. For some reason, adding a second button did not work despite completing the Amazon setup and adding itā€™s MAC address to config.json.

Has anyone else run into issues getting a second button to work?

Any hints or advice would be greatly appreciated.

Thanks

I seem to have everything configured as it should, however whilst the proxy detects the button being pressed nothing happens on smart things.

The configuration seems to be correct as when I add the app to my device, the configuration on the proxy side automatically updates.

The only thing I see in the ST debug is

69a6fe3e-9ab9-4b4b-816b-e44c621ae01e 5:09:37 AM: debug Dash Buttons set: [00:fc:8b:d6:68:13:0]

not sure why there is an extra 0 at the end.

Any pointers on how to debug this issue further will be greatly appreciated.

regards

not sure whatā€™s happening here. Seems like the server sends a 200 OK but closes the session.

done called premature ā€¦

pi@raspberrypi:/home/stnp $ curl -X NOTIFY -H ā€œContent-Type: application/jsonā€ -H ā€œstnp-plugin: dashā€ -d ā€˜{ā€œaddressā€:ā€œ00:fc:8b:d6:68:13ā€,ā€œstatusā€:ā€œactiveā€}ā€™ --verbose http://192.168.1.126:39500/notify

  • Trying 192.168.1.126ā€¦
  • TCP_NODELAY set
  • Connected to 192.168.1.126 (192.168.1.126) port 39500 (#0)

NOTIFY /notify HTTP/1.1
Host: 192.168.1.126:39500
User-Agent: curl/7.52.1
Accept: /
Content-Type: application/json
stnp-plugin: dash
Content-Length: 49

  • upload completely sent off: 49 out of 49 bytes
    < HTTP/1.1 200 OK
    < Connection: close
    <
  • Curl_http_done: called premature == 0
  • Closing connection 0

Hi, I tried setting this up to run in the background using various different boot at startup services and Iā€™m getting similar results whenever itā€™s ran with those services. The bottom error is from trying to use your second link from your suggestion above. Do you know whatā€™s possibly wrong?

It would produce this and not listen to the signal:
sudo su pi -c ā€˜node /home/stnp/server.js < /dev/null &ā€™

[2018-06-06T04:32:20.657Z] [stnp] SmartThings Node Proxy listening at http://:::8080
[2018-06-06T04:32:20.779Z] [dash] Failed to create pcap session: no devices to listen onā€¦
[2018-06-06T04:32:20.785Z] [dash] Error: socket: Operation not permitted
[2018-06-06T04:32:20.793Z] [stnp] Loaded plugin: dash
(node:6010) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

Hi, thanks for this tutorial!
How can this be done on a Windows machine? I can install nodejs and download the STNP files from GitHub, but how do I run the server on Windows ?

Hey everyone, i have a tablet running which is plugged in 24/7 and turns on based on a motion sensor. Just wondering if anyone knew of anyway to get node.js running on an android tablet as thinking this could double up as the intercept ans listen server for the amazon dash buttons as well as maybe the ask alexa smartapp

Hi all,

Is there a simpler version of this process? Iā€™m trying to get it running on my Rasbperry Pi and the process skips parts of the process and assumes an at least intermediate skill level, I have first got stuck on part 9 of the installing the Smartthings node proxy setup:

9 Edit the document so that it matches your configurationā€¦ remove all comments (anthing starting with //) and then click ā€œBeautifyā€.

Matches what configuration? Iā€™ve not really begun to set anything up yet so I have no configuration to really apply?

It basically says take the code from: https://github.com/redloro/smartthings/blob/master/smartthings-nodeproxy/config.json.sample - but this looks as if itā€™s taken from someoneā€™s existing setup? Totally confused.

EDIT: I have carried on nonetheless and have encountered an error after I run npm run install:dash which is as follows:

pi@RPi1:/home/smartthings-nodeproxy/plugins $ sudo sync && sudo npm run install:dash
(node:23729) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
npm ERR! Failed to parse json
npm ERR! Unexpected token < in JSON at position 6
npm ERR! File: /home/smartthings-nodeproxy/plugins/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
_npm ERR! _
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! System Linux 4.14.52+
npm ERR! command ā€œ/usr/bin/nodeā€ ā€œ/usr/bin/npmā€ ā€œrunā€ ā€œinstall:dashā€
npm ERR! cwd /home/smartthings-nodeproxy/plugins
npm ERR! node -v v8.11.1
npm ERR! npm -v 1.4.21
npm ERR! file /home/smartthings-nodeproxy/plugins/package.json
npm ERR! code EJSONPARSE
_npm ERR! _
npm ERR! Additional logging details can be found in:
npm ERR! /home/smartthings-nodeproxy/plugins/npm-debug.log
npm ERR! not ok code 0

ANOTHER EDIT: Sorted it, manually copied the contents of dash.js and config.js from the Github page, Iā€™m sure the ones in the .zip file were different.

I believe Android can run it:

[https://stackoverflow.com/questions/36632649/running-node-js-on-android](http://installing node.js)

You sir are a LEDGE. Itā€™s always the most basic of errors, my MAC address had one letter in it, changed to lowercase and boom - sorted. Tip for anyone else too - re-do your MAC to lowercase in the config.json file AND donā€™t forget the Smartapp within the Android app too.

Edit: Okay, sorry to takeover this thread. But three things:

Is it possible to rename each Dash button? So far I just get a notification of ā€˜00:00:00 etc button pressedā€™. How do I rename a Dash button when itā€™s not actually in device list in the Android app?

I also found it strange the password/key stored in the config.json file isnā€™t actually a password, itā€™s just ā€˜secret-keyā€™ but as it works itā€™s all good.

Also, the only activity it can be associated with is to control a switch? Iā€™d like to be able to perhaps do something more complicated with it e.g. when presence sensors are near AND the car presence sensor AND motion occurs say in the bedroom THEN back door, the button can turn the alarm from set(stay) to unset (to let the dog out) - then be used to toggle back into the previous mode? Am I aiming for too much with this button here?

Okay - so I followed the video, and everything went well until the sudo node server.js step. Iā€™m getting an error that means nothing to meā€¦ whatā€™d I do wrong?

[2018-08-21T00:33:59.240Z] [stnp] SmartThings Node Proxy listening at http://:::8080
internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module 'cap'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/home/stnp/plugins/dash.js:25:12)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)

Tried to get this set up. Everything works all the way through to the point of actually reporting back to ST. My config.json file now looks like this:

{
  "port": 8080,
  "authCode": "secret-key",
  "dash": {
    "buttons": [
      "fc:a6:67:a9:f2:47"
    ]
  },
  "notify": {
    "address": "192.168.1.24",
    "port": "39500"
  }
}

I see the following in terminal after I run sudo node server.js and push the button wait and push it again.

[2018-09-04T03:49:10.137Z] [stnp] SmartThings Node Proxy listening at http://:::8080
[2018-09-04T03:49:11.080Z] [stnp] Loaded plugin: dash
[2018-09-04T03:49:17.810Z] [dash] {"address":"fc:a6:67:a9:f2:47","status":"active"}
[2018-09-04T03:49:44.843Z] [dash] {"address":"fc:a6:67:a9:f2:47","status":"active"}

Donā€™t see anything happen in ST. I have the smartapp installed and configured with the same MAC address and have it controlling a switch and sending notifications. I donā€™t see either.

It appears iā€™m having the same problem as others that havenā€™t gotten a reply yet. I have an extra zero after my mac address in st. So, when I go in and put that in to ST, it adds another :0 after it.

[ac89fd9a-4ee7-481d-89ed-495983e9bc21](https://graph.api.smartthings.com/ide/logs#ac89fd9a-4ee7-481d-89ed-495983e9bc21) 12:15:56 AM: debug Dash Buttons set: [fc:a6:67:a9:f2:47:0:0]
[ac89fd9a-4ee7-481d-89ed-495983e9bc21](https://graph.api.smartthings.com/ide/logs#ac89fd9a-4ee7-481d-89ed-495983e9bc21) 12:15:19 AM: debug Dash Buttons set: [fc:a6:67:a9:f2:47:0]

Hi,

Iā€™m trying to follow the above instructions using the first gen raspi. ā€¦All good up to step 13 as when I run this in the /home/smartthings-nodeproxy/ directory I get the below error. I see that someone above had a similar issue, but they were trying to install on Windows 10 which is not the case here so Iā€™m not sure where to go next with this one. Any help would be appreciated.

Regards

/home/pi/.node-gyp/8.12.0/include/node/v8.h:488:18: warning: inline function ā€˜void v8::PersistentBase<T>::Reset() [with T = v8::Promise]ā€™ used but never defined [enabled by default]
cap.target.mk:99: recipe for target 'Release/obj.target/cap/src/binding.o' failed
make: *** [Release/obj.target/cap/src/binding.o] Error 1
make: Leaving directory '/home/smartthings-nodeproxy/node_modules/cap/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 3.18.11+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/smartthings-nodeproxy/node_modules/cap
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cap@0.2.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cap@0.2.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2018-10-05T14_57_59_953Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! smartthings-nodeproxy@1.0.0 install:dash: `npm install && npm install cap`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the smartthings-nodeproxy@1.0.0 install:dash script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2018-10-05T14_58_00_587Z-debug.log

Error: Cannot find module ā€˜capā€™

getting the same error at first load - any suggestions - thanks

1 Like