New kind of Amazon Dash button to start tasks
Moderators: leecollings, remb0
- Thijsvr
- Posts: 21
- Joined: Monday 04 January 2016 14:06
- Target OS: NAS (Synology & others)
- Domoticz version: 2.4075
- Location: Amsterdam
- Contact:
New kind of Amazon Dash button to start tasks
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.
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.
-
- Posts: 26
- Joined: Monday 15 July 2013 8:17
- Target OS: Linux
- Domoticz version: Beta
- Location: Drenthe
- Contact:
Dash buttons now available on Amazon.de
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
See: https://github.com/hortinstein/node-dash-button
-
- Posts: 1571
- Joined: Friday 25 March 2016 17:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: New kind of Amazon Dash button to start tasks
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).
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);
Last edited by Madgeni on Sunday 11 September 2016 0:12, edited 1 time in total.
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
-
- Posts: 102
- Joined: Tuesday 05 August 2014 22:16
- Target OS: Linux
- Domoticz version: 3.5146
- Location: Sweden
- Contact:
Re: New kind of Amazon Dash button to start tasks
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
Currently only prime it seems, and to expensive on eBay.
Sent from my Nexus 6P using Tapatalk
-
- Posts: 1571
- Joined: Friday 25 March 2016 17:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: New kind of Amazon Dash button to start tasks
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.
Still, i use Amazon so much that i'm probably breaking even over 12 months by paying for Prime.
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
-
- Posts: 102
- Joined: Tuesday 05 August 2014 22:16
- Target OS: Linux
- Domoticz version: 3.5146
- Location: Sweden
- Contact:
Re: New kind of Amazon Dash button to start tasks
yeah, biggest problem with prime though is that it is us only if I am remember it correctly
- blackdog65
- Posts: 311
- Joined: Tuesday 17 June 2014 18:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Norfolk, UK
- Contact:
Re: New kind of Amazon Dash button to start tasks
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.
Why do we have to be 2nd place all the time? The poor neighbours.
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
-
- Posts: 102
- Joined: Tuesday 05 August 2014 22:16
- Target OS: Linux
- Domoticz version: 3.5146
- Location: Sweden
- Contact:
Re: New kind of Amazon Dash button to start tasks
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.
-
- Posts: 1571
- Joined: Friday 25 March 2016 17:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: New kind of Amazon Dash button to start tasks
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 :/
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 :/
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
-
- Posts: 30
- Joined: Friday 12 December 2014 11:31
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: UK
- Contact:
Re: New kind of Amazon Dash button to start tasks
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
So far my first button toggles a pair of lights.
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');
}
});
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
-
- Posts: 476
- Joined: Monday 14 March 2016 13:55
- Target OS: Linux
- Domoticz version: beta
- Location: Rome, Italy
- Contact:
Re: New kind of Amazon Dash button to start tasks
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
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)
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
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
-
- Posts: 30
- Joined: Friday 12 December 2014 11:31
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: UK
- Contact:
Re: New kind of Amazon Dash button to start tasks
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.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
-
- Posts: 115
- Joined: Saturday 21 December 2013 23:50
- Target OS: Linux
- Domoticz version:
- Location: Scotland
- Contact:
Re: New kind of Amazon Dash button to start tasks
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:
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
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
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
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
-
- Posts: 115
- Joined: Saturday 21 December 2013 23:50
- Target OS: Linux
- Domoticz version:
- Location: Scotland
- Contact:
Re: New kind of Amazon Dash button to start tasks
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
Now trying to resolve with
Code: Select all
sudo node node-dash.js
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)
Code: Select all
sudo npm update -g
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
-
- Posts: 115
- Joined: Saturday 21 December 2013 23:50
- Target OS: Linux
- Domoticz version:
- Location: Scotland
- Contact:
Re: New kind of Amazon Dash button to start tasks
sudo npm update -g
This didn't work after a reboot. Now stuck again
This didn't work after a reboot. Now stuck again
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
-
- Posts: 115
- Joined: Saturday 21 December 2013 23:50
- Target OS: Linux
- Domoticz version:
- Location: Scotland
- Contact:
Re: New kind of Amazon Dash button to start tasks
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)
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)
Last edited by thebeetleuk on Monday 05 December 2016 23:09, edited 1 time in total.
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
-
- Posts: 1571
- Joined: Friday 25 March 2016 17:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: New kind of Amazon Dash button to start tasks
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,
and then again, next to the group IDX (find it in domoticz - setup>devices) here:
Then run it using :
nohup sudo node dash_control.js &
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"]);
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
};
nohup sudo node dash_control.js &
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
-
- Posts: 115
- Joined: Saturday 21 December 2013 23:50
- Target OS: Linux
- Domoticz version:
- Location: Scotland
- Contact:
Re: New kind of Amazon Dash button to start tasks
got it working!
had to install requestify. doh!
once done then it all works
had to install requestify. doh!
Code: Select all
npm install requestify
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
-
- Posts: 115
- Joined: Saturday 21 December 2013 23:50
- Target OS: Linux
- Domoticz version:
- Location: Scotland
- Contact:
Re: New kind of Amazon Dash button to start tasks
Just curious, what are the advantages of the API over Json calls?
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
-
- Posts: 1571
- Joined: Friday 25 March 2016 17:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: New kind of Amazon Dash button to start tasks
async callbacks via the API call
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
Who is online
Users browsing this forum: Google [Bot] and 1 guest