Page 1 of 2
New kind of Amazon Dash button to start tasks
Posted: Saturday 14 May 2016 10:49
by Thijsvr
Amazon is releasing a new version of their Dash button specifically aimed at IoT tasks. So no longer predefined tasks, but you can now set your own.
http://www.engadget.com/2016/05/13/amaz ... utton-iot/
Of course you could already mess around with your original Dash buttons like here:
https://familab.org/2016/02/hacking-the ... -button-3/
But it's nice that Amazon is now making life a little bit more straightforward.
Dash buttons now available on Amazon.de
Posted: Wednesday 31 August 2016 16:44
by piotr
The dashbuttons are now available on Amazon.de. On Github are quite a few projects that allow you to use the Dash to trigger actions.
See:
https://github.com/hortinstein/node-dash-button
Re: New kind of Amazon Dash button to start tasks
Posted: Friday 09 September 2016 10:45
by Madgeni
Here's my code to control scenes - (i even handle the lack of 'Toggle') - you need both node-dash-button, as well as the domoticz-api node library.
Needs to be running Sudo (the ARP request packet checker needs elevated privileges).
var Domoticz = require('./node_modules/domoticz-api/api/domoticz');
var dash_button = require('node-dash-button');
var api = new Domoticz({
protocol: "http",
host: "127.0.0.1",
port: 8080,
username: "",
password: ""
});
var dash = dash_button(["ac:63:be:89:c9:b6", "ac:63:be:13:c2:b8", "ac:63:be:02:f7:0b"]);
var on = false;
var idx;
function changeScene(idx, sceneState) {
console.log("state = ", sceneState, " for idx - ", idx);
if(sceneState == 'Off'){
sceneState = 'On';
} else if(sceneState == 'On'){
sceneState = 'Off';
}
console.log("what's the scene state? ", sceneState);
api.changeSceneState({
idx: idx,
state: sceneState
}, function(params, callback) {
return(callback);
});
}
function getScene(idx) {
api.getScenesGroups(function(error, scene) {
// console.log("i'm getting the scenes")
if (error) {
console.log("uhoh - ", error);
}
var sceneArray = scene.results;
for (var i = 0; i < sceneArray.length; i++) {
var element = sceneArray;
if (element.idx == idx) {
var sceneState = element.status;
console.log("scene state is : ", sceneState);
changeScene(idx,sceneState);
}
}
});
}
function callDashButton(dash_id, callback) {
var dict = {
"ac:63:be:89:c9:b6": 6,
"ac:63:be:13:c2:b8": 7,
"ac:63:be:02:f7:0b": 1
};
console.log("Dash button" + dash_id + " was clicked!");
var IDX;
for (var key in dict) {
IDX = dict[dash_id];
// console.log(IDX)
}
getScene(IDX, callback);
}
dash.on("detected", callDashButton);
Re: New kind of Amazon Dash button to start tasks
Posted: Friday 09 September 2016 17:07
by dhanjel
Nice, hopefully they will start selling these world wide.
Currently only prime it seems, and to expensive on eBay.
Sent from my Nexus 6P using Tapatalk
Re: New kind of Amazon Dash button to start tasks
Posted: Friday 09 September 2016 20:10
by Madgeni
It's true that they're only available to Prime customers for now

Still, i use Amazon so much that i'm probably breaking even over 12 months by paying for Prime.
Re: New kind of Amazon Dash button to start tasks
Posted: Friday 09 September 2016 20:21
by dhanjel
yeah, biggest problem with prime though is that it is us only if I am remember it correctly
Re: New kind of Amazon Dash button to start tasks
Posted: Saturday 10 September 2016 10:37
by blackdog65
yeah, I'm an Amazon.co.uk Prime customer but it's still only available in the US for $19.99
Why do we have to be 2nd place all the time? The poor neighbours.
Re: New kind of Amazon Dash button to start tasks
Posted: Saturday 10 September 2016 12:18
by dhanjel
In sweden we don“t have amazon at all, and no prime

Easiest is to use a shipping provider like borderlinx, but it gets expensive.
Re: New kind of Amazon Dash button to start tasks
Posted: Sunday 11 September 2016 0:12
by Madgeni
well that's sad

I have two you can have if you like?
hmm - I realised last night that won't work - you need to have an account to configure them to connect to your wifi :/
Re: New kind of Amazon Dash button to start tasks
Posted: Friday 11 November 2016 23:31
by pdjm43
I just had a 'prime' friend order me 2 dash buttons.
Using node-dash-button and requestify.
Here's my code, run in /etc/rc.local -- sudo node /home/pi/node_modules/node-dash-button/node-dash
Code: Select all
#!/usr/bin/env node
var dash_button = require('node-dash-button');
var dash = dash_button(["50:f5:da:11:11:11","ac:63:be:11:11:11"], null, null, 'arp'); //mac address from node-dash-button setup scan
var requestify = require('requestify');
dash.on("detected", function (dash_id){
if (dash_id === "50:f5:da:11:11:11"){
//console.log("Dash1");
requestify.get('http://127.0.0.1:8080/json.htm?type=command¶m=switchlight&idx=325&switchcmd=Toggle');
} else if (dash_id === "ac:63:be:11:11:11"){
//console.log("Dash2");
requestify.get('http://127.0.0.1:8080/json.htm?type=command¶m=switchlight&idx=326&switchcmd=Toggle');
}
});
So far my first button toggles a pair of lights.
Code: Select all
commandArray = {}
if (devicechanged["Dash1"]) and otherdevices["Dash1"]=="On" then
commandArray[1]={['Loft 1']='On'}
commandArray[2]={['Loft 2']='On'}
elseif (devicechanged["Dash1"]) and otherdevices["Dash1"]=="Off" then
commandArray[1]={['Loft 1']='Off'}
commandArray[2]={['Loft 2']='Off'}
end
return commandArray
Re: New kind of Amazon Dash button to start tasks
Posted: Monday 14 November 2016 17:53
by woody4165
Hi and thanks for sharing this, @pdjm43
In Italy we just got the official Dash button, and I've got one for testing.
I'm trying to install node-dash-button, but I'm getting a lot of errors during installation on my Cubie and also on Raspi.
In any case, I'm also trying to use with other example, like this one
Code: Select all
from scapy.all import *
def arp_display(pkt):
if pkt[ARP].op == 1: #who-has (request)
if pkt[ARP].psrc == '0.0.0.0': # ARP Probe
if pkt[ARP].hwsrc == 'xx:xx:xx:xx:xx:xx': # Huggies
print "Pushed Something"
else:
print "ARP Probe from unknown device: " + pkt[ARP].hwsrc
print sniff(prn=arp_display, filter="arp", store=0, count=10)
But nothing happen.
I've got the Mac address from Fing, an Android app that scan the local network for any device connected, and I see an Amazon one, and I got from there the MAC addr.
But when launching that python code nothing happens, when pushing the button!!!!
Any help where I can check?
I would like to integrate then in domoticz and see what can be an usage.
Thanks
Re: New kind of Amazon Dash button to start tasks
Posted: Tuesday 15 November 2016 10:01
by pdjm43
woody4165 wrote:Hi and thanks for sharing this, @pdjm43
In Italy we just got the official Dash button, and I've got one for testing.
I'm trying to install node-dash-button, but I'm getting a lot of errors during installation on my Cubie and also on Raspi.
In any case, I'm also trying to use with other example, like this one
But nothing happen.
I've got the Mac address from Fing, an Android app that scan the local network for any device connected, and I see an Amazon one, and I got from there the MAC addr.
But when launching that python code nothing happens, when pushing the button!!!!
Any help where I can check?
I would like to integrate then in domoticz and see what can be an usage.
Thanks
I only tried node-dash because it was updated recently (they say the dash changed it's output) and it worked straight away. The only advice for your scapy is that the arp scan needs sudo to run.
Re: New kind of Amazon Dash button to start tasks
Posted: Thursday 01 December 2016 0:36
by thebeetleuk
Hi All,
I'm just trying to get my dash button setup and running. As usual I'm being a bit thick in terms of some of the unix setup.
So far I have done the following:
- Spoiler: show
- https://github.com/hortinstein/node-dash-button
# Dependancy on libpcap for reading packets
sudo apt-get install libpcap-dev
# This took 30 sec to show the install happening....
npm install node-dash-button
cd node_modules/node-dash-button
sudo node bin/findbutton
pi@raspberrypi:~/node_modules/node-dash-button $ sudo node bin/findbutton
Watching for arp & udp requests on your local network, please try to press your dash now
Dash buttons should appear as manufactured by 'Amazon Technologies Inc.'
Possible dash hardware address detected: ac:63:be:8b:6d:8c Manufacturer: Amazon Technologies Inc. Protocol: udp
Possible dash hardware address detected: ac:63:be:8b:6d:8c Manufacturer: Amazon Technologies Inc. Protocol: arp
I'm now a bit stuck on how/what to do in terms of creating and running a script to actually do something.
What file do I create and where?
Does anyone have a template?
How do I get this running on reboot?
do I need to set special permissions?
I heard it has a 4 second delay (assuming to protect against repeat commands?)
Any help would be appreciated

Re: New kind of Amazon Dash button to start tasks
Posted: Thursday 01 December 2016 1:46
by thebeetleuk
ok so I have read a bit more and have created a file called node-dash.js with some of the suggested code in this. Then I executed with
Unfortunately I get an error
Code: Select all
module.js:442
throw err;
^
Error: Cannot find module 'requestify'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/pi/node_modules/node-dash-button/node-dash.js:4:18)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
Now trying to resolve with
Re: New kind of Amazon Dash button to start tasks
Posted: Thursday 01 December 2016 1:59
by thebeetleuk
sudo npm update -g
This didn't work after a reboot. Now stuck again

Re: New kind of Amazon Dash button to start tasks
Posted: Friday 02 December 2016 18:05
by thebeetleuk
ok so creating a test file "node-test.js" with the contents "console.log('hello world');" and running "sudo node node-test.js"
returns the desired results
so it must be the dependencies within the code thats throwing the error.
Error: Cannot find module 'requestify' <---- Is this the issue? cant it find requestify? A path issue?
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/pi/node_modules/node-dash-button/node-dash.js:4:18)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
Re: New kind of Amazon Dash button to start tasks
Posted: Friday 02 December 2016 19:10
by Madgeni
Hi -
pimping my code again.
download it - and the node_modules dir from here:
https://github.com/madgeni/domo-dash
create a folder, put it all in there then:
Create Groups in Domoticz, and put the device you want to control in that.
In the domo-dash.js - put your mac addresses in the array,
Code: Select all
//put Dash Mac Addresses here - to find them, use node-dash-button's info: https://github.com/hortinstein/node-dash-button
var dash = dash_button(["ac:63:be:89:c9:b6", "ac:63:be:13:c2:b8", "ac:63:be:02:f7:0b", "50:f5:da:5a:a1:ae"]);
and then again, next to the group IDX (find it in domoticz - setup>devices) here:
Code: Select all
var dict = {
"ac:63:be:89:c9:b6": 5,
"50:f5:da:5a:a1:ae": 4,
"ac:63:be:02:f7:0b": 1
};
Then run it using :
nohup sudo node dash_control.js &
Re: New kind of Amazon Dash button to start tasks
Posted: Saturday 03 December 2016 10:06
by thebeetleuk
got it working!
had to install requestify. doh!
once done then it all works

Re: New kind of Amazon Dash button to start tasks
Posted: Saturday 03 December 2016 11:07
by thebeetleuk
Just curious, what are the advantages of the API over Json calls?
Re: New kind of Amazon Dash button to start tasks
Posted: Sunday 04 December 2016 13:03
by Madgeni
async callbacks via the API call