From 5ebcfdbc66efb570cd16ce8fd2c672d98c0cde9b Mon Sep 17 00:00:00 2001 From: Charalampos Doukas Date: Mon, 11 Nov 2013 14:48:20 +0100 Subject: [PATCH] Removed single Philips Hue node --- hardware/philips_hue/103-philips_hue.html | 79 ----------- hardware/philips_hue/103-philips_hue.js | 162 ---------------------- hardware/philips_hue/philipshue.png | Bin 9134 -> 0 bytes 3 files changed, 241 deletions(-) delete mode 100644 hardware/philips_hue/103-philips_hue.html delete mode 100644 hardware/philips_hue/103-philips_hue.js delete mode 100644 hardware/philips_hue/philipshue.png diff --git a/hardware/philips_hue/103-philips_hue.html b/hardware/philips_hue/103-philips_hue.html deleted file mode 100644 index 13d8005b..00000000 --- a/hardware/philips_hue/103-philips_hue.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - diff --git a/hardware/philips_hue/103-philips_hue.js b/hardware/philips_hue/103-philips_hue.js deleted file mode 100644 index bca70c0d..00000000 --- a/hardware/philips_hue/103-philips_hue.js +++ /dev/null @@ -1,162 +0,0 @@ -/** - * philips_hue.js - * Basic functionality for accessing and contolling a Philips Hue wireless Lamp - * Allows for bridge/gateway and light scanning, as well as Light ON/OFF/ALERT status update - * Requires node-hue-api https://github.com/peter-murray/node-hue-api - * Copyright 2013 Charalampos Doukas - @BuildingIoT - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - - -//Require node-hue-api -var hue = require("node-hue-api"); -var HueApi = require("node-hue-api").HueApi; - -// Require main module -var RED = require(process.env.NODE_RED_HOME+"/red/red"); - -//store the IP address of the Hue Gateway -var gw_ipaddress = ""; - -var lights_discovered = ""; - - -// The main node definition - most things happen in here -function HueNode(n) { - // Create a RED node - RED.nodes.createNode(this,n); - - var node = this; - - var username, discovery_mode, lamp_status, lamp_id; - - //get parameters from user - this.username = n.username; - this.discovery_mode = n.discovery_mode; - this.lamp_status = n.lamp_status; - this.lamp_id = n.lamp_id; - - - - // Store local copies of the node configuration (as defined in the .html) - this.topic = n.topic; - - - var msg = {}; - - msg.topic = this.topic; - - this.on("input", function(msg){ - - //check if users has selected discovery mode, provide output: - if(this.discovery_mode==1) { - //start with detecting the IP address of the Hue gateway in the local network: - hue.locateBridges(function(err, result) { - - var msg2 = {}; - msg2.topic = this.topic; - if (err) throw err; - //save the IP address of the 1st bridge found - this.gw_ipaddress = result[0].ipaddress; - msg2.payload = this.gw_ipaddress; - node.send(msg2); - - //get light info: - var api = new HueApi(this.gw_ipaddress, node.username); - api.lights(function(err, lights) { - var msg2 = {}; - if (err) throw err; - var lights_discovered = JSON.stringify(lights, null, 2); - msg2 = { topic:node.topic, payload: { ipaddress:this.gw_ipaddress, lights:lights_discovered} }; - node.send(msg2); - - }); - - }); - - - } - - else { - //set the lamp status - //first locate the Hue gateway: - hue.locateBridges(function(err, result) { - - var msg2 = {}; - msg2.topic = this.topic; - if (err) throw err; - - if(result[0]==null) { - msg2.payload="No Philips Hue Bridge located! Nothing to be done."; - console.log("No Philips Hue Bridge located!"); - node.send(msg2); - } - else { - //save the IP address of the 1st bridge found - this.gw_ipaddress = result[0].ipaddress; - - //set light status - var api = new HueApi(this.gw_ipaddress, node.username); - var lightState = hue.lightState; - var state = lightState.create(); - - var status; - if(msg.payload=="ALERT"){ - status = "ALERT"; - } - else if(node.lamp_status=="ON" || msg.payload=="ON") status = "ON"; - else if(node.lamp_status=="OFF" || msg.payload=="OFF") status = "OFF"; - - - if(status=="ALERT") { - api.setLightState(node.lamp_id, state.alert()).then(displayResult).fail(displayError).done(); - } - else if(status=="ON") { - api.setLightState(node.lamp_id, state.on()).then(displayResult).fail(displayError).done(); - } - else { - api.setLightState(node.lamp_id, state.off()).then(displayResult).fail(displayError).done(); - } - - msg2.payload = 'Light with ID: '+node.lamp_id+ ' was set to '+status; - node.send(msg2); - } - - }); - } - }); - - - this.on("close", function() { - // Called when the node is shutdown - eg on redeploy. - // Allows ports to be closed, connections dropped etc. - // eg: this.client.disconnect(); - }); - - } - - //hue debugging on the output: - var displayResult = function(result) { - console.log(result); -}; - -var displayError = function(err) { - console.error(err); -}; - - - -// Register the node by name. This must be called before overriding any of the -// Node functions. -RED.nodes.registerType("HueNode",HueNode); \ No newline at end of file diff --git a/hardware/philips_hue/philipshue.png b/hardware/philips_hue/philipshue.png deleted file mode 100644 index a77aa2bf3635caee8ff90b2f5c82c937ab851b7b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9134 zcmZX31yEewvi0C@A!rCLL1%D>;K4O8z~JtL!GgO6_n-lS1ef4GxVyVUaCct5``&-= zt@?M>meajf_wL?xs`~5`uA(G^g-(hN006LLKS`?nomu{N3RL93V}>;l9snR#w33ie zk(H33RB>`Jx3V<@0KjNv+Ad%Xz52C1g-%Qf%$1cDx)nyf2v86x5yT}I@gcV;C!g34 zHOx4U8a;rO`h#&^nBO&ZMA-C7;JMG(?egQA@ECOTX>`%1;!@YhtpT~t-2`auvd z!H(w4`wq%ZVIa!hh4B%w%MYOvUf9~vt28Y#lIBjd;*>6qLfu))~VZ_hTu$f6h7! zEwcbR{=ju~i~pR20Stc!IaTGagDgY25tCJo#Vy$@b65p|Q zJBhs-F&v44l1Q)S=#xlqh+Z#{W`ii|@_YKERn_P8UqmS;RKr2~HYt2w)j?BsE9*d_ zZ%Z5ftk{^t@aGGulzZ2>>XawBVlh5j{%4Z9%3&lACY|SmpkzOkO$RCsd6ckVz{l|L zxGeMbD$FG8iSHuTO7fMLcTuhTy30OGGBn1y86?LDi(>V`p^ML*Qa{c$PgJn^bMVrw zW?gY%kRR7p8|16F5?Pj>Z$^elj5Wg^H)&Q#$cSA-Cc9XPFSy@(8ccaTH7TqzvExEL`i(qKECueEzcQg=t8;3tIak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