# Spark Core and Node-RED integration

**URL:** <https://community.particle.io/t/spark-core-and-node-red-integration/7582>\
**Category:** Project Share\
**Created:** [October 19, 2014, 9:00pm UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582 "2014-10-19T21:00:54Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![krvarma](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/krvarma/32/3089_2.png) [@krvarma](https://community.particle.io/u/krvarma)\
**Post date:** [October 19, 2014, 9:00pm UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/1 "2014-10-19T21:00:54Z")

</div>

> **[krvarma/SparkCore\_Node-RED](https://github.com/krvarma/SparkCore_Node-RED)**
>
> SparkCore\_Node-RED - Spark Core and Node-RED integration

Spark Core and Node-RED are great IOT tools. If these two can work together then it is more awesome. So I decided to create a simple Node-RED node for Spark Core. The node implements basic things to interact with Spark Core, such as call a function, read a variable and subscribe to events. This node defines INPUT and OUTPUT nodes. Input node can be used to call a function, read a variable and subscribe to events. The output node can be used to call a function and pass an input parameter. Following are the return values:

**Function call**

1. **msg.raw** contains the raw JSON string returned
2. **msg.payload** contains the return value of the function
3. **msg.id** contains the core id
4. **msg.name** contains the core name

**Read a Variable**

1. **msg.raw** contains the raw JSON string returned
2. **msg.payload** contains the value of the variable
3. **msg.name** contains the name of the core

**Subscribe to variables**

1. **msg.raw** contains the raw JSON string returned
2. **msg.payload** the event data
3. **msg.ttl** contains he TTL
4. **msg.published\_at** contain the published date and time
5. **msg.coreid** contains the core id

**Sample Applications**

I have created two samples created. The first sample demonstrates the subscribe to events functionality and uses DHT Temperature and Humidity sensor to log data to **Xively**. This Spark Core application published temperature and humidity at particular intervals and the Node-RED application send this data to **Xively**. This uses INPUT node.

The second sample uses MQTT to set color of RGB led. This uses OUTPUT node and Eclipse Sandbox MQTT server ([iot.eclipse.org:1883](http://iot.eclipse.org:1883)). The Node-REd application listens for MQTT messages and forward to Spark Core which parses the color (in the format R,G,B) and set the LED color.

**Screenshots**

**Input node properties**  
 ![Input node properties](https://raw.githubusercontent.com/krvarma/SparkCore_Node-RED/master/screenshots/properties-input.png)

**Output node properties**  
 ![enter image description here](https://raw.githubusercontent.com/krvarma/SparkCore_Node-RED/master/screenshots/properties-output.png)

**Spark Core MQTT REB Led sample**  
 ![enter image description here](https://raw.githubusercontent.com/krvarma/SparkCore_Node-RED/master/screenshots/sparkcore-nodered-rgbled.png)

**Spark Core DHT and Xively sample**  
 ![enter image description here](https://raw.githubusercontent.com/krvarma/SparkCore_Node-RED/master/screenshots/sparkcore-nodered-xively.png)

---

<div class="post-metadata">

**Author:** ![sriram155](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@sriram155](https://community.particle.io/u/sriram155)\
**Post date:** [November 5, 2014, 12:05am UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/2 "2014-11-05T00:05:17Z")

</div>

Hi. Is there an npm that I can install so that this shows up in my Node-RED interface?

---

<div class="post-metadata">

**Author:** ![krvarma](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/krvarma/32/3089_2.png) [@krvarma](https://community.particle.io/u/krvarma)\
**Post date:** [November 5, 2014, 7:35am UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/3 "2014-11-05T07:35:48Z")

</div>

@sriram155, while doing this the node-red nodes were not npm capable, as of Node-RED 0.9.1 nodes can be installed using npm. I am preparing the npm and will publish it this weekend or so and update here.

---

<div class="post-metadata">

**Author:** ![alkopop79](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/alkopop79/32/3527_2.png) [@alkopop79](https://community.particle.io/u/alkopop79)\
**Post date:** [November 7, 2014, 7:26pm UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/4 "2014-11-07T19:26:41Z")

</div>

How do you install it?

---

<div class="post-metadata">

**Author:** ![krvarma](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/krvarma/32/3089_2.png) [@krvarma](https://community.particle.io/u/krvarma)\
**Post date:** [November 7, 2014, 7:33pm UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/5 "2014-11-07T19:33:25Z")

</div>

@alkopop79,

1. Go to `<Node-RED>\nodes\hardware` folder.
2. Create a folder named spark.
3. Copy two files from [https://github.com/krvarma/SparkCore\_Node-RED/tree/master/spark-node](https://github.com/krvarma/SparkCore_Node-RED/tree/master/spark-node).

You can use **`node red.js -v`** to debug any issues.

Let me know any issue facing.

---

<div class="post-metadata">

**Author:** ![sriram155](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@sriram155](https://community.particle.io/u/sriram155)\
**Post date:** [November 11, 2014, 4:39am UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/6 "2014-11-11T04:39:35Z")

</div>

Thanks @krvarma

---

<div class="post-metadata">

**Author:** ![sriram155](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@sriram155](https://community.particle.io/u/sriram155)\
**Post date:** [November 11, 2014, 4:44am UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/7 "2014-11-11T04:44:54Z")

</div>

@krvarma when i followed the above instruction, i get the following error

11 Nov 12:40:19 - [red] Version: 0.9.1.git  
11 Nov 12:40:19 - [red] Loading palette nodes

```
/home/pi/node-red/nodes/core/hardware/sparkcore.js:5
<!DOCTYPE html>
^
11 Nov 12:40:36 - ------------------------------------------
11 Nov 12:40:36 - [sparkcore.js] SyntaxError: Unexpected token <
11 Nov 12:40:36 - ------------------------------------------
```

---

<div class="post-metadata">

**Author:** ![krvarma](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/krvarma/32/3089_2.png) [@krvarma](https://community.particle.io/u/krvarma)\
**Post date:** [November 11, 2014, 6:35am UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/8 "2014-11-11T06:35:55Z")

</div>

@sriram155, the error shows some HTML tags which the `sparkcore.js` have, can you paste your `sparkcore.js` here?

---

<div class="post-metadata">

**Author:** ![sriram155](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@sriram155](https://community.particle.io/u/sriram155)\
**Post date:** [November 11, 2014, 6:51am UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/9 "2014-11-11T06:51:29Z")

</div>

> [@krvarma](#):
>
> [https://github.com/krvarma/SparkCore\_Node-RED/tree/master/spark-node](https://github.com/krvarma/SparkCore_Node-RED/tree/master/spark-node)

@krvarma here is the sparkcore.js contents that I've uploaded to my pi:

```
var EventSource = require('eventsource');
var Request = require("request");
var selectedDevice = null;

var sparkmodule = null;

module.exports = function(RED) {
	var core_id;
	var access_token;
	var param;
	var name;
	var repeat;
	var interval_id;
	var method;
	var es;

    function SparkCoreIN(n) {
        RED.nodes.createNode(this,n);
		
		sparkmodule = this;
		
        this.interval_id = null;
		this.repeat = n.repeat * 1000;
		this.core_id = n.coreid;
		this.access_token = n.accesstoken;
		this.name = n.fve;
		this.param = n.param;
		this.method = n.method;
		
		console.log("Method: " + this.method);
		
		if(this.method == "function"){
			if (this.repeat && !isNaN(this.repeat) && this.repeat > 0) {
				this.log("Repeat = "+this.repeat);
				
				this.interval_id = setInterval( function() {
					sparkmodule.emit("callfunction",{});
				}, this.repeat );
			} else{
				setTimeout( function(){ sparkmodule.emit("callfunction",{}); }, 100);
			}
		}
		else if(this.method == "subscribe"){
			var url = "https://api.spark.io/v1/devices/" + this.core_id + "/events/" + this.name + "?access_token=" + this.access_token;
			
			this.es = new EventSource(url);
		
			this.es.addEventListener(this.name, function(e){
				var data = JSON.parse(e.data);
			
				console.log("Data: " + data);
			
				var msg = {
					raw: data,
					payload:data.data,
					ttl: data.ttl,
					published_at: data.published_at,
					coreid: data.coreid
				};
			
				sparkmodule.send(msg);
			}, false);

			this.es.onerror = function(){
				console.log('ES Error');
			};
		}
		else if(this.method == "variable"){
			if (this.repeat && !isNaN(this.repeat) && this.repeat > 0) {
				this.log("Repeat = "+this.repeat);
				
				this.interval_id = setInterval( function() {
					sparkmodule.emit("getvariable",{});
				}, this.repeat );
			} else{
				setTimeout( function(){ sparkmodule.emit("getvariable",{}); }, 100);
			}
		}
		
		this.on("callfunction", function(){
			var url = "https://api.spark.io/v1/devices/" + this.core_id + "/" + this.name;
			
			Request.post(
				url, 
				{
					form: {
						access_token: this.access_token,
						args: this.param
					}
				},
				function (error, response, body){
					console.log(body);
					if(!error && response.statusCode == 200){
						var data = JSON.parse(body);
						var msg = {
							raw: data,
							payload: data.return_value,
							id: data.id,
							name: data.name,
							last_app: data.last_app,
							connected: data.connected
						};

						sparkmodule.send(msg);
					}
				}
			)
		});
		
		this.on("getvariable", function(){
			var url = "https://api.spark.io/v1/devices/" + this.core_id + "/" + this.name + "?access_token=" + this.access_token;
			
			Request.get(url,
				function (error, response, body){
					console.log(body);
					if(!error && response.statusCode == 200){
						var data = JSON.parse(body);
						
						var msg = {
							raw: data,
							payload: data.result,
							name: data.name,
							cmd: data.cmd
						};

						sparkmodule.send(msg);
					}
				}
			)
		});
    }
	
	function SparkCoreOUT(n) {
        RED.nodes.createNode(this,n);
		
		sparkmodule = this;
		
		this.core_id = n.coreid;
		this.access_token = n.accesstoken;
		this.name = n.fve;
		this.param = n.param;
		
		this.on("input", function(msg){
			var url = "https://api.spark.io/v1/devices/" + this.core_id + "/" + this.name;
			
			var parameter = this.param;
			
			if(parameter.length == 0){
				parameter = msg.payload;
			}
			
			var postdata = {
				form: {
					access_token: this.access_token,
					args: parameter
				}
			};
			
			console.log("Postdata: ", postdata);
				
			Request.post(
				url, 
				postdata,
				function (error, response, body){
					console.log(body);
					if(!error && response.statusCode == 200){
						var data = JSON.parse(body);
						var msg = {
							raw: data,
							payload: data.return_value,
							id: data.id,
							name: data.name,
							last_app: data.last_app,
							connected: data.connected
						};

						sparkmodule.send(msg);
					}
				}
			)
		});
    }
	
    RED.nodes.registerType("SparkCore in",SparkCoreIN);
	RED.nodes.registerType("SparkCore out",SparkCoreOUT);
	
	SparkCoreIN.prototype.close = function() {
		console.log("Close called.");
	
        if (this.interval_id != null) {
			console.log("Interval closed.");
            clearInterval(this.interval_id);
        }
		
		if(this.es != null){
			console.log("EventSource closed.");
			this.es.close();
		}
    }
}

```

---

<div class="post-metadata">

**Author:** ![krvarma](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/krvarma/32/3089_2.png) [@krvarma](https://community.particle.io/u/krvarma)\
**Post date:** [November 11, 2014, 8:02am UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/10 "2014-11-11T08:02:30Z")

</div>

@sriram155, can you execute following command an check:

npm install request  
npm install eventsource

---

<div class="post-metadata">

**Author:** ![sriram155](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@sriram155](https://community.particle.io/u/sriram155)\
**Post date:** [November 11, 2014, 11:55pm UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/11 "2014-11-11T23:55:43Z")

</div>

@krvarma it’s still the same even after installing the request and eventsource packages.

---

<div class="post-metadata">

**Author:** ![krvarma](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/krvarma/32/3089_2.png) [@krvarma](https://community.particle.io/u/krvarma)\
**Post date:** [November 12, 2014, 7:27am UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/12 "2014-11-12T07:27:59Z")

</div>

@sriram155, I tried the same with my RPi and Windows machine, its working fine. Is there any detailed error message, I mean from `node red.js -v`?

---

<div class="post-metadata">

**Author:** ![krvarma](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/krvarma/32/3089_2.png) [@krvarma](https://community.particle.io/u/krvarma)\
**Post date:** [November 12, 2014, 7:38pm UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/13 "2014-11-12T19:38:56Z")

</div>

@sriram155, can you take the latest and check it is working or not, I just made some changes based on an assumption, lets see it is working or not.

---

<div class="post-metadata">

**Author:** ![sriram155](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@sriram155](https://community.particle.io/u/sriram155)\
**Post date:** [November 13, 2014, 12:05am UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/14 "2014-11-13T00:05:59Z")

</div>

@krvarma still no luck with the updated files. The error message is the same.

```
 pi@ramServer ~/node-red $ sudo node red.js -v
    
    Welcome to Node-RED
    ===================
    
    13 Nov 07:59:45 - [red] Version: 0.9.1.git
    13 Nov 07:59:45 - [red] Loading palette nodes
    
    /home/pi/node-red/nodes/core/hardware/spark/sparkcore.js:5
    <!DOCTYPE html>
    ^
    13 Nov 08:00:04 - ------------------------------------------
    13 Nov 08:00:04 - [sparkcore.js] SyntaxError: Unexpected token <
    13 Nov 08:00:04 - ------------------------------------------
    13 Nov 08:00:04 - [red] Server now running at http://127.0.0.1:1880/
    13 Nov 08:00:04 - [red] Loading flows : flows_ramServer.json
    13 Nov 08:00:04 - [36-rpi-gpio.js] Error: "/usr/local/bin/gpio -v" command failed for some reason.
    13 Nov 08:00:04 - [red] Starting flows
    13 Nov 08:00:04 - [warn] [arduino-board:1a003a65.e5ffc6] Device /dev/ttyACM0 not found

```

* * *

Here is the complete list of packages installed under the node-red directory:

* * *

```
pi@ramServer ~/node-red $ npm ls
node-red@0.9.1 /home/pi/node-red
├─┬ arduino-firmata@0.3.2 extraneous
│ ├─┬ debug@2.1.0
│ │ └── ms@0.6.2
│ ├── eventemitter2@0.4.14
│ └─┬ serialport@1.4.6
│ ├── async@0.9.0
│ ├── bindings@1.2.1
│ ├── nan@1.3.0
│ ├─┬ node-pre-gyp@0.5.19
│ │ ├─┬ mkdirp@0.5.0
│ │ │ └── minimist@0.0.8
│ │ ├─┬ nopt@2.2.1
│ │ │ └── abbrev@1.0.5
│ │ ├─┬ npmlog@0.0.6
│ │ │ └── ansi@0.2.1
│ │ ├─┬ rc@0.4.0
│ │ │ ├── deep-extend@0.2.10
│ │ │ ├── ini@1.1.0
│ │ │ ├── minimist@0.0.10
│ │ │ └── strip-json-comments@0.1.3
│ │ ├─┬ request@2.36.0
│ │ │ ├── aws-sign2@0.5.0
│ │ │ ├── forever-agent@0.5.2
│ │ │ ├─┬ form-data@0.1.2
│ │ │ │ ├── async@0.2.10
│ │ │ │ └─┬ combined-stream@0.0.4
│ │ │ │ └── delayed-stream@0.0.5
│ │ │ ├─┬ hawk@1.0.0
│ │ │ │ ├── boom@0.4.2
│ │ │ │ ├── cryptiles@0.2.2
│ │ │ │ ├── hoek@0.9.1
│ │ │ │ └── sntp@0.2.4
│ │ │ ├─┬ http-signature@0.10.0
│ │ │ │ ├── asn1@0.1.11
│ │ │ │ ├── assert-plus@0.1.2
│ │ │ │ └── ctype@0.5.2
│ │ │ ├── json-stringify-safe@5.0.0
│ │ │ ├── mime@1.2.11
│ │ │ ├── node-uuid@1.4.1
│ │ │ ├── oauth-sign@0.3.0
│ │ │ ├── qs@0.6.6
│ │ │ ├─┬ tough-cookie@0.12.1
│ │ │ │ └── punycode@1.2.4
│ │ │ └── tunnel-agent@0.4.0
│ │ ├── rimraf@2.2.8
│ │ ├── semver@2.3.0
│ │ ├─┬ tar@0.1.19
│ │ │ ├── block-stream@0.0.7
│ │ │ ├─┬ fstream@0.1.25
│ │ │ │ ├── graceful-fs@2.0.3
│ │ │ │ └── mkdirp@0.3.5
│ │ │ └── inherits@2.0.1
│ │ └─┬ tar-pack@2.0.0
│ │ ├── debug@0.7.4
│ │ ├─┬ fstream@0.1.25
│ │ │ ├── graceful-fs@2.0.3
│ │ │ ├── inherits@2.0.1
│ │ │ └── mkdirp@0.3.5
│ │ ├─┬ fstream-ignore@0.0.7
│ │ │ ├── inherits@2.0.1
│ │ │ └─┬ minimatch@0.2.14
│ │ │ ├── lru-cache@2.5.0
│ │ │ └── sigmund@1.0.0
│ │ ├── graceful-fs@1.2.3
│ │ ├── once@1.1.1
│ │ ├─┬ readable-stream@1.0.27-1
│ │ │ ├── core-util-is@1.0.1
│ │ │ ├── inherits@2.0.1
│ │ │ ├── isarray@0.0.1
│ │ │ └── string_decoder@0.10.25-1
│ │ └── uid-number@0.0.3
│ ├─┬ optimist@0.6.1
│ │ ├── minimist@0.0.10
│ │ └── wordwrap@0.0.2
│ └── sf@0.1.7
├─┬ cheerio@0.17.0
│ ├─┬ CSSselect@0.4.1
│ │ ├── CSSwhat@0.4.7
│ │ └─┬ domutils@1.4.3
│ │ └── domelementtype@1.1.3
│ ├─┬ dom-serializer@0.0.1
│ │ └── domelementtype@1.1.3
│ ├── entities@1.1.1
│ ├─┬ htmlparser2@3.7.3
│ │ ├── domelementtype@1.1.3
│ │ ├── domhandler@2.2.1
│ │ ├── domutils@1.5.0
│ │ ├── entities@1.0.0
│ │ └─┬ readable-stream@1.1.13
│ │ ├── core-util-is@1.0.1
│ │ ├── inherits@2.0.1
│ │ ├── isarray@0.0.1
│ │ └── string_decoder@0.10.31
│ └── lodash@2.4.1
├── clone@0.1.18
├── colors@0.6.2
├── cors@2.4.2
├── cron@1.0.4
├─┬ cylon@0.20.2
│ ├── async@0.9.0
│ ├─┬ body-parser@1.9.0
│ │ ├── bytes@1.0.0
│ │ ├── depd@1.0.0
│ │ ├── iconv-lite@0.4.4
│ │ ├── media-typer@0.3.0
│ │ ├─┬ on-finished@2.1.0
│ │ │ └── ee-first@1.0.5
│ │ ├── qs@2.2.4
│ │ └─┬ type-is@1.5.3
│ │ └─┬ mime-types@2.0.3
│ │ └── mime-db@1.2.0
│ ├─┬ express@4.9.8
│ │ ├─┬ accepts@1.1.3
│ │ │ ├─┬ mime-types@2.0.3
│ │ │ │ └── mime-db@1.2.0
│ │ │ └── negotiator@0.4.9
│ │ ├── cookie@0.1.2
│ │ ├── cookie-signature@1.0.5
│ │ ├─┬ debug@2.0.0
│ │ │ └── ms@0.6.2
│ │ ├── depd@0.4.5
│ │ ├── escape-html@1.0.1
│ │ ├─┬ etag@1.4.0
│ │ │ └── crc@3.0.0
│ │ ├── finalhandler@0.2.0
│ │ ├── fresh@0.2.4
│ │ ├── media-typer@0.3.0
│ │ ├── merge-descriptors@0.0.2
│ │ ├── methods@1.1.0
│ │ ├─┬ on-finished@2.1.1
│ │ │ └── ee-first@1.1.0
│ │ ├── parseurl@1.3.0
│ │ ├── path-to-regexp@0.1.3
│ │ ├─┬ proxy-addr@1.0.3
│ │ │ ├── forwarded@0.1.0
│ │ │ └── ipaddr.js@0.1.3
│ │ ├── qs@2.2.4
│ │ ├── range-parser@1.0.2
│ │ ├─┬ send@0.9.3
│ │ │ ├── destroy@1.0.3
│ │ │ ├── mime@1.2.11
│ │ │ ├── ms@0.6.2
│ │ │ └─┬ on-finished@2.1.0
│ │ │ └── ee-first@1.0.5
│ │ ├── serve-static@1.6.4
│ │ ├─┬ type-is@1.5.3
│ │ │ └─┬ mime-types@2.0.3
│ │ │ └── mime-db@1.2.0
│ │ ├── utils-merge@1.0.0
│ │ └── vary@1.0.0
│ └── robeaux@0.2.0
├─┬ cylon-ble@0.2.0 extraneous
│ └─┬ noble@0.3.6
│ └── debug@0.7.4
├─┬ cylon-firmata@0.17.0 extraneous
│ ├── cylon-gpio@0.20.0
│ ├── cylon-i2c@0.17.0
│ └─┬ firmata@0.3.5
│ ├── browser-serialport@1.0.6
│ └── object-assign@1.0.0
├── cylon-gpio@0.20.0
├── cylon-i2c@0.17.0
├── cylon-mqtt@0.1.0 extraneous
├── cylon-pebble@0.13.0 extraneous
├─┬ cylon-raspi@0.13.0 extraneous
│ ├── cylon-gpio@0.20.0
│ ├── cylon-i2c@0.17.0
│ └─┬ i2c@0.1.4
│ ├── bindings@1.1.1
│ ├── coffee-script@1.3.3
│ ├── repl@0.1.3
│ └── underscore@1.2.4
├─┬ eventsource@0.1.4 extraneous
│ └─┬ original@0.0.5
│ └── url-parse@0.0.4
├─┬ express@3.17.2
│ ├── basic-auth@1.0.0
│ ├─┬ commander@1.3.2
│ │ └── keypress@0.1.0
│ ├─┬ connect@2.26.1
│ │ ├── basic-auth-connect@1.0.0
│ │ ├─┬ body-parser@1.8.4
│ │ │ ├── iconv-lite@0.4.4
│ │ │ ├─┬ on-finished@2.1.0
│ │ │ │ └── ee-first@1.0.5
│ │ │ └── qs@2.2.4
│ │ ├── bytes@1.0.0
│ │ ├─┬ compression@1.1.2
│ │ │ ├─┬ accepts@1.1.3
│ │ │ │ ├─┬ mime-types@2.0.3
│ │ │ │ │ └── mime-db@1.2.0
│ │ │ │ └── negotiator@0.4.9
│ │ │ └─┬ compressible@2.0.1
│ │ │ └── mime-db@1.2.0
│ │ ├─┬ connect-timeout@1.3.0
│ │ │ └── ms@0.6.2
│ │ ├── cookie-parser@1.3.3
│ │ ├─┬ csurf@1.6.3
│ │ │ ├─┬ csrf@2.0.2
│ │ │ │ ├── base64-url@1.0.0
│ │ │ │ ├── rndm@1.0.0
│ │ │ │ ├── scmp@1.0.0
│ │ │ │ └─┬ uid-safe@1.0.1
│ │ │ │ └─┬ mz@1.0.2
│ │ │ │ └── native-or-bluebird@1.1.2
│ │ │ └─┬ http-errors@1.2.7
│ │ │ ├── inherits@2.0.1
│ │ │ └── statuses@1.2.0
│ │ ├─┬ errorhandler@1.2.2
│ │ │ └─┬ accepts@1.1.3
│ │ │ ├─┬ mime-types@2.0.3
│ │ │ │ └── mime-db@1.2.0
│ │ │ └── negotiator@0.4.9
│ │ ├─┬ express-session@1.8.2
│ │ │ ├─┬ uid-safe@1.0.1
│ │ │ │ ├── base64-url@1.0.0
│ │ │ │ └─┬ mz@1.0.2
│ │ │ │ └── native-or-bluebird@1.1.2
│ │ │ └── utils-merge@1.0.0
│ │ ├── finalhandler@0.2.0
│ │ ├── method-override@2.2.0
│ │ ├─┬ morgan@1.3.2
│ │ │ └─┬ on-finished@2.1.0
│ │ │ └── ee-first@1.0.5
│ │ ├─┬ multiparty@3.3.2
│ │ │ ├─┬ readable-stream@1.1.13
│ │ │ │ ├── core-util-is@1.0.1
│ │ │ │ ├── inherits@2.0.1
│ │ │ │ ├── isarray@0.0.1
│ │ │ │ └── string_decoder@0.10.31
│ │ │ └── stream-counter@0.2.0
│ │ ├── on-headers@1.0.0
│ │ ├── pause@0.0.1
│ │ ├── qs@2.2.3
│ │ ├── response-time@2.0.1
│ │ ├─┬ serve-favicon@2.1.6
│ │ │ ├── etag@1.5.0
│ │ │ └── ms@0.6.2
│ │ ├─┬ serve-index@1.2.1
│ │ │ ├─┬ accepts@1.1.3
│ │ │ │ ├─┬ mime-types@2.0.3
│ │ │ │ │ └── mime-db@1.2.0
│ │ │ │ └── negotiator@0.4.9
│ │ │ └── batch@0.5.1
│ │ ├─┬ serve-static@1.6.4
│ │ │ ├─┬ send@0.9.3
│ │ │ │ ├── destroy@1.0.3
│ │ │ │ ├── etag@1.4.0
│ │ │ │ ├── mime@1.2.11
│ │ │ │ ├── ms@0.6.2
│ │ │ │ └─┬ on-finished@2.1.0
│ │ │ │ └── ee-first@1.0.5
│ │ │ └── utils-merge@1.0.0
│ │ ├─┬ type-is@1.5.3
│ │ │ └─┬ mime-types@2.0.3
│ │ │ └── mime-db@1.2.0
│ │ └── vhost@3.0.0
│ ├── cookie@0.1.2
│ ├── cookie-signature@1.0.5
│ ├── crc@3.0.0
│ ├─┬ debug@2.0.0
│ │ └── ms@0.6.2
│ ├── depd@0.4.5
│ ├── escape-html@1.0.1
│ ├── fresh@0.2.4
│ ├── media-typer@0.3.0
│ ├── merge-descriptors@0.0.2
│ ├── methods@1.1.0
│ ├── parseurl@1.3.0
│ ├─┬ proxy-addr@1.0.1
│ │ └── ipaddr.js@0.1.2
│ ├── range-parser@1.0.2
│ ├─┬ send@0.9.2
│ │ ├── destroy@1.0.3
│ │ ├── etag@1.3.1
│ │ ├── mime@1.2.11
│ │ ├── ms@0.6.2
│ │ └─┬ on-finished@2.1.0
│ │ └── ee-first@1.0.5
│ └── vary@1.0.0
├─┬ feedparser@0.19.2 extraneous
│ ├── addressparser@0.1.3
│ ├── array-indexofobject@0.0.1
│ ├─┬ readable-stream@1.0.33
│ │ ├── core-util-is@1.0.1
│ │ ├── inherits@2.0.1
│ │ ├── isarray@0.0.1
│ │ └── string_decoder@0.10.31
│ ├─┬ resanitize@0.3.0
│ │ └── validator@1.5.1
│ └── sax@0.6.1
├─┬ follow-redirects@0.0.3
│ └── underscore@1.7.0
├─┬ fs-extra@0.11.1
│ ├── jsonfile@2.0.0
│ ├── ncp@0.6.0
│ └── rimraf@2.2.8
├─┬ fs.notify@0.0.4 extraneous
│ ├── async@0.1.22
│ └── retry@0.6.1
├─┬ grunt@0.4.5
│ ├── async@0.1.22
│ ├── coffee-script@1.3.3
│ ├── dateformat@1.0.2-1.2.3
│ ├── eventemitter2@0.4.14
│ ├── exit@0.1.2
│ ├─┬ findup-sync@0.1.3
│ │ ├─┬ glob@3.2.11
│ │ │ ├── inherits@2.0.1
│ │ │ └─┬ minimatch@0.3.0
│ │ │ ├── lru-cache@2.5.0
│ │ │ └── sigmund@1.0.0
│ │ └── lodash@2.4.1
│ ├── getobject@0.1.0
│ ├─┬ glob@3.1.21
│ │ ├── graceful-fs@1.2.3
│ │ └── inherits@1.0.0
│ ├─┬ grunt-legacy-log@0.1.1
│ │ ├── lodash@2.4.1
│ │ └── underscore.string@2.3.3
│ ├── grunt-legacy-util@0.2.0
│ ├── hooker@0.2.3
│ ├── iconv-lite@0.2.11
│ ├─┬ js-yaml@2.0.5
│ │ ├─┬ argparse@0.1.15
│ │ │ ├── underscore@1.4.4
│ │ │ └── underscore.string@2.3.3
│ │ └── esprima@1.0.4
│ ├── lodash@0.9.2
│ ├─┬ minimatch@0.2.14
│ │ ├── lru-cache@2.5.0
│ │ └── sigmund@1.0.0
│ ├─┬ nopt@1.0.10
│ │ └── abbrev@1.0.5
│ ├── rimraf@2.2.8
│ ├── underscore.string@2.2.1
│ └── which@1.0.5
├─┬ grunt-cli@0.1.13
│ ├─┬ findup-sync@0.1.3
│ │ ├─┬ glob@3.2.11
│ │ │ ├── inherits@2.0.1
│ │ │ └─┬ minimatch@0.3.0
│ │ │ ├── lru-cache@2.5.0
│ │ │ └── sigmund@1.0.0
│ │ └── lodash@2.4.1
│ ├─┬ nopt@1.0.10
│ │ └── abbrev@1.0.5
│ └── resolve@0.3.1
├─┬ grunt-contrib-jshint@0.10.0
│ ├── hooker@0.2.3
│ └─┬ jshint@2.5.10
│ ├─┬ cli@0.6.5
│ │ └─┬ glob@3.2.11
│ │ ├── inherits@2.0.1
│ │ └─┬ minimatch@0.3.0
│ │ ├── lru-cache@2.5.0
│ │ └── sigmund@1.0.0
│ ├─┬ console-browserify@1.1.0
│ │ └── date-now@0.1.4
│ ├── exit@0.1.2
│ ├─┬ htmlparser2@3.8.2
│ │ ├── domelementtype@1.1.3
│ │ ├── domhandler@2.3.0
│ │ ├── domutils@1.5.0
│ │ ├── entities@1.0.0
│ │ └─┬ readable-stream@1.1.13
│ │ ├── core-util-is@1.0.1
│ │ ├── inherits@2.0.1
│ │ ├── isarray@0.0.1
│ │ └── string_decoder@0.10.31
│ ├─┬ minimatch@1.0.0
│ │ ├── lru-cache@2.5.0
│ │ └── sigmund@1.0.0
│ ├── shelljs@0.3.0
│ ├── strip-json-comments@1.0.2
│ └── underscore@1.6.0
├── grunt-simple-mocha@0.4.0
├─┬ imap@0.8.13
│ ├─┬ readable-stream@1.1.13
│ │ ├── core-util-is@1.0.1
│ │ ├── inherits@2.0.1
│ │ ├── isarray@0.0.1
│ │ └── string_decoder@0.10.31
│ └── utf7@1.0.0
├─┬ irc@0.3.7
│ └── ansi-color@0.2.1
├── is-utf8@0.2.0
├── js2xmlparser@0.1.5 extraneous
├─┬ mkdirp@0.5.0
│ └── minimist@0.0.8
├─┬ mocha@1.21.4
│ ├── commander@2.0.0
│ ├─┬ debug@2.1.0
│ │ └── ms@0.6.2
│ ├── diff@1.0.7
│ ├─┬ glob@3.2.3
│ │ ├── graceful-fs@2.0.3
│ │ ├── inherits@2.0.1
│ │ └─┬ minimatch@0.2.14
│ │ ├── lru-cache@2.5.0
│ │ └── sigmund@1.0.0
│ ├── growl@1.8.1
│ ├─┬ jade@0.26.3
│ │ ├── commander@0.6.1
│ │ └── mkdirp@0.3.0
│ └── mkdirp@0.3.5
├─┬ mongodb@1.4.19 extraneous
│ ├─┬ bson@0.2.15
│ │ └── nan@1.3.0
│ ├── kerberos@0.0.4
│ └─┬ readable-stream@1.0.33
│ ├── core-util-is@1.0.1
│ ├── inherits@2.0.1
│ ├── isarray@0.0.1
│ └── string_decoder@0.10.31
├─┬ mqtt@0.3.12
│ └─┬ readable-stream@1.0.33
│ ├── core-util-is@1.0.1
│ ├── inherits@2.0.1
│ ├── isarray@0.0.1
│ └── string_decoder@0.10.31
├── mustache@0.8.2
├─┬ node-red-node-pushover@0.0.1 extraneous
│ └── pushover-notifications@0.2.0
├─┬ node-red-node-twilio@0.0.4 extraneous
│ └─┬ twilio@1.6.0
│ ├── jwt-simple@0.1.0
│ ├── q@0.9.7
│ ├─┬ request@2.27.0
│ │ ├── aws-sign@0.3.0
│ │ ├── cookie-jar@0.3.0
│ │ ├── forever-agent@0.5.2
│ │ ├─┬ form-data@0.1.4
│ │ │ ├── async@0.9.0
│ │ │ └─┬ combined-stream@0.0.7
│ │ │ └── delayed-stream@0.0.5
│ │ ├─┬ hawk@1.0.0
│ │ │ ├── boom@0.4.2
│ │ │ ├── cryptiles@0.2.2
│ │ │ ├── hoek@0.9.1
│ │ │ └── sntp@0.2.4
│ │ ├─┬ http-signature@0.10.0
│ │ │ ├── asn1@0.1.11
│ │ │ ├── assert-plus@0.1.2
│ │ │ └── ctype@0.5.2
│ │ ├── json-stringify-safe@5.0.0
│ │ ├── mime@1.2.11
│ │ ├── node-uuid@1.4.1
│ │ ├── oauth-sign@0.3.0
│ │ ├── qs@0.6.6
│ │ └── tunnel-agent@0.3.0
│ └── underscore@1.7.0
├─┬ nodemailer@1.3.0
│ ├─┬ buildmail@1.2.0
│ │ ├── addressparser@0.3.1
│ │ ├── libbase64@0.1.0
│ │ └── libqp@0.1.1
│ ├─┬ hyperquest@0.3.0
│ │ ├── duplexer@0.1.1
│ │ └── through@2.2.7
│ ├─┬ libmime@0.1.6
│ │ ├── iconv-lite@0.4.4
│ │ ├── libbase64@0.1.0
│ │ └── libqp@0.1.1
│ ├─┬ nodemailer-direct-transport@1.0.0
│ │ └── smtp-connection@0.1.7
│ └─┬ nodemailer-smtp-transport@0.1.13
│ ├── nodemailer-wellknown@0.1.3
│ └── smtp-connection@1.0.2
├─┬ nopt@3.0.1
│ └── abbrev@1.0.5
├── oauth@0.9.12
├─┬ raw-body@1.3.0
│ ├── bytes@1.0.0
│ └── iconv-lite@0.4.4
├── redis@0.12.1 extraneous
├─┬ request@2.42.0
│ ├── aws-sign2@0.5.0
│ ├─┬ bl@0.9.3
│ │ └─┬ readable-stream@1.0.33
│ │ ├── core-util-is@1.0.1
│ │ ├── inherits@2.0.1
│ │ ├── isarray@0.0.1
│ │ └── string_decoder@0.10.31
│ ├── caseless@0.6.0
│ ├── forever-agent@0.5.2
│ ├─┬ form-data@0.1.4
│ │ ├── async@0.9.0
│ │ ├─┬ combined-stream@0.0.7
│ │ │ └── delayed-stream@0.0.5
│ │ └── mime@1.2.11
│ ├─┬ hawk@1.1.1
│ │ ├── boom@0.4.2
│ │ ├── cryptiles@0.2.2
│ │ ├── hoek@0.9.1
│ │ └── sntp@0.2.4
│ ├─┬ http-signature@0.10.0
│ │ ├── asn1@0.1.11
│ │ ├── assert-plus@0.1.2
│ │ └── ctype@0.5.2
│ ├── json-stringify-safe@5.0.0
│ ├── mime-types@1.0.2
│ ├── node-uuid@1.4.1
│ ├── oauth-sign@0.4.0
│ ├── qs@1.2.2
│ ├── stringstream@0.0.4
│ ├─┬ tough-cookie@0.12.1
│ │ └── punycode@1.3.2
│ └── tunnel-agent@0.4.0
├─┬ sentiment@0.2.3
│ ├── async@0.2.10
│ └── lodash@1.3.1
├─┬ serialport@1.4.6 extraneous
│ ├── async@0.9.0
│ ├── bindings@1.2.1
│ ├── nan@1.3.0
│ ├─┬ node-pre-gyp@0.5.19
│ │ ├─┬ mkdirp@0.5.0
│ │ │ └── minimist@0.0.8
│ │ ├─┬ nopt@2.2.1
│ │ │ └── abbrev@1.0.5
│ │ ├─┬ npmlog@0.0.6
│ │ │ └── ansi@0.2.1
│ │ ├─┬ rc@0.4.0
│ │ │ ├── deep-extend@0.2.10
│ │ │ ├── ini@1.1.0
│ │ │ ├── minimist@0.0.10
│ │ │ └── strip-json-comments@0.1.3
│ │ ├─┬ request@2.36.0
│ │ │ ├── aws-sign2@0.5.0
│ │ │ ├── forever-agent@0.5.2
│ │ │ ├─┬ form-data@0.1.2
│ │ │ │ ├── async@0.2.10
│ │ │ │ └─┬ combined-stream@0.0.4
│ │ │ │ └── delayed-stream@0.0.5
│ │ │ ├─┬ hawk@1.0.0
│ │ │ │ ├── boom@0.4.2
│ │ │ │ ├── cryptiles@0.2.2
│ │ │ │ ├── hoek@0.9.1
│ │ │ │ └── sntp@0.2.4
│ │ │ ├─┬ http-signature@0.10.0
│ │ │ │ ├── asn1@0.1.11
│ │ │ │ ├── assert-plus@0.1.2
│ │ │ │ └── ctype@0.5.2
│ │ │ ├── json-stringify-safe@5.0.0
│ │ │ ├── mime@1.2.11
│ │ │ ├── node-uuid@1.4.1
│ │ │ ├── oauth-sign@0.3.0
│ │ │ ├── qs@0.6.6
│ │ │ ├─┬ tough-cookie@0.12.1
│ │ │ │ └── punycode@1.2.4
│ │ │ └── tunnel-agent@0.4.0
│ │ ├── rimraf@2.2.8
│ │ ├── semver@2.3.0
│ │ ├─┬ tar@0.1.19
│ │ │ ├── block-stream@0.0.7
│ │ │ ├─┬ fstream@0.1.25
│ │ │ │ ├── graceful-fs@2.0.3
│ │ │ │ └── mkdirp@0.3.5
│ │ │ └── inherits@2.0.1
│ │ └─┬ tar-pack@2.0.0
│ │ ├── debug@0.7.4
│ │ ├─┬ fstream@0.1.25
│ │ │ ├── graceful-fs@2.0.3
│ │ │ ├── inherits@2.0.1
│ │ │ └── mkdirp@0.3.5
│ │ ├─┬ fstream-ignore@0.0.7
│ │ │ ├── inherits@2.0.1
│ │ │ └─┬ minimatch@0.2.14
│ │ │ ├── lru-cache@2.5.0
│ │ │ └── sigmund@1.0.0
│ │ ├── graceful-fs@1.2.3
│ │ ├── once@1.1.1
│ │ ├─┬ readable-stream@1.0.27-1
│ │ │ ├── core-util-is@1.0.1
│ │ │ ├── inherits@2.0.1
│ │ │ ├── isarray@0.0.1
│ │ │ └── string_decoder@0.10.25-1
│ │ └── uid-number@0.0.3
│ ├─┬ optimist@0.6.1
│ │ ├── minimist@0.0.10
│ │ └── wordwrap@0.0.2
│ └── sf@0.1.7
├── should@4.0.4
├─┬ sinon@1.10.3
│ ├─┬ formatio@1.0.2
│ │ └── samsam@1.1.1
│ └─┬ util@0.10.3
│ └── inherits@2.0.1
├─┬ supertest@0.13.0
│ ├── methods@1.0.0
│ └─┬ superagent@0.18.0
│ ├── component-emitter@1.1.2
│ ├── cookiejar@1.3.2
│ ├── debug@0.7.4
│ ├── extend@1.2.1
│ ├─┬ form-data@0.1.2
│ │ ├── async@0.2.10
│ │ ├─┬ combined-stream@0.0.7
│ │ │ └── delayed-stream@0.0.5
│ │ └── mime@1.2.11
│ ├── formidable@1.0.14
│ ├── methods@0.0.1
│ ├── mime@1.2.5
│ ├── qs@0.6.6
│ ├─┬ readable-stream@1.0.27-1
│ │ ├── core-util-is@1.0.1
│ │ ├── inherits@2.0.1
│ │ ├── isarray@0.0.1
│ │ └── string_decoder@0.10.31
│ └── reduce-component@1.0.1
├── twitter-ng@0.6.2
├─┬ uglify-js@2.4.15
│ ├── async@0.2.10
│ ├─┬ optimist@0.3.7
│ │ └── wordwrap@0.0.2
│ ├─┬ source-map@0.1.34
│ │ └── amdefine@0.1.0
│ └── uglify-to-browserify@1.0.2
├── when@3.4.6
├─┬ ws@0.4.32
│ ├── commander@2.1.0
│ ├── nan@1.0.0
│ ├── options@0.0.6
│ └── tinycolor@0.0.1
└─┬ xml2js@0.4.4
  ├── sax@0.6.1
  └─┬ xmlbuilder@2.4.4
    └── lodash-node@2.4.1
```

---

<div class="post-metadata">

**Author:** ![krvarma](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/krvarma/32/3089_2.png) [@krvarma](https://community.particle.io/u/krvarma)\
**Post date:** [November 25, 2014, 8:23pm UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/15 "2014-11-25T20:23:33Z")

</div>

Here is the version 0.0.7 NPM install package. Following command will install the package. The node-red authentication mechanism is implemented in this version. The authentication data, core id and access token are stored in separate file, so when you copy and paste the flow the auth data is not copied.

```
npm install node-red-contrib-sparkcore

```

I want to thank [Dave Conway-Jones](https://github.com/dceejay) for his valuable inputs.

---

<div class="post-metadata">

**Author:** ![sriram155](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@sriram155](https://community.particle.io/u/sriram155)\
**Post date:** [November 26, 2014, 1:01am UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/16 "2014-11-26T01:01:30Z")

</div>

@krvarma Thanks a lot. Does this work with Spark local cloud?

---

<div class="post-metadata">

**Author:** ![krvarma](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/krvarma/32/3089_2.png) [@krvarma](https://community.particle.io/u/krvarma)\
**Post date:** [November 26, 2014, 5:45am UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/17 "2014-11-26T05:45:14Z")

</div>

@sriram155 , this version 0.0.7 does not support the local cloud, but the next version will support this. I am working on it and may be early next week I can update it.

As I mentioned in the previous post this version has Authentication, Spark Core icon and some message modification to make it more consistent for all function call, read variable and the publish/subscribe.

---

<div class="post-metadata">

**Author:** ![sriram155](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@sriram155](https://community.particle.io/u/sriram155)\
**Post date:** [November 26, 2014, 5:59am UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/18 "2014-11-26T05:59:25Z")

</div>

@krvarma thanks for the note. I’m working on the local cloud. I’ll bookmark this thread for future updates.

---

<div class="post-metadata">

**Author:** ![krvarma](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/krvarma/32/3089_2.png) [@krvarma](https://community.particle.io/u/krvarma)\
**Post date:** [December 1, 2014, 7:45pm UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/19 "2014-12-01T19:45:30Z")

</div>

Just published latest version 0.0.8. This version supports local cloud also with some other issue fixes.

---

<div class="post-metadata">

**Author:** ![krvarma](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/krvarma/32/3089_2.png) [@krvarma](https://community.particle.io/u/krvarma)\
**Post date:** [December 1, 2014, 7:46pm UTC](https://community.particle.io/t/spark-core-and-node-red-integration/7582/20 "2014-12-01T19:46:03Z")

</div>

@sriram155, I just published the version 0.0.8, can you check you are able to connect to local cloud?

[Next page](https://community.particle.io/t/spark-core-and-node-red-integration/7582.md?page=2)
