Hi,
ja genau .. wollte ich auch gerade posten...
wenn ich mal einen HIER zu Hause habe... und kein ARIEL nutze... kann ich den Dash auch hacken um meine HUE Lampen zum Glühen zu bringen...
ICH werde berichten
a) ob und wann die Gummis kommen
b) ob und wie ich den ARIEL Dash für die HUE's einsetzen kann/konnte...
Greetz
Badticket
P.S.
Die Anleitung ist leider nicht für blöde geschrieben ohne weitere Infos wie und wo man die Befehle ablassen kann/muss....
http://www.danielgallo.co.uk/post/hack- ... ue-lights/
Kriegen wir das hier im Forum hin die Anleitung so zu übersetzen, das mit ein wenig krimineller Energie die Umsetzung erfolgen kann ohne große Kenntnisse der jeweiligen Programmiersprache und Entwicklungsumgebung inne haben zu müssen ?
Install the two Node libraries
After the Dash Buttons have been activated, I then installed the two Node libraries:
npm install node-dash-button
and
npm install node-hue-api
Finding the Dash Button hardware (MAC) address
The whole process of listening for ARP requests on the network requires that I know which hardware address to listen for. To figure out the Dash Button’s hardware address, I ran the “findbutton” script:
cd node_modules/node-dash-button
node bin/findbutton
This listens for ARP requests on the local network. I then pressed the button on Amazon Dash, to reveal the MAC address:
Watching for arp requests on your local network, please try to press your dash now
possible dash hardware address detected: dc:ef:09:92:4b:c6
I could then take this address, and build up an array of Dash Buttons to listen for:
var dash = dash_button(["df:eb:09:22:3b:a6", "dc:ef:09:92:4b:c6"]);
dash.on("detected", function (dash_id){
console.log("Dash button " + dash_id + " was clicked!");
});
Registering a new user on the Philips Hue bridge
I then needed to connect to the Philips Hue bridge, in order to issue requests to turn lights on/off.
First, I had to add a new user account on the bridge, which can be done by pressing the button on the Hue bridge, then running the script below (all scripts below are based off of the examples from here:
https://github.com/peter-murray/node-hue-api).
var HueApi = require("node-hue-api").HueApi;
var hostname = "10.0.0.16", // IP of the Philips Hue Bridge
newUserName = null; // The Hue Bridge will generate a User ID
userDescription = "Amazon Dash Button User";
var displayUserResult = function(result) {
console.log("Created user: " + JSON.stringify(result));
};
var displayError = function(err) {
console.log(err);
};
var hue = new HueApi();
hue.registerUser(hostname, newUserName, userDescription)
.then(displayUserResult)
.fail(displayError)
.done();
This returned a username I could then leverage for the next steps.
Creating a group of lights
Lights can either be controlled individually, or as a group. As I have three Philips Hue bulbs located in the Lounge area, with IDs “1”, “2”, and “3”, I wanted to create a group for those bulbs.
(IDs of each bulb can be obtained by using the “lights()” API, which returns an object containing a list of light bulbs registered with the bridge.)
I used this script to create the group:
var dash_button = require("node-dash-button"),
hue = require("node-hue-api"),
HueApi = hue.HueApi,
lightState = hue.lightState
dash = dash_button(["dc:ef:09:92:4b:c6"]),
hostname = "10.0.0.16",
user = "36b624a82526d45f3ef77a58149cd04f",
api = new HueApi(hostname, user);
var displayResult = function(result) {
console.log(JSON.stringify(result, null, 2));
};
api.createGroup("Lounge", [1, 2, 3])
.then(displayResult)
.done();
The result returns the ID of the group, which is “1” in my case, as I don’t have any existing groups.
Turning the lights on and off!
I then ended up with this script, which would allow me to turn the group of bulbs on and off by using the Amazon Dash Button:
var dash_button = require("node-dash-button"),
hue = require("node-hue-api"),
HueApi = hue.HueApi,
lightState = hue.lightState
dash = dash_button(["dc:ef:09:92:4b:c6"]),
hostname = "10.0.0.16",
user = "36b624a82526d45f3ef77a58149cd04f",
api = new HueApi(hostname, user),
on = false,
state;
var displayResult = function(result) {
console.log(JSON.stringify(result, null, 2));
};
state = lightState.create().hue(25000); // Green
dash.on("detected", function (dash_id) {
console.log("Dash button " + dash_id + " was clicked!");
if (!on) {
// Turn on the group of lights
api.setGroupLightState(1, state.on())
.then(displayResult)
.done();
} else {
// Turn off the group of lights
api.setGroupLightState(1, state.off())
.then(displayResult)
.done();
}
on = !on;
});
And the lights turn on, then off, with each press of the Dash Button! Result!
Green Lights
And this time with red:
...
state = lightState.create().hue(65535); // Red
...
Red Lights