mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Merge d782a5afb67840492e5bb64b3444fd5877d6fa7e into f385c13d44990fc92cea030637d4074e14e0d2e9
This commit is contained in:
commit
38018f5777
11
.travis.yml
11
.travis.yml
@ -1,14 +1,15 @@
|
|||||||
|
sudo: false
|
||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- "0.10"
|
- "0.10"
|
||||||
|
- "0.12"
|
||||||
before_install:
|
before_install:
|
||||||
- npm install -g npm@~1.4.18
|
- npm install -g npm@~1.4.28
|
||||||
before_script:
|
before_script:
|
||||||
- npm install -g istanbul
|
- npm install -g istanbul grunt-cli
|
||||||
- npm install coveralls
|
- npm install coveralls
|
||||||
- npm install node-red
|
- npm install git+https://github.com/node-red/node-red.git
|
||||||
#- npm install git+https://github.com/node-red/node-red.git
|
|
||||||
- export NODE_RED_HOME=`pwd`/node_modules/node-red
|
- export NODE_RED_HOME=`pwd`/node_modules/node-red
|
||||||
- (cd $NODE_RED_HOME ; npm install nock@~0.48.0)
|
- (cd $NODE_RED_HOME ; npm install nock@~0.48.0)
|
||||||
script:
|
script:
|
||||||
- istanbul cover ./node_modules/.bin/grunt --report lcovonly && istanbul report text && ( cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js || true ) && rm -rf coverage
|
- istanbul cover grunt --report lcovonly && istanbul report text && ( cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js || true ) && rm -rf coverage
|
||||||
|
@ -42,7 +42,7 @@ module.exports = function(grunt) {
|
|||||||
//"sub": true, // don't warn that foo['bar'] should be written as foo.bar
|
//"sub": true, // don't warn that foo['bar'] should be written as foo.bar
|
||||||
////"unused": true, // Check for unused functions
|
////"unused": true, // Check for unused functions
|
||||||
////"forin":false, // turn off check for "for (x in y...)"
|
////"forin":false, // turn off check for "for (x in y...)"
|
||||||
"reporter": require('jshint-stylish')
|
//"reporter": require('jshint-stylish')
|
||||||
},
|
},
|
||||||
all: {
|
all: {
|
||||||
src: ['*/*.js','*/*/*.js'],
|
src: ['*/*.js','*/*/*.js'],
|
||||||
@ -59,8 +59,8 @@ module.exports = function(grunt) {
|
|||||||
inlinelint: {
|
inlinelint: {
|
||||||
html: ['*/*/*.html'],
|
html: ['*/*/*.html'],
|
||||||
options: {
|
options: {
|
||||||
jshintrc: ".jshintrc",
|
jshintrc: ".jshintrc"
|
||||||
reporter: require('jshint-stylish')
|
//,reporter: require('jshint-stylish')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
jscs: {
|
jscs: {
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 311 B After Width: | Height: | Size: 252 B |
@ -3,10 +3,8 @@ node-red-node-arduino
|
|||||||
|
|
||||||
A <a href="http://nodered.org" target="_new">Node-RED</a> node to talk to an Arduino running firmata.
|
A <a href="http://nodered.org" target="_new">Node-RED</a> node to talk to an Arduino running firmata.
|
||||||
|
|
||||||
**Note** : This is the same node as is/was in the core of Node-RED. If you already
|
**Note** : This is the same node as was in the core of Node-RED.
|
||||||
have it installed you do NOT need this node. However it will be deprecated from
|
As of v0.10.8 you will need to install it from here if still required.
|
||||||
the core in due course, at which point you will need to install it from here if
|
|
||||||
still required.
|
|
||||||
|
|
||||||
Install
|
Install
|
||||||
-------
|
-------
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-arduino",
|
"name" : "node-red-node-arduino",
|
||||||
"version" : "0.0.1",
|
"version" : "0.0.2",
|
||||||
"description" : "A Node-RED node to talk to an Arduino running firmata",
|
"description" : "A Node-RED node to talk to an Arduino running firmata",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"arduino-firmata" : "0.3.2"
|
"arduino-firmata" : "0.3.2"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
Copyright 2013 IBM Corp.
|
Copyright 2014.2015 IBM Corp.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@ -14,92 +14,62 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
<!-- First, the content of the edit dialog is defined. -->
|
|
||||||
|
|
||||||
<script type="text/x-red" data-template-name="sensorTag">
|
<script type="text/x-red" data-template-name="sensorTag">
|
||||||
<!-- data-template-name identifies the node type this is for -->
|
<div class="form-row">
|
||||||
|
<label for="node-input-uuid"><i class="fa fa-ellipsis-h"></i> UUID</label>
|
||||||
<!-- Each of the following divs creates a field in the edit dialog. -->
|
<input type="text" id="node-input-uuid" placeholder="optional device bluetooth id">
|
||||||
<!-- Generally, there should be an input for each property of the node. -->
|
</div>
|
||||||
<!-- The for and id attributes identify the corresponding property -->
|
<div class="form-row">
|
||||||
<!-- (with the 'node-input-' prefix). -->
|
<label for="node-input-name"><i class="fa fa-external-link"></i> Outputs</label>
|
||||||
<!-- The available icon classes are defined in Twitter Bootstrap -->
|
<input type="checkbox" id="node-input-humidity" style="display: inline-block; width: auto; vertical-align: top;"> Temperature and Humidity<br/>
|
||||||
|
<label> </label>
|
||||||
<!-- By convention, most nodes have a 'name' property. The following div -->
|
<input type="checkbox" id="node-input-temperature" style="display: inline-block; width: auto; vertical-align: top;"> IR Temperature<br/>
|
||||||
<!-- provides the necessary field. -->
|
<label> </label>
|
||||||
|
<input type="checkbox" id="node-input-pressure" style="display: inline-block; width: auto; vertical-align: top;"> Pressure<br/>
|
||||||
|
<label> </label>
|
||||||
|
<input type="checkbox" id="node-input-magnetometer" style="display: inline-block; width: auto; vertical-align: top;"> Magnetometer<br/>
|
||||||
|
<label> </label>
|
||||||
|
<input type="checkbox" id="node-input-accelerometer" style="display: inline-block; width: auto; vertical-align: top;"> Accelerometer<br/>
|
||||||
|
<label> </label>
|
||||||
|
<input type="checkbox" id="node-input-gyroscope" style="display: inline-block; width: auto; vertical-align: top;"> Gyroscope<br/>
|
||||||
|
<label> </label>
|
||||||
|
<input type="checkbox" id="node-input-luxometer" style="display: inline-block; width: auto; vertical-align: top;"> Luminosity (CC2650 only)<br/>
|
||||||
|
<label> </label>
|
||||||
|
<input type="checkbox" id="node-input-keys" style="display: inline-block; width: auto; vertical-align: top;"> Button press<br/>
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-topic"><i class="fa fa-tasks"></i> Topic</label>
|
||||||
|
<input type="text" id="node-input-topic" placeholder="optional topic prefix - defaults to device id">
|
||||||
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-topic"><i class="fa fa-tag"></i> Topic</label>
|
|
||||||
<input type="text" id="node-input-topic" >
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-uuid"><i class="fa fa-tag"></i> UUID</label>
|
|
||||||
<input type="text" id="node-input-uuid" >
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-name"><i class="fa fa-tag"></i> Temperature</label>
|
|
||||||
<input type="checkbox" id="node-input-temperature" placeholder="">
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-name"><i class="fa fa-tag"></i> Humidity</label>
|
|
||||||
<input type="checkbox" id="node-input-humidity" >
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-name"><i class="fa fa-tag"></i> Pressure</label>
|
|
||||||
<input type="checkbox" id="node-input-pressure" >
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-name"><i class="fa fa-tag"></i> Magnetometer</label>
|
|
||||||
<input type="checkbox" id="node-input-magnetometer" >
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-name"><i class="fa fa-tag"></i> Accelerometer</label>
|
|
||||||
<input type="checkbox" id="node-input-accelerometer" >
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-name"><i class="fa fa-tag"></i> Gyroscope</label>
|
|
||||||
<input type="checkbox" id="node-input-gyroscope" >
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-name"><i class="fa fa-tag"></i> Keys</label>
|
|
||||||
<input type="checkbox" id="node-input-keys" >
|
|
||||||
</div>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<!-- Next, some simple help text is provided for the node. -->
|
|
||||||
<script type="text/x-red" data-help-name="sensorTag">
|
<script type="text/x-red" data-help-name="sensorTag">
|
||||||
<!-- data-help-name identifies the node type this help is for -->
|
<p>Node to read from the Ti SensorTag</p>
|
||||||
<!-- This content appears in the Info sidebar when a node is selected -->
|
<p>For this node to work correctly on Linux, Node-Red needs to be run as
|
||||||
<!-- The first <p> is used as the pop-up tool tip when hovering over a -->
|
<i>root</i>, this due to how Bluetooth 4.0 support is currently implemented
|
||||||
<!-- node in the palette. -->
|
in Linux.</p>
|
||||||
<p>Input node for the Ti SensorTag</p>
|
<p>The UUID field is the bluetooth mac address of the sensor tag, this is optional
|
||||||
<p>For this node to work correctly Node-Red needs to be run as <i>root</i>
|
and can be used to bind to a specific SensorTag if you have more than one
|
||||||
, this due to how Bluetooth 4.0 support is currently implemented in
|
active in range at the same time. <b>Note</b>: you can only have one SensorTag
|
||||||
Linux</p>
|
per node-red instance at the moment.</p>
|
||||||
<p>The UUID field is the mac address of the sensor tag, this is optional
|
<p>The topic setting is a prefix that will be pre-pended to the name of the
|
||||||
can be used to bind to a specific SensorTag if you have more than one
|
sensor that creates the reading. e.g. <i>sensorTag/temperature</i>. If
|
||||||
active in range at the same time. (note you can only have one SensorTag
|
blank it will be set to the UUID of the sensor tag.</p>
|
||||||
per node-red instance at the moment)</p>
|
|
||||||
<p>The topic setting is a prefix that will be pre-pended to name of the
|
|
||||||
sensor that creates the reading. e.g. <i>sensorTag/temperature</i></p>
|
|
||||||
<p><strong>NOTE:</strong> Only 1 sensorTag can be read from at a time,
|
<p><strong>NOTE:</strong> Only 1 sensorTag can be read from at a time,
|
||||||
if you add more than one to the canvas then only the first to connect
|
if you add more than one to the canvas then only the first to connect
|
||||||
will work.</p>
|
will work.</p>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Finally, the node type is registered along with all of its properties -->
|
|
||||||
<!-- The example below shows a small subset of the properties that can be set-->
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
RED.nodes.registerType('sensorTag',{
|
RED.nodes.registerType('sensorTag',{
|
||||||
category: 'advanced-function', // the palette category
|
category: 'advanced-function',
|
||||||
color:"GoldenRod",
|
color:"GoldenRod",
|
||||||
defaults: { // defines the editable properties of the node
|
defaults: {
|
||||||
name: {value:"sensorTag"}, // along with default values.
|
name: {value:"sensorTag"},
|
||||||
topic: {value:"sensorTag"},
|
topic: {value:"sensorTag"},
|
||||||
uuid: {value:undefined},
|
uuid: {value:undefined},
|
||||||
temperature: {value:true},
|
temperature: {value:true},
|
||||||
@ -108,15 +78,16 @@
|
|||||||
magnetometer: {value:true},
|
magnetometer: {value:true},
|
||||||
accelerometer: {value:true},
|
accelerometer: {value:true},
|
||||||
gyroscope: {value:true},
|
gyroscope: {value:true},
|
||||||
keys: {value:true}
|
keys: {value:true},
|
||||||
|
luxometer: {value:false}
|
||||||
},
|
},
|
||||||
inputs:0, // set the number of inputs - only 0 or 1
|
inputs:0,
|
||||||
outputs:1, // set the number of outputs - 0 to n
|
outputs:1,
|
||||||
icon: "bluetooth.png", // set the icon (held in public/icons)
|
icon: "bluetooth.png",
|
||||||
label: function() { // sets the default label contents
|
label: function() {
|
||||||
return this.name||this.topic||"sensorTag";
|
return this.name||this.topic||"sensorTag";
|
||||||
},
|
},
|
||||||
labelStyle: function() { // sets the class to apply to the label
|
labelStyle: function() {
|
||||||
return this.name?"node_label_italic":"";
|
return this.name?"node_label_italic":"";
|
||||||
},
|
},
|
||||||
oneditsave: function() {
|
oneditsave: function() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013 IBM Corp.
|
* Copyright 2014,2015 IBM Corp.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -14,12 +14,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
// Require main module
|
module.exports = function(RED) {
|
||||||
var RED = require(process.env.NODE_RED_HOME+"/red/red");
|
"use strict";
|
||||||
var SensorTag = require('sensortag');
|
var SensorTag = require("sensortag");
|
||||||
|
|
||||||
// The main node definition - most things happen in here
|
function SensorTagNode(n) {
|
||||||
function sensorTagNode(n) {
|
|
||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
this.name = n.name;
|
this.name = n.name;
|
||||||
this.topic = n.topic;
|
this.topic = n.topic;
|
||||||
@ -30,19 +29,17 @@ function sensorTagNode(n) {
|
|||||||
this.accelerometer = n.accelerometer;
|
this.accelerometer = n.accelerometer;
|
||||||
this.magnetometer = n.magnetometer;
|
this.magnetometer = n.magnetometer;
|
||||||
this.gyroscope = n.gyroscope;
|
this.gyroscope = n.gyroscope;
|
||||||
|
this.luxometer = n.luxometer;
|
||||||
this.keys = n.keys;
|
this.keys = n.keys;
|
||||||
|
if (this.uuid === "") { this.uuid = undefined; }
|
||||||
if (this.uuid === "") {
|
|
||||||
this.uuid = undefined;
|
|
||||||
}
|
|
||||||
//console.log(this.uuid);
|
|
||||||
|
|
||||||
var node = this;
|
var node = this;
|
||||||
|
|
||||||
if ( typeof node.stag == "undefined") {
|
if ( typeof node.stag === "undefined") {
|
||||||
//console.log("starting");
|
|
||||||
SensorTag.discover(function(sensorTag) {
|
SensorTag.discover(function(sensorTag) {
|
||||||
node.stag = sensorTag;
|
node.stag = sensorTag;
|
||||||
|
//console.log(sensorTag);
|
||||||
|
node.log("connected " + sensorTag._peripheral.uuid);
|
||||||
|
node.topic = node.topic || sensorTag._peripheral.uuid;
|
||||||
sensorTag.connect(function() {
|
sensorTag.connect(function() {
|
||||||
//console.log("connected");
|
//console.log("connected");
|
||||||
sensorTag.discoverServicesAndCharacteristics(function() {
|
sensorTag.discoverServicesAndCharacteristics(function() {
|
||||||
@ -50,46 +47,52 @@ function sensorTagNode(n) {
|
|||||||
sensorTag.on('irTemperatureChange',
|
sensorTag.on('irTemperatureChange',
|
||||||
function(objectTemperature, ambientTemperature) {
|
function(objectTemperature, ambientTemperature) {
|
||||||
var msg = {'topic': node.topic + '/temperature'};
|
var msg = {'topic': node.topic + '/temperature'};
|
||||||
msg.payload = {'object': objectTemperature.toFixed(1),
|
msg.payload = {'object': +objectTemperature.toFixed(1),
|
||||||
'ambient':ambientTemperature.toFixed(1)
|
'ambient': +ambientTemperature.toFixed(1)
|
||||||
};
|
};
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
});
|
});
|
||||||
sensorTag.enableBarometricPressure(function() {});
|
sensorTag.enableBarometricPressure(function() {});
|
||||||
sensorTag.on('barometricPressureChange', function(pressure) {
|
sensorTag.on('barometricPressureChange', function(pressure) {
|
||||||
var msg = {'topic': node.topic + '/pressure'};
|
var msg = {'topic': node.topic + '/pressure'};
|
||||||
msg.payload = {'pres': pressure.toFixed(1)};
|
msg.payload = {'pressure': parseInt(pressure)};
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
});
|
});
|
||||||
sensorTag.enableHumidity(function() {});
|
sensorTag.enableHumidity(function() {});
|
||||||
sensorTag.on('humidityChange', function(temp, humidity) {
|
sensorTag.on('humidityChange', function(temp, humidity) {
|
||||||
var msg = {'topic': node.topic + '/humidity'};
|
var msg = {'topic': node.topic + '/humidity'};
|
||||||
msg.payload = {'temp': temp.toFixed(1),
|
msg.payload = {'temperature': +temp.toFixed(1),
|
||||||
'humidity': humidity.toFixed(1)
|
'humidity': +humidity.toFixed(1)
|
||||||
};
|
};
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
});
|
});
|
||||||
sensorTag.enableAccelerometer(function() {});
|
sensorTag.enableAccelerometer(function() {});
|
||||||
sensorTag.on('accelerometerChange', function(x,y,z) {
|
sensorTag.on('accelerometerChange', function(x,y,z) {
|
||||||
var msg = {'topic': node.topic + '/accelerometer'};
|
var msg = {'topic': node.topic + '/accelerometer'};
|
||||||
msg.payload = {'x': x, 'y': y, 'z': z};
|
msg.payload = {'x': +x.toFixed(2), 'y': +y.toFixed(2), 'z': +z.toFixed(2)};
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
});
|
});
|
||||||
sensorTag.enableMagnetometer(function() {});
|
sensorTag.enableMagnetometer(function() {});
|
||||||
sensorTag.on('magnetometerChange', function(x,y,z) {
|
sensorTag.on('magnetometerChange', function(x,y,z) {
|
||||||
var msg = {'topic': node.topic + '/magnetometer'};
|
var msg = {'topic': node.topic + '/magnetometer'};
|
||||||
msg.payload = {'x': x, 'y': y, 'z': z};
|
msg.payload = {'x': +x.toFixed(2), 'y': +y.toFixed(2), 'z': +z.toFixed(2)};
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
});
|
});
|
||||||
sensorTag.enableGyroscope(function() {});
|
sensorTag.enableGyroscope(function() {});
|
||||||
sensorTag.on('gyroscopeChange', function(x,y,z) {
|
sensorTag.on('gyroscopeChange', function(x,y,z) {
|
||||||
var msg = {'topic': node.topic + '/gyroscope'};
|
var msg = {'topic': node.topic + '/gyroscope'};
|
||||||
msg.payload = {'x': x, 'y': y, 'z': z};
|
msg.payload = {'x': +x.toFixed(2), 'y': +y.toFixed(2), 'z': +z.toFixed(2)};
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
});
|
});
|
||||||
sensorTag.on('simpleKeyChange', function(left, right) {
|
sensorTag.on('simpleKeyChange', function(left, right, mag) {
|
||||||
var msg = {'topic': node.topic + '/keys'};
|
var msg = {'topic': node.topic + '/keys'};
|
||||||
msg.payload = {'left': left, 'right': right};
|
msg.payload = {'left': left, 'right': right, 'magnet': mag};
|
||||||
|
node.send(msg);
|
||||||
|
});
|
||||||
|
|
||||||
|
sensorTag.on('luxometerChange', function(lux) {
|
||||||
|
var msg = {'topic': node.topic + '/luxometer'};
|
||||||
|
msg.payload = {'lux': parseInt(lux)};
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
});
|
});
|
||||||
enable(node);
|
enable(node);
|
||||||
@ -97,12 +100,18 @@ function sensorTagNode(n) {
|
|||||||
});
|
});
|
||||||
},node.uuid);
|
},node.uuid);
|
||||||
} else {
|
} else {
|
||||||
//console.log("reconfig");
|
console.log("reconfig",node.uuid);
|
||||||
enable(node);
|
enable(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.on("close", function() {
|
||||||
|
if (node.stag) {
|
||||||
|
node.stag.disconnect(function() { node.log("disconnected ",node.uuid); });
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function enable(node) {
|
var enable = function(node) {
|
||||||
if (node.temperature) {
|
if (node.temperature) {
|
||||||
node.stag.notifyIrTemperature(function() {});
|
node.stag.notifyIrTemperature(function() {});
|
||||||
} else {
|
} else {
|
||||||
@ -133,10 +142,21 @@ function enable(node) {
|
|||||||
} else {
|
} else {
|
||||||
node.stag.unnotifyGyroscope(function() {});
|
node.stag.unnotifyGyroscope(function() {});
|
||||||
}
|
}
|
||||||
|
if (node.stag.type === "cc2650") {
|
||||||
|
if (node.luxometer) {
|
||||||
|
node.stag.enableLuxometer(function() {});
|
||||||
|
node.stag.notifyLuxometer(function() {});
|
||||||
|
} else {
|
||||||
|
node.stag.unnotifyLuxometer(function() {});
|
||||||
|
node.stag.disableLuxometer(function() {});
|
||||||
|
}
|
||||||
|
}
|
||||||
if (node.keys) {
|
if (node.keys) {
|
||||||
node.stag.notifySimpleKey(function() {});
|
node.stag.notifySimpleKey(function() {});
|
||||||
} else {
|
} else {
|
||||||
node.stag.unnotifySimpleKey(function() {});
|
node.stag.unnotifySimpleKey(function() {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RED.nodes.registerType("sensorTag",sensorTagNode);
|
|
||||||
|
RED.nodes.registerType("sensorTag",SensorTagNode);
|
||||||
|
}
|
||||||
|
@ -4,25 +4,28 @@ node-red-node-sensortag
|
|||||||
This node adds support to Node-RED to read from the Texas Instruments SensorTag.
|
This node adds support to Node-RED to read from the Texas Instruments SensorTag.
|
||||||
|
|
||||||
The SensorTag is a Bluetooth LE device hosting the following sensors:
|
The SensorTag is a Bluetooth LE device hosting the following sensors:
|
||||||
* Ambient & ir Temperature
|
|
||||||
|
* Humidity and Temperature
|
||||||
|
* Ambient & IR Temperatures
|
||||||
* Barometric Pressure
|
* Barometric Pressure
|
||||||
* Humidity
|
|
||||||
* 3 axis Accelerometer
|
* 3 axis Accelerometer
|
||||||
* 3 axis Magnetometer
|
|
||||||
* 3 axis Gyroscope
|
* 3 axis Gyroscope
|
||||||
|
* 3 axis Magnetometer
|
||||||
* 2 push Buttons
|
* 2 push Buttons
|
||||||
|
* 1 Luxometer (CC2650 version only)
|
||||||
|
|
||||||
The config node allows the user to enable/disable any of the sensors listed above. The readings from
|
The config node allows the user to enable/disable any of the sensors listed above. The readings from
|
||||||
these sensors will be sent as a JSON object payload with the sensor name appended to the topic provided:
|
these sensors will be sent as a JSON object payload with the sensor name appended to the topic provided:
|
||||||
|
|
||||||
* Temperature - { topic: [topic_prefix]/temperature, payload: { ambient: 21.2, object: 33.0 } }
|
|
||||||
* Barometric Pressure - { topic: [topic_prefix]/pressure, payload: { pres: 1000.1 } }
|
|
||||||
* Humidity - { topic: [topic_prefix]/humidity , payload: { temp: 21.2, humidity: 88} }
|
* Humidity - { topic: [topic_prefix]/humidity , payload: { temp: 21.2, humidity: 88} }
|
||||||
* Accelerometer - { topic: [topic_prefix]/ , payload: { x:0.0, y:9.8, z:0.0 } }
|
* Temperature - { topic: [topic_prefix]/temperature, payload: { ambient: 21.2, object: 33.0 } }
|
||||||
* Magnetometer - { topic: [topic_prefix]/ , payload: { x:0.0, y:0.0, z:0.0 } }
|
* Barometric Pressure - { topic: [topic_prefix]/pressure, payload: { pres: 1000 } }
|
||||||
* Gyroscope - { topic: [topic_prefix]/ , payload: { x:0.0, y:0.0, z:0.0 } }
|
* Accelerometer - { topic: [topic_prefix]/accelerometer , payload: { x:0.0, y:9.8, z:0.0 } }
|
||||||
* Buttons - { topic: [topic_prefix]/ , payload: { left: "down", right: "up"} }
|
* Magnetometer - { topic: [topic_prefix]/magnetometer , payload: { x:0.0, y:0.0, z:0.0 } }
|
||||||
|
* Gyroscope - { topic: [topic_prefix]/gyroscope , payload: { x:0.0, y:0.0, z:0.0 } }
|
||||||
|
* Luxometer - { topic: [topic_prefix]/luxometer , payload: { lux: 212 } }
|
||||||
|
* Buttons - { topic: [topic_prefix]/keys , payload: { left: true, right: false} }
|
||||||
|
|
||||||
The sensorTag library used by this node only supports using 1 SensorTag at once.
|
The sensorTag library used by this node only supports using 1 SensorTag at a time.
|
||||||
|
|
||||||
**NOTE:** Node-RED needs to be run as root inorder or access the Linux Bluetooth 4.0 system calls
|
**NOTE:** On Linux Node-RED needs to be run as root in order or access the Linux Bluetooth 4.0 system calls
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-node-sensortag",
|
"name": "node-red-node-sensortag",
|
||||||
"description": "A Node-RED node to read data from a TI SensorTag",
|
"description": "A Node-RED node to read data from a TI SensorTag",
|
||||||
"version": "0.0.3",
|
"version": "0.0.7",
|
||||||
"keywords" : ["node-red","sensortag"],
|
"keywords" : ["node-red","sensortag"],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"sensortag" : "0.1.9"
|
"sensortag": "~1.1.0"
|
||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository" : {
|
"repository" : {
|
||||||
|
@ -3,8 +3,8 @@ node-red-node-serialport
|
|||||||
|
|
||||||
<a href="http://nodered.org" target="_new">Node-RED</a> nodes to talk to an hardware Serial port.
|
<a href="http://nodered.org" target="_new">Node-RED</a> nodes to talk to an hardware Serial port.
|
||||||
|
|
||||||
**Note** : This is the same node as is/was in the core of Node-RED. If you already
|
**Note** : This is the same node as was in the core of Node-RED.
|
||||||
have it installed you do NOT need this node.
|
As of v0.10.8 it will be installed from here instead.
|
||||||
|
|
||||||
Install
|
Install
|
||||||
-------
|
-------
|
||||||
@ -12,7 +12,7 @@ Install
|
|||||||
Run the following command in the root directory of your Node-RED install, usually
|
Run the following command in the root directory of your Node-RED install, usually
|
||||||
this is ~/.node-red .
|
this is ~/.node-red .
|
||||||
|
|
||||||
npm install node-red-node-serialport
|
sudo npm install -g --unsafe-perm node-red-node-serialport
|
||||||
|
|
||||||
During install there may be multiple messages about optional compilation.
|
During install there may be multiple messages about optional compilation.
|
||||||
These may look like failures... as they report as failure to compile errors -
|
These may look like failures... as they report as failure to compile errors -
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-serialport",
|
"name" : "node-red-node-serialport",
|
||||||
"version" : "0.0.1",
|
"version" : "0.0.3",
|
||||||
"description" : "Node-RED nodes to talk to an serial port",
|
"description" : "Node-RED nodes to talk to an serial port",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"serialport" : "1.7.*"
|
"serialport" : "1.7.*"
|
||||||
|
20
package.json
20
package.json
@ -17,17 +17,15 @@
|
|||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt": "0.4.5",
|
"grunt": "0.4.5",
|
||||||
"grunt-cli": "0.1.13",
|
|
||||||
"grunt-simple-mocha": "0.4.0",
|
"grunt-simple-mocha": "0.4.0",
|
||||||
"grunt-contrib-jshint": "0.11.0",
|
"grunt-contrib-jshint": "0.11.2",
|
||||||
"grunt-lint-inline": "0.4.3",
|
"grunt-lint-inline": "0.4.4",
|
||||||
"grunt-jscs": "0.8.*",
|
"grunt-jscs": "1.8.*",
|
||||||
"jshint-stylish": "1.0.1",
|
"mocha": "2.2.5",
|
||||||
"mocha": "2.1.0",
|
"should": "7.0.1",
|
||||||
"should": "4.6.5",
|
"sinon": "1.15.4",
|
||||||
"sinon": "1.12.2",
|
"supertest": "1.0.1",
|
||||||
"supertest": "0.15.0",
|
"proxyquire": "1.6.0",
|
||||||
"proxyquire": "1.4.0",
|
|
||||||
"pushbullet": "1.4.*",
|
"pushbullet": "1.4.*",
|
||||||
"when": "^3.6.4",
|
"when": "^3.6.4",
|
||||||
"exif": "0.4.0",
|
"exif": "0.4.0",
|
||||||
@ -36,6 +34,6 @@
|
|||||||
"imap" : "0.8.14"
|
"imap" : "0.8.14"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.8 <0.11"
|
"node": ">=0.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,11 +25,17 @@ module.exports = function(RED) {
|
|||||||
if (dweetio == null) { dweetio = new DweetClient(); }
|
if (dweetio == null) { dweetio = new DweetClient(); }
|
||||||
var node = this;
|
var node = this;
|
||||||
|
|
||||||
|
var isObject = function(a) {
|
||||||
|
return (!!a) && (a.constructor === Object);
|
||||||
|
};
|
||||||
|
|
||||||
this.on("input",function(msg) {
|
this.on("input",function(msg) {
|
||||||
//if (typeof(msg.payload) === 'object') {
|
if (!isObject(msg.payload)) {
|
||||||
|
msg.payload = {payload:msg.payload};
|
||||||
|
}
|
||||||
var thing = node.thing || msg.thing;
|
var thing = node.thing || msg.thing;
|
||||||
try {
|
try {
|
||||||
dweetio.dweet_for(thing, {payload:msg.payload}, function(err, dweet) {
|
dweetio.dweet_for(thing, msg.payload, function(err, dweet) {
|
||||||
//console.log(dweet.thing); // "my-thing"
|
//console.log(dweet.thing); // "my-thing"
|
||||||
//console.log(dweet.content); // The content of the dweet
|
//console.log(dweet.content); // The content of the dweet
|
||||||
//console.log(dweet.created); // The create date of the dweet
|
//console.log(dweet.created); // The create date of the dweet
|
||||||
@ -38,7 +44,6 @@ module.exports = function(RED) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
node.log(err);
|
node.log(err);
|
||||||
}
|
}
|
||||||
//} else { node.warn("Dweetio only sends payload objects."); }
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-dweetio",
|
"name" : "node-red-node-dweetio",
|
||||||
"version" : "0.0.5",
|
"version" : "0.0.4",
|
||||||
"description" : "A Node-RED node to send and receive simple dweets",
|
"description" : "A Node-RED node to send and receive simple dweets",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"node-dweetio" : "0.0.11"
|
"node-dweetio" : "0.0.12"
|
||||||
},
|
},
|
||||||
"repository" : {
|
"repository" : {
|
||||||
"type":"git",
|
"type":"git",
|
||||||
|
@ -127,8 +127,8 @@ module.exports = function(RED) {
|
|||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
this.name = n.name;
|
this.name = n.name;
|
||||||
this.repeat = n.repeat * 1000 || 300000;
|
this.repeat = n.repeat * 1000 || 300000;
|
||||||
this.inserver = n.server || globalkeys.server || "imap.gmail.com";
|
this.inserver = n.server || (globalkeys && globalkeys.server) || "imap.gmail.com";
|
||||||
this.inport = n.port || globalkeys.port || "993";
|
this.inport = n.port || (globalkeys && globalkeys.port) || "993";
|
||||||
this.box = n.box || "INBOX";
|
this.box = n.box || "INBOX";
|
||||||
var flag = false;
|
var flag = false;
|
||||||
|
|
||||||
@ -201,9 +201,9 @@ module.exports = function(RED) {
|
|||||||
stream.on('end', function() {
|
stream.on('end', function() {
|
||||||
if (info.which !== 'TEXT') {
|
if (info.which !== 'TEXT') {
|
||||||
var head = Imap.parseHeader(buffer);
|
var head = Imap.parseHeader(buffer);
|
||||||
pay.from = head.from[0];
|
if (head.hasOwnProperty("from")) { pay.from = head.from[0]; }
|
||||||
pay.topic = head.subject[0];
|
if (head.hasOwnProperty("subject")) { pay.topic = head.subject[0]; }
|
||||||
pay.date = head.date[0];
|
if (head.hasOwnProperty("date")) { pay.date = head.date[0]; }
|
||||||
pay.header = head;
|
pay.header = head;
|
||||||
} else {
|
} else {
|
||||||
var parts = buffer.split("Content-Type");
|
var parts = buffer.split("Content-Type");
|
||||||
|
@ -3,7 +3,8 @@ node-red-node-email
|
|||||||
|
|
||||||
<a href="http://nodered.org" target="_new">Node-RED</a> nodes to send and receive simple emails.
|
<a href="http://nodered.org" target="_new">Node-RED</a> nodes to send and receive simple emails.
|
||||||
|
|
||||||
**Note** : This is the same node as is/was in the core of Node-RED.
|
**Note** : This is the same node as was in the core of Node-RED.
|
||||||
|
As of v0.10.8 it will be installed from here instead.
|
||||||
|
|
||||||
Pre-requisite
|
Pre-requisite
|
||||||
-------------
|
-------------
|
||||||
|
@ -3,10 +3,8 @@ node-red-node-feedparser
|
|||||||
|
|
||||||
A <a href="http://nodered.org" target="_new">Node-RED</a> node to read RSS and Atom feeds.
|
A <a href="http://nodered.org" target="_new">Node-RED</a> node to read RSS and Atom feeds.
|
||||||
|
|
||||||
**Note** : This is the same node as is/was in the core of Node-RED. If you already
|
**Note** : This is the same node as was in the core of Node-RED.
|
||||||
have it installed you do NOT need this node. However it will be deprecated from
|
As of v0.10.8 it will be installed from here instead.
|
||||||
the core in due course, at which point you will need to install it from here if
|
|
||||||
still required.
|
|
||||||
|
|
||||||
Install
|
Install
|
||||||
-------
|
-------
|
||||||
|
@ -3,10 +3,8 @@ node-red-node-irc
|
|||||||
|
|
||||||
A <a href="http://nodered.org" target="_new">Node-RED</a> node to talk to an IRC server.
|
A <a href="http://nodered.org" target="_new">Node-RED</a> node to talk to an IRC server.
|
||||||
|
|
||||||
**Note** : This is the same node as is/was in the core of Node-RED. If you already
|
**Note** : This is the same node as was in the core of Node-RED.
|
||||||
have it installed you do NOT need this node. However it will be deprecated from
|
As of v0.10.8 you will need to install it from here if still required.
|
||||||
the core in due course, at which point you will need to install it from here if
|
|
||||||
still required.
|
|
||||||
|
|
||||||
Install
|
Install
|
||||||
-------
|
-------
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-irc",
|
"name" : "node-red-node-irc",
|
||||||
"version" : "0.0.2",
|
"version" : "0.0.3",
|
||||||
"description" : "A Node-RED node to talk to an IRC server",
|
"description" : "A Node-RED node to talk to an IRC server",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"irc" : "0.3.11"
|
"irc" : "0.3.11"
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
<label for="node-input-title"><i class="fa fa-flag"></i> Title</label>
|
<label for="node-input-title"><i class="fa fa-flag"></i> Title</label>
|
||||||
<input type="text" id="node-input-title" placeholder="Node-RED">
|
<input type="text" id="node-input-title" placeholder="Node-RED">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-device"><i class="fa fa-mobile"></i> Device</label>
|
||||||
|
<input type="text" id="node-input-device" placeholder="leave blank for all">
|
||||||
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-priority"><i class="fa fa-star"></i> Priority</label>
|
<label for="node-input-priority"><i class="fa fa-star"></i> Priority</label>
|
||||||
<input type="text" id="node-input-priority" placeholder="0" style="width:50px;">
|
<input type="text" id="node-input-priority" placeholder="0" style="width:50px;">
|
||||||
@ -36,13 +40,15 @@
|
|||||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-tips" id="node-tip">Tip: Leave title blank to set using <b>msg.topic</b> and <b>msg.priority</b>.<br/>
|
<div class="form-tips" id="node-tip">Tip: Leave title blank to set using <b>msg.topic</b>.<br/>
|
||||||
Only supports priorities 2, 1, 0, and -1.</div>
|
Leave device blank to send to all devices, or to set using <b>msg.device</b>.<br/>
|
||||||
|
Leave priority blank to set using <b>msg.priority</b>. Supports priorities 2, 1, 0, -1, and -2.</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/x-red" data-help-name="pushover">
|
<script type="text/x-red" data-help-name="pushover">
|
||||||
<p>Uses Pushover to push the <b>msg.payload</b> to a device that has the Pushover app installed.</p>
|
<p>Uses Pushover to push the <b>msg.payload</b> to a device that has the Pushover app installed.</p>
|
||||||
<p>Optionally uses <b>msg.topic</b> to set the title, and <b>msg.priority</b> to set the priority, if not already set in the properties.</p>
|
<p>Optionally uses <b>msg.topic</b> to set the title, <b>msg.device</b> to set the device, and <b>msg.priority</b>
|
||||||
|
to set the priority, if not already set in the properties.</p>
|
||||||
<p>The User-key and API-token are stored in a separate credentials file.</p>
|
<p>The User-key and API-token are stored in a separate credentials file.</p>
|
||||||
<p>Uses Pushover. See <i><a href="https://pushover.net" target="_new">this link</a></i> for more details.</p>
|
<p>Uses Pushover. See <i><a href="https://pushover.net" target="_new">this link</a></i> for more details.</p>
|
||||||
</script>
|
</script>
|
||||||
@ -51,8 +57,9 @@
|
|||||||
RED.nodes.registerType('pushover',{
|
RED.nodes.registerType('pushover',{
|
||||||
category: 'output',
|
category: 'output',
|
||||||
defaults: {
|
defaults: {
|
||||||
title: {value:""},
|
|
||||||
name: {value:""},
|
name: {value:""},
|
||||||
|
device: {value:""},
|
||||||
|
title: {value:""},
|
||||||
priority: {value:0}
|
priority: {value:0}
|
||||||
},
|
},
|
||||||
credentials: {
|
credentials: {
|
||||||
@ -72,7 +79,7 @@
|
|||||||
},
|
},
|
||||||
oneditprepare: function() {
|
oneditprepare: function() {
|
||||||
$("#node-input-priority").spinner({
|
$("#node-input-priority").spinner({
|
||||||
min:-1,
|
min:-2,
|
||||||
max:2
|
max:2
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ module.exports = function(RED) {
|
|||||||
function PushoverNode(n) {
|
function PushoverNode(n) {
|
||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
this.title = n.title;
|
this.title = n.title;
|
||||||
|
this.device = n.device;
|
||||||
this.priority = n.priority;
|
this.priority = n.priority;
|
||||||
var credentials = this.credentials;
|
var credentials = this.credentials;
|
||||||
if ((credentials) && (credentials.hasOwnProperty("pushkey"))) { this.pushkey = credentials.pushkey; }
|
if ((credentials) && (credentials.hasOwnProperty("pushkey"))) { this.pushkey = credentials.pushkey; }
|
||||||
@ -43,9 +44,10 @@ module.exports = function(RED) {
|
|||||||
this.on("input",function(msg) {
|
this.on("input",function(msg) {
|
||||||
var titl = this.title || msg.topic || "Node-RED";
|
var titl = this.title || msg.topic || "Node-RED";
|
||||||
var pri = this.priority || msg.priority || 0;
|
var pri = this.priority || msg.priority || 0;
|
||||||
|
var dev = this.device || msg.device;
|
||||||
if (isNaN(pri)) {pri=0;}
|
if (isNaN(pri)) {pri=0;}
|
||||||
if (pri > 2) {pri = 2;}
|
if (pri > 2) {pri = 2;}
|
||||||
if (pri < -1) {pri = -1;}
|
if (pri < -2) {pri = -2;}
|
||||||
if (typeof(msg.payload) === 'object') {
|
if (typeof(msg.payload) === 'object') {
|
||||||
msg.payload = JSON.stringify(msg.payload);
|
msg.payload = JSON.stringify(msg.payload);
|
||||||
}
|
}
|
||||||
@ -58,7 +60,8 @@ module.exports = function(RED) {
|
|||||||
retry: 30,
|
retry: 30,
|
||||||
expire: 600
|
expire: 600
|
||||||
};
|
};
|
||||||
//console.log("Sending",pushmsg);
|
if (dev) { pushmsg.device = dev; }
|
||||||
|
//node.log("Sending "+JSON.stringify(pushmsg));
|
||||||
pusher.send( pushmsg, function(err, response) {
|
pusher.send( pushmsg, function(err, response) {
|
||||||
if (err) { node.error("Pushover Error: "+err); }
|
if (err) { node.error("Pushover Error: "+err); }
|
||||||
//console.log(response);
|
//console.log(response);
|
||||||
|
@ -16,7 +16,8 @@ Usage
|
|||||||
|
|
||||||
Uses Pushover to push the <b>msg.payload</b> to a device that has the Pushover app installed.
|
Uses Pushover to push the <b>msg.payload</b> to a device that has the Pushover app installed.
|
||||||
|
|
||||||
Optionally uses **msg.topic** to set the title, and **msg.priority** to set the priority, if not already set in the properties.
|
Optionally uses **msg.topic** to set the title, **msg.device** to set the device
|
||||||
|
and **msg.priority** to set the priority, if not already set in the properties.
|
||||||
|
|
||||||
The User-key and API-token are stored in a separate credentials file.
|
The User-key and API-token are stored in a separate credentials file.
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-pushover",
|
"name" : "node-red-node-pushover",
|
||||||
"version" : "0.0.4",
|
"version" : "0.0.5",
|
||||||
"description" : "A Node-RED node to send alerts via Pushover",
|
"description" : "A Node-RED node to send alerts via Pushover",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"pushover-notifications" : "0.2.2"
|
"pushover-notifications" : "0.2.2"
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
},
|
},
|
||||||
exportable: false,
|
exportable: false,
|
||||||
oneditprepare: function() {
|
oneditprepare: function() {
|
||||||
|
var twitterConfigNodeId = this.id;
|
||||||
var clickhere = this._("twitter.label.clickhere");
|
var clickhere = this._("twitter.label.clickhere");
|
||||||
var twitterID = this._("twitter.label.twitter-id");
|
var twitterID = this._("twitter.label.twitter-id");
|
||||||
function showTwitterAuthStart() {
|
function showTwitterAuthStart() {
|
||||||
@ -204,6 +205,8 @@
|
|||||||
<p>To send a Direct Message (DM) - use a payload like "D {username} {message}"</p>
|
<p>To send a Direct Message (DM) - use a payload like "D {username} {message}"</p>
|
||||||
<p>If <b>msg.media</b> exists and is a Buffer object, this node will treat it
|
<p>If <b>msg.media</b> exists and is a Buffer object, this node will treat it
|
||||||
as an image and attach it to the tweet.</p>
|
as an image and attach it to the tweet.</p>
|
||||||
|
<p>If <b>msg.params</b> exists and is an object of name:value pairs,
|
||||||
|
this node will treat it as parameters for the update request.</p>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -313,7 +313,8 @@ module.exports = function(RED) {
|
|||||||
form.append("media[]",msg.media,{filename:"image"});
|
form.append("media[]",msg.media,{filename:"image"});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
twit.updateStatus(msg.payload, function (err, data) {
|
if (typeof msg.params === 'undefined') { msg.params = {}; }
|
||||||
|
+ twit.updateStatus(msg.payload, msg.params, function (err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
node.status({fill:"red",shape:"ring",text:"twitter.status.failed"});
|
node.status({fill:"red",shape:"ring",text:"twitter.status.failed"});
|
||||||
node.error(err,msg);
|
node.error(err,msg);
|
||||||
|
@ -5,12 +5,10 @@ node-red-node-twitter
|
|||||||
|
|
||||||
The Twitter API will **NOT** deliver 100% of all tweets. This does **NOT** give access to the Twitter Firehose.
|
The Twitter API will **NOT** deliver 100% of all tweets. This does **NOT** give access to the Twitter Firehose.
|
||||||
|
|
||||||
Tweets of who you follow will include their retweets and favourites.</div>
|
Tweets of who you follow will include their retweets and favourites.
|
||||||
|
|
||||||
**Note** : This is the same node as is/was in the core of Node-RED. If you already
|
**Note** : This is the same node as was in the core of Node-RED.
|
||||||
have it installed you do NOT need this node. However it will be deprecated from
|
As of v0.10.8 it will be installed from here instead.
|
||||||
the core in due course, at which point you will need to install it from here if
|
|
||||||
still required.
|
|
||||||
|
|
||||||
Install
|
Install
|
||||||
-------
|
-------
|
||||||
@ -55,5 +53,6 @@ To send a Direct Message (DM) - use a payload like.
|
|||||||
|
|
||||||
D {username} {message}
|
D {username} {message}
|
||||||
|
|
||||||
If **msg.media** exists and is a Buffer object, this node will treat it
|
If **msg.media** exists and is a Buffer object, this node will treat it as an image and attach it to the tweet.
|
||||||
as an image and attach it to the tweet.</p>
|
|
||||||
|
If **msg.params** exists and is an object of name:value pairs, this node will treat it as parameters for the update request.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-twitter",
|
"name" : "node-red-node-twitter",
|
||||||
"version" : "0.1.0",
|
"version" : "0.1.2",
|
||||||
"description" : "A Node-RED node to talk to Twitter",
|
"description" : "A Node-RED node to talk to Twitter",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"twitter-ng": "0.6.2",
|
"twitter-ng": "0.6.2",
|
||||||
|
@ -3,8 +3,8 @@ node-red-node-mongodb
|
|||||||
|
|
||||||
A <a href="http://nodered.org" target="_new">Node-RED</a> node to save data in a MongoDB database.
|
A <a href="http://nodered.org" target="_new">Node-RED</a> node to save data in a MongoDB database.
|
||||||
|
|
||||||
**Note** : This is the same node as is/was in the core of Node-RED. If you already
|
**Note** : This is the same node as was in the core of Node-RED.
|
||||||
have it installed you do NOT need this node.
|
As of v0.10.8 you will need to install it from here if still required.
|
||||||
|
|
||||||
Pre-requisite
|
Pre-requisite
|
||||||
-------------
|
-------------
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-mongodb",
|
"name" : "node-red-node-mongodb",
|
||||||
"version" : "0.0.1",
|
"version" : "0.0.2",
|
||||||
"description" : "Node-RED nodes to talk to an Mongo database",
|
"description" : "Node-RED nodes to talk to an Mongo database",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"mongodb" : "1.3.6"
|
"mongodb" : "1.3.6"
|
||||||
|
@ -3,8 +3,8 @@ node-red-node-redis
|
|||||||
|
|
||||||
A <a href="http://nodered.org" target="_new">Node-RED</a> node to save data in a Redis database.
|
A <a href="http://nodered.org" target="_new">Node-RED</a> node to save data in a Redis database.
|
||||||
|
|
||||||
**Note** : This is the same node as is/was in the core of Node-RED. If you already
|
**Note** : This is the same node as was in the core of Node-RED.
|
||||||
have it installed you do NOT need this node.
|
As of v0.10.8 you will need to install it from here if still required.
|
||||||
|
|
||||||
Pre-requisite
|
Pre-requisite
|
||||||
-------------
|
-------------
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-redis",
|
"name" : "node-red-node-redis",
|
||||||
"version" : "0.0.1",
|
"version" : "0.0.2",
|
||||||
"description" : "A Node-RED node to save data to an Redis database",
|
"description" : "A Node-RED node to save data to an Redis database",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"redis" : "0.12.1"
|
"redis" : "0.12.1"
|
||||||
|
@ -16,11 +16,8 @@
|
|||||||
|
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
|
||||||
//console.log("WAS",process.env.NODE_RED_HOME);
|
|
||||||
//console.log("WAS2",__dirname);
|
|
||||||
process.env.NODE_RED_HOME = process.env.NODE_RED_HOME || path.resolve(__dirname+"/../../node-red");
|
process.env.NODE_RED_HOME = process.env.NODE_RED_HOME || path.resolve(__dirname+"/../../node-red");
|
||||||
//console.log("HOME",process.env.NODE_RED_HOME);
|
//console.log("HOME",process.env.NODE_RED_HOME);
|
||||||
//console.log("PATH",path.join(process.env.NODE_RED_HOME, 'test', 'nodes', 'helper.js'));
|
|
||||||
var helper = require(path.join(process.env.NODE_RED_HOME, 'test', 'nodes', 'helper.js'));
|
var helper = require(path.join(process.env.NODE_RED_HOME, 'test', 'nodes', 'helper.js'));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2014 IBM Corp.
|
* Copyright 2015 IBM Corp.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -30,56 +30,13 @@ describe('email Node', function() {
|
|||||||
helper.stopServer(done);
|
helper.stopServer(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe.skip('email out', function() {
|
describe('email in', function() {
|
||||||
|
|
||||||
it('should load with defaults', function(done) {
|
it('should load with defaults', function(done) {
|
||||||
var flow = [ { id:"n1", type:"e-mail", name:"emailout", wires:[[]] } ];
|
var flow = [ { id:"n1", type:"e-mail in", name:"emailin", wires:[[]] } ];
|
||||||
helper.load(emailNode, flow, function() {
|
|
||||||
var n1 = helper.getNode("n1");
|
|
||||||
n1.should.have.property('name', "emailout");
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should send an email', function(done) {
|
|
||||||
var smtpTransport = require("nodemailer").createTransport();
|
|
||||||
//var spy = sinon.stub(smtpTransport, 'sendMail', function(arg1,arg2,arg3,arg4) {
|
|
||||||
//console.log("HELLO");
|
|
||||||
//console.log(arg1,arg2,arg3,arg4);
|
|
||||||
//done();
|
|
||||||
//});
|
|
||||||
var flow = [ { id:"n1", type:"e-mail", name:"emailout", outserver:"smtp.gmail.com", outport:"465", wires:[[]] } ];
|
|
||||||
helper.load(emailNode, flow, function() {
|
|
||||||
var n1 = helper.getNode("n1");
|
|
||||||
n1.should.have.property('name', "emailout");
|
|
||||||
n1.emit("input", {payload:"Hello World"});
|
|
||||||
//done();
|
|
||||||
});
|
|
||||||
setTimeout(function() {
|
|
||||||
try {
|
|
||||||
var logEvents = helper.log().args.filter(function(evt) {
|
|
||||||
return evt[0].type == "e-mail";
|
|
||||||
});
|
|
||||||
//console.log(logEvents);
|
|
||||||
logEvents.should.have.length(1);
|
|
||||||
logEvents[0][0].should.have.a.property('msg');
|
|
||||||
logEvents[0][0].msg.toString().should.startWith("Error: connect ECONNREFUSED");
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
catch(e) { done(e); }
|
|
||||||
//finally { smtpTransport.sendMail.restore(); }
|
|
||||||
},150);
|
|
||||||
})
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
describe.skip('email in', function() {
|
|
||||||
|
|
||||||
it('should load with defaults', function(done) {
|
|
||||||
var flow = [ { id:"n1", type:"e-mail in", wires:[["n2"]] },
|
|
||||||
{id:"n2", type:"helper"} ];
|
|
||||||
helper.load(emailNode, flow, function() {
|
helper.load(emailNode, flow, function() {
|
||||||
var n1 = helper.getNode("n1");
|
var n1 = helper.getNode("n1");
|
||||||
|
n1.should.have.property('name', "emailin");
|
||||||
n1.should.have.property("repeat", 300000);
|
n1.should.have.property("repeat", 300000);
|
||||||
n1.should.have.property("inserver", "imap.gmail.com");
|
n1.should.have.property("inserver", "imap.gmail.com");
|
||||||
n1.should.have.property("inport", "993");
|
n1.should.have.property("inport", "993");
|
||||||
@ -104,4 +61,46 @@ describe('email Node', function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('email out', function() {
|
||||||
|
|
||||||
|
it('should load with defaults', function(done) {
|
||||||
|
var flow = [ { id:"n1", type:"e-mail", name:"emailout", wires:[[]] } ];
|
||||||
|
helper.load(emailNode, flow, function() {
|
||||||
|
var n1 = helper.getNode("n1");
|
||||||
|
n1.should.have.property('name', "emailout");
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should fail to send an email (no valid creds)', function(done) {
|
||||||
|
var smtpTransport = require("nodemailer").createTransport();
|
||||||
|
//var spy = sinon.stub(smtpTransport, 'sendMail', function(arg1,arg2,arg3,arg4) {
|
||||||
|
//console.log("HELLO");
|
||||||
|
//console.log(arg1,arg2,arg3,arg4);
|
||||||
|
//done();
|
||||||
|
//});
|
||||||
|
var flow = [ { id:"n1", type:"e-mail", name:"emailout", outserver:"smtp.gmail.com", outport:"465", wires:[[]] } ];
|
||||||
|
helper.load(emailNode, flow, function() {
|
||||||
|
var n1 = helper.getNode("n1");
|
||||||
|
n1.should.have.property('name', "emailout");
|
||||||
|
n1.emit("input", {payload:"Hello World"});
|
||||||
|
//done();
|
||||||
|
});
|
||||||
|
setTimeout(function() {
|
||||||
|
try {
|
||||||
|
var logEvents = helper.log().args.filter(function(evt) {
|
||||||
|
return evt[0].type == "e-mail";
|
||||||
|
});
|
||||||
|
//console.log(logEvents);
|
||||||
|
//logEvents.should.have.length(3);
|
||||||
|
logEvents[0][0].should.have.a.property('msg');
|
||||||
|
logEvents[0][0].msg.toString().should.startWith("email.errors.nouserid");
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
catch(e) { done(e); }
|
||||||
|
//finally { smtpTransport.sendMail.restore(); }
|
||||||
|
}, 1000);
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
node-red-node-daemon
|
node-red-node-daemon
|
||||||
====================
|
====================
|
||||||
|
|
||||||
A <a href="http://nodered.org" target="_new">Node-RED</a> node that runs and monitors a long running system command.
|
A <a href="http://nodered.org" target="_new">Node-RED</a> node that runs and
|
||||||
|
monitors a long running system command.
|
||||||
|
|
||||||
Similar to the **exec** node - but this calls the command at start time and then pipes any input to the node to the STDIN of the running command, and feeds any STDOUT to the first output.
|
Similar to the **exec** node - but this calls the command at start time and
|
||||||
|
then pipes any input to the node to the STDIN of the running command, and feeds
|
||||||
|
any STDOUT to the first output.
|
||||||
|
|
||||||
Useful for monitoring command line based processes.
|
Useful for monitoring command line based processes.
|
||||||
|
|
||||||
@ -20,10 +23,18 @@ Usage
|
|||||||
|
|
||||||
Calls out to a long running system command. Sends <b>msg.payload</b> to stdin of the process.
|
Calls out to a long running system command. Sends <b>msg.payload</b> to stdin of the process.
|
||||||
|
|
||||||
Provides 3 outputs... stdout, stderr, and return code, from the running command.
|
**Note** Only the command itself should be placed in the command field.
|
||||||
|
All parameters **must** be placed in the arguments field.
|
||||||
|
|
||||||
If the called program stops (i.e. a return code is produced), this node can attempt to restart the command.
|
The command provides 3 outputs... stdout, stderr, and return code, from the running command.
|
||||||
|
|
||||||
**Note :** when you stop Node-RED running we may not get a chance to kill the called program so it may remain running. You <i>may</i> have to kill it manually.
|
If the called program stops (i.e. a return code is produced), this node can attempt
|
||||||
|
to restart the command automatically.
|
||||||
|
|
||||||
For example I have used it to run and then monitor the <a href="https://github.com/antirez/dump1090" target ="_new">dump1090</a> plane spotter, and also to interact with various python apps that everyone seem to write these days :-)
|
**Note :** when you stop Node-RED running we may not get a chance to kill the
|
||||||
|
called program so it may remain running. You <i>may</i> have to kill it manually.
|
||||||
|
|
||||||
|
For example it can be used to run and then monitor the
|
||||||
|
<a href="https://github.com/antirez/dump1090" target="_new">dump1090</a> plane
|
||||||
|
spotter, and also to interact with various python apps that everyone seem to write
|
||||||
|
these days :-)
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<input type="text" id="node-input-command" placeholder="command">
|
<input type="text" id="node-input-command" placeholder="command">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-args"><i class="fa fa-list"></i> Args</label>
|
<label for="node-input-args"><i class="fa fa-list"></i> Arguments</label>
|
||||||
<input type="text" id="node-input-args" placeholder="space separated arguments">
|
<input type="text" id="node-input-args" placeholder="space separated arguments">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -45,6 +45,8 @@
|
|||||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-tips"><b>Note:</b> The command should just be the actual command.
|
||||||
|
All parameters should be passed in as arguments.</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/x-red" data-help-name="daemon">
|
<script type="text/x-red" data-help-name="daemon">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-daemon",
|
"name" : "node-red-node-daemon",
|
||||||
"version" : "0.0.2",
|
"version" : "0.0.3",
|
||||||
"description" : "A Node-RED node that runs and monitors a long running system command.",
|
"description" : "A Node-RED node that runs and monitors a long running system command.",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user