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
19
.travis.yml
19
.travis.yml
@ -1,14 +1,15 @@
|
||||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.10"
|
||||
- "0.12"
|
||||
before_install:
|
||||
- npm install -g npm@~1.4.18
|
||||
- npm install -g npm@~1.4.28
|
||||
before_script:
|
||||
- npm install -g istanbul
|
||||
- npm install coveralls
|
||||
- npm install node-red
|
||||
#- npm install git+https://github.com/node-red/node-red.git
|
||||
- export NODE_RED_HOME=`pwd`/node_modules/node-red
|
||||
- (cd $NODE_RED_HOME ; npm install nock@~0.48.0 )
|
||||
- npm install -g istanbul grunt-cli
|
||||
- npm install coveralls
|
||||
- npm install git+https://github.com/node-red/node-red.git
|
||||
- export NODE_RED_HOME=`pwd`/node_modules/node-red
|
||||
- (cd $NODE_RED_HOME ; npm install nock@~0.48.0)
|
||||
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
|
||||
////"unused": true, // Check for unused functions
|
||||
////"forin":false, // turn off check for "for (x in y...)"
|
||||
"reporter": require('jshint-stylish')
|
||||
//"reporter": require('jshint-stylish')
|
||||
},
|
||||
all: {
|
||||
src: ['*/*.js','*/*/*.js'],
|
||||
@ -59,8 +59,8 @@ module.exports = function(grunt) {
|
||||
inlinelint: {
|
||||
html: ['*/*/*.html'],
|
||||
options: {
|
||||
jshintrc: ".jshintrc",
|
||||
reporter: require('jshint-stylish')
|
||||
jshintrc: ".jshintrc"
|
||||
//,reporter: require('jshint-stylish')
|
||||
}
|
||||
},
|
||||
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.
|
||||
|
||||
**Note** : This is the same node as is/was in the core of Node-RED. If you already
|
||||
have it installed you do NOT need this node. However it will be deprecated from
|
||||
the core in due course, at which point you will need to install it from here if
|
||||
still required.
|
||||
**Note** : This is the same node as was in the core of Node-RED.
|
||||
As of v0.10.8 you will need to install it from here if still required.
|
||||
|
||||
Install
|
||||
-------
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"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",
|
||||
"dependencies" : {
|
||||
"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");
|
||||
you may not use this file except in compliance with the License.
|
||||
@ -14,92 +14,62 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
|
||||
<!-- First, the content of the edit dialog is defined. -->
|
||||
|
||||
<script type="text/x-red" data-template-name="sensorTag">
|
||||
<!-- data-template-name identifies the node type this is for -->
|
||||
|
||||
<!-- Each of the following divs creates a field in the edit dialog. -->
|
||||
<!-- Generally, there should be an input for each property of the node. -->
|
||||
<!-- The for and id attributes identify the corresponding property -->
|
||||
<!-- (with the 'node-input-' prefix). -->
|
||||
<!-- The available icon classes are defined in Twitter Bootstrap -->
|
||||
|
||||
<!-- By convention, most nodes have a 'name' property. The following div -->
|
||||
<!-- provides the necessary field. -->
|
||||
<div class="form-row">
|
||||
<label for="node-input-uuid"><i class="fa fa-ellipsis-h"></i> UUID</label>
|
||||
<input type="text" id="node-input-uuid" placeholder="optional device bluetooth id">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-external-link"></i> Outputs</label>
|
||||
<input type="checkbox" id="node-input-humidity" style="display: inline-block; width: auto; vertical-align: top;"> Temperature and Humidity<br/>
|
||||
<label> </label>
|
||||
<input type="checkbox" id="node-input-temperature" style="display: inline-block; width: auto; vertical-align: top;"> IR Temperature<br/>
|
||||
<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">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</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>
|
||||
|
||||
|
||||
<!-- Next, some simple help text is provided for the node. -->
|
||||
<script type="text/x-red" data-help-name="sensorTag">
|
||||
<!-- data-help-name identifies the node type this help is for -->
|
||||
<!-- This content appears in the Info sidebar when a node is selected -->
|
||||
<!-- The first <p> is used as the pop-up tool tip when hovering over a -->
|
||||
<!-- node in the palette. -->
|
||||
<p>Input node for the Ti SensorTag</p>
|
||||
<p>For this node to work correctly Node-Red needs to be run as <i>root</i>
|
||||
, this due to how Bluetooth 4.0 support is currently implemented in
|
||||
Linux</p>
|
||||
<p>The UUID field is the mac address of the sensor tag, this is optional
|
||||
can be used to bind to a specific SensorTag if you have more than one
|
||||
active in range at the same time. (note you can only have one SensorTag
|
||||
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>Node to read from the Ti SensorTag</p>
|
||||
<p>For this node to work correctly on Linux, Node-Red needs to be run as
|
||||
<i>root</i>, this due to how Bluetooth 4.0 support is currently implemented
|
||||
in Linux.</p>
|
||||
<p>The UUID field is the bluetooth mac address of the sensor tag, this is optional
|
||||
and can be used to bind to a specific SensorTag if you have more than one
|
||||
active in range at the same time. <b>Note</b>: you can only have one SensorTag
|
||||
per node-red instance at the moment.</p>
|
||||
<p>The topic setting is a prefix that will be pre-pended to the name of the
|
||||
sensor that creates the reading. e.g. <i>sensorTag/temperature</i>. If
|
||||
blank it will be set to the UUID of the sensor tag.</p>
|
||||
<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
|
||||
will work.</p>
|
||||
</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">
|
||||
RED.nodes.registerType('sensorTag',{
|
||||
category: 'advanced-function', // the palette category
|
||||
category: 'advanced-function',
|
||||
color:"GoldenRod",
|
||||
defaults: { // defines the editable properties of the node
|
||||
name: {value:"sensorTag"}, // along with default values.
|
||||
defaults: {
|
||||
name: {value:"sensorTag"},
|
||||
topic: {value:"sensorTag"},
|
||||
uuid: {value:undefined},
|
||||
temperature: {value:true},
|
||||
@ -108,21 +78,22 @@
|
||||
magnetometer: {value:true},
|
||||
accelerometer: {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
|
||||
outputs:1, // set the number of outputs - 0 to n
|
||||
icon: "bluetooth.png", // set the icon (held in public/icons)
|
||||
label: function() { // sets the default label contents
|
||||
inputs:0,
|
||||
outputs:1,
|
||||
icon: "bluetooth.png",
|
||||
label: function() {
|
||||
return this.name||this.topic||"sensorTag";
|
||||
},
|
||||
labelStyle: function() { // sets the class to apply to the label
|
||||
labelStyle: function() {
|
||||
return this.name?"node_label_italic":"";
|
||||
},
|
||||
oneditsave: function() {
|
||||
var mac = $("#node-input-uuid").val();
|
||||
mac = mac.toLowerCase();
|
||||
//nasty hack as I can't get global replace to work
|
||||
// nasty hack as I can't get global replace to work
|
||||
mac = mac.replace(/:/gi,'');
|
||||
mac = mac.replace(/:/gi,'');
|
||||
mac = mac.replace(/:/gi,'');
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013 IBM Corp.
|
||||
* Copyright 2014,2015 IBM Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -14,129 +14,149 @@
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
// Require main module
|
||||
var RED = require(process.env.NODE_RED_HOME+"/red/red");
|
||||
var SensorTag = require('sensortag');
|
||||
module.exports = function(RED) {
|
||||
"use strict";
|
||||
var SensorTag = require("sensortag");
|
||||
|
||||
// The main node definition - most things happen in here
|
||||
function sensorTagNode(n) {
|
||||
RED.nodes.createNode(this,n);
|
||||
this.name = n.name;
|
||||
this.topic = n.topic;
|
||||
this.uuid = n.uuid;
|
||||
this.temperature = n.temperature;
|
||||
this.pressure = n.pressure;
|
||||
this.humidity = n.humidity;
|
||||
this.accelerometer = n.accelerometer;
|
||||
this.magnetometer = n.magnetometer;
|
||||
this.gyroscope = n.gyroscope;
|
||||
this.keys = n.keys;
|
||||
function SensorTagNode(n) {
|
||||
RED.nodes.createNode(this,n);
|
||||
this.name = n.name;
|
||||
this.topic = n.topic;
|
||||
this.uuid = n.uuid;
|
||||
this.temperature = n.temperature;
|
||||
this.pressure = n.pressure;
|
||||
this.humidity = n.humidity;
|
||||
this.accelerometer = n.accelerometer;
|
||||
this.magnetometer = n.magnetometer;
|
||||
this.gyroscope = n.gyroscope;
|
||||
this.luxometer = n.luxometer;
|
||||
this.keys = n.keys;
|
||||
if (this.uuid === "") { this.uuid = undefined; }
|
||||
var node = this;
|
||||
|
||||
if (this.uuid === "") {
|
||||
this.uuid = undefined;
|
||||
}
|
||||
//console.log(this.uuid);
|
||||
if ( typeof node.stag === "undefined") {
|
||||
SensorTag.discover(function(sensorTag) {
|
||||
node.stag = sensorTag;
|
||||
//console.log(sensorTag);
|
||||
node.log("connected " + sensorTag._peripheral.uuid);
|
||||
node.topic = node.topic || sensorTag._peripheral.uuid;
|
||||
sensorTag.connect(function() {
|
||||
//console.log("connected");
|
||||
sensorTag.discoverServicesAndCharacteristics(function() {
|
||||
sensorTag.enableIrTemperature(function() {});
|
||||
sensorTag.on('irTemperatureChange',
|
||||
function(objectTemperature, ambientTemperature) {
|
||||
var msg = {'topic': node.topic + '/temperature'};
|
||||
msg.payload = {'object': +objectTemperature.toFixed(1),
|
||||
'ambient': +ambientTemperature.toFixed(1)
|
||||
};
|
||||
node.send(msg);
|
||||
});
|
||||
sensorTag.enableBarometricPressure(function() {});
|
||||
sensorTag.on('barometricPressureChange', function(pressure) {
|
||||
var msg = {'topic': node.topic + '/pressure'};
|
||||
msg.payload = {'pressure': parseInt(pressure)};
|
||||
node.send(msg);
|
||||
});
|
||||
sensorTag.enableHumidity(function() {});
|
||||
sensorTag.on('humidityChange', function(temp, humidity) {
|
||||
var msg = {'topic': node.topic + '/humidity'};
|
||||
msg.payload = {'temperature': +temp.toFixed(1),
|
||||
'humidity': +humidity.toFixed(1)
|
||||
};
|
||||
node.send(msg);
|
||||
});
|
||||
sensorTag.enableAccelerometer(function() {});
|
||||
sensorTag.on('accelerometerChange', function(x,y,z) {
|
||||
var msg = {'topic': node.topic + '/accelerometer'};
|
||||
msg.payload = {'x': +x.toFixed(2), 'y': +y.toFixed(2), 'z': +z.toFixed(2)};
|
||||
node.send(msg);
|
||||
});
|
||||
sensorTag.enableMagnetometer(function() {});
|
||||
sensorTag.on('magnetometerChange', function(x,y,z) {
|
||||
var msg = {'topic': node.topic + '/magnetometer'};
|
||||
msg.payload = {'x': +x.toFixed(2), 'y': +y.toFixed(2), 'z': +z.toFixed(2)};
|
||||
node.send(msg);
|
||||
});
|
||||
sensorTag.enableGyroscope(function() {});
|
||||
sensorTag.on('gyroscopeChange', function(x,y,z) {
|
||||
var msg = {'topic': node.topic + '/gyroscope'};
|
||||
msg.payload = {'x': +x.toFixed(2), 'y': +y.toFixed(2), 'z': +z.toFixed(2)};
|
||||
node.send(msg);
|
||||
});
|
||||
sensorTag.on('simpleKeyChange', function(left, right, mag) {
|
||||
var msg = {'topic': node.topic + '/keys'};
|
||||
msg.payload = {'left': left, 'right': right, 'magnet': mag};
|
||||
node.send(msg);
|
||||
});
|
||||
|
||||
var node=this;
|
||||
sensorTag.on('luxometerChange', function(lux) {
|
||||
var msg = {'topic': node.topic + '/luxometer'};
|
||||
msg.payload = {'lux': parseInt(lux)};
|
||||
node.send(msg);
|
||||
});
|
||||
enable(node);
|
||||
});
|
||||
});
|
||||
},node.uuid);
|
||||
} else {
|
||||
console.log("reconfig",node.uuid);
|
||||
enable(node);
|
||||
}
|
||||
|
||||
if ( typeof node.stag == "undefined") {
|
||||
//console.log("starting");
|
||||
SensorTag.discover(function(sensorTag) {
|
||||
node.stag = sensorTag;
|
||||
sensorTag.connect(function() {
|
||||
//console.log("connected");
|
||||
sensorTag.discoverServicesAndCharacteristics(function() {
|
||||
sensorTag.enableIrTemperature(function() {});
|
||||
sensorTag.on('irTemperatureChange',
|
||||
function(objectTemperature, ambientTemperature) {
|
||||
var msg = {'topic': node.topic + '/temperature'};
|
||||
msg.payload = {'object': objectTemperature.toFixed(1),
|
||||
'ambient':ambientTemperature.toFixed(1)
|
||||
};
|
||||
node.send(msg);
|
||||
});
|
||||
sensorTag.enableBarometricPressure(function() {});
|
||||
sensorTag.on('barometricPressureChange', function(pressure) {
|
||||
var msg = {'topic': node.topic + '/pressure'};
|
||||
msg.payload = {'pres': pressure.toFixed(1)};
|
||||
node.send(msg);
|
||||
});
|
||||
sensorTag.enableHumidity(function() {});
|
||||
sensorTag.on('humidityChange', function(temp, humidity) {
|
||||
var msg = {'topic': node.topic + '/humidity'};
|
||||
msg.payload = {'temp': temp.toFixed(1),
|
||||
'humidity': humidity.toFixed(1)
|
||||
};
|
||||
node.send(msg);
|
||||
});
|
||||
sensorTag.enableAccelerometer(function() {});
|
||||
sensorTag.on('accelerometerChange', function(x,y,z) {
|
||||
var msg = {'topic': node.topic + '/accelerometer'};
|
||||
msg.payload = {'x': x, 'y': y, 'z': z};
|
||||
node.send(msg);
|
||||
});
|
||||
sensorTag.enableMagnetometer(function() {});
|
||||
sensorTag.on('magnetometerChange', function(x,y,z) {
|
||||
var msg = {'topic': node.topic + '/magnetometer'};
|
||||
msg.payload = {'x': x, 'y': y, 'z': z};
|
||||
node.send(msg);
|
||||
});
|
||||
sensorTag.enableGyroscope(function() {});
|
||||
sensorTag.on('gyroscopeChange', function(x,y,z) {
|
||||
var msg = {'topic': node.topic + '/gyroscope'};
|
||||
msg.payload = {'x': x, 'y': y, 'z': z};
|
||||
node.send(msg);
|
||||
});
|
||||
sensorTag.on('simpleKeyChange', function(left, right) {
|
||||
var msg = {'topic': node.topic + '/keys'};
|
||||
msg.payload = {'left': left, 'right': right};
|
||||
node.send(msg);
|
||||
});
|
||||
enable(node);
|
||||
});
|
||||
this.on("close", function() {
|
||||
if (node.stag) {
|
||||
node.stag.disconnect(function() { node.log("disconnected ",node.uuid); });
|
||||
}
|
||||
});
|
||||
},node.uuid);
|
||||
} else {
|
||||
//console.log("reconfig");
|
||||
enable(node);
|
||||
}
|
||||
}
|
||||
|
||||
function enable(node) {
|
||||
if (node.temperature) {
|
||||
node.stag.notifyIrTemperature(function() {});
|
||||
} else {
|
||||
node.stag.unnotifyIrTemperature(function() {});
|
||||
}
|
||||
if (node.pressure) {
|
||||
node.stag.notifyBarometricPressure(function() {});
|
||||
} else {
|
||||
node.stag.unnotifyBarometricPressure(function() {});
|
||||
}
|
||||
if (node.humidity) {
|
||||
node.stag.notifyHumidity(function() {});
|
||||
} else {
|
||||
node.stag.unnotifyHumidity(function() {});
|
||||
}
|
||||
if (node.accelerometer) {
|
||||
node.stag.notifyAccelerometer(function() {});
|
||||
} else {
|
||||
node.stag.unnotifyAccelerometer(function() {});
|
||||
}
|
||||
if (node.magnetometer) {
|
||||
node.stag.notifyMagnetometer(function() {});
|
||||
} else {
|
||||
node.stag.unnotifyMagnetometer(function() {});
|
||||
}
|
||||
if (node.gyroscope) {
|
||||
node.stag.notifyGyroscope(function() {});
|
||||
} else {
|
||||
node.stag.unnotifyGyroscope(function() {});
|
||||
}
|
||||
if (node.keys) {
|
||||
node.stag.notifySimpleKey(function() {});
|
||||
} else {
|
||||
node.stag.unnotifySimpleKey(function() {});
|
||||
var enable = function(node) {
|
||||
if (node.temperature) {
|
||||
node.stag.notifyIrTemperature(function() {});
|
||||
} else {
|
||||
node.stag.unnotifyIrTemperature(function() {});
|
||||
}
|
||||
if (node.pressure) {
|
||||
node.stag.notifyBarometricPressure(function() {});
|
||||
} else {
|
||||
node.stag.unnotifyBarometricPressure(function() {});
|
||||
}
|
||||
if (node.humidity) {
|
||||
node.stag.notifyHumidity(function() {});
|
||||
} else {
|
||||
node.stag.unnotifyHumidity(function() {});
|
||||
}
|
||||
if (node.accelerometer) {
|
||||
node.stag.notifyAccelerometer(function() {});
|
||||
} else {
|
||||
node.stag.unnotifyAccelerometer(function() {});
|
||||
}
|
||||
if (node.magnetometer) {
|
||||
node.stag.notifyMagnetometer(function() {});
|
||||
} else {
|
||||
node.stag.unnotifyMagnetometer(function() {});
|
||||
}
|
||||
if (node.gyroscope) {
|
||||
node.stag.notifyGyroscope(function() {});
|
||||
} else {
|
||||
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) {
|
||||
node.stag.notifySimpleKey(function() {});
|
||||
} else {
|
||||
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.
|
||||
|
||||
The SensorTag is a Bluetooth LE device hosting the following sensors:
|
||||
* Ambient & ir Temperature
|
||||
* Barometric Pressure
|
||||
* Humidity
|
||||
* 3 axis Accelerometer
|
||||
* 3 axis Magnetometer
|
||||
* 3 axis Gyroscope
|
||||
* 2 push Buttons
|
||||
|
||||
The config node allows the user to enable/disable any of the sensors listed above. The readings from
|
||||
* Humidity and Temperature
|
||||
* Ambient & IR Temperatures
|
||||
* Barometric Pressure
|
||||
* 3 axis Accelerometer
|
||||
* 3 axis Gyroscope
|
||||
* 3 axis Magnetometer
|
||||
* 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
|
||||
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} }
|
||||
* Accelerometer - { topic: [topic_prefix]/ , payload: { x:0.0, y:9.8, z:0.0 } }
|
||||
* Magnetometer - { topic: [topic_prefix]/ , payload: { x:0.0, y:0.0, z:0.0 } }
|
||||
* Gyroscope - { topic: [topic_prefix]/ , payload: { x:0.0, y:0.0, z:0.0 } }
|
||||
* Buttons - { topic: [topic_prefix]/ , payload: { left: "down", right: "up"} }
|
||||
* Temperature - { topic: [topic_prefix]/temperature, payload: { ambient: 21.2, object: 33.0 } }
|
||||
* Barometric Pressure - { topic: [topic_prefix]/pressure, payload: { pres: 1000 } }
|
||||
* Accelerometer - { topic: [topic_prefix]/accelerometer , payload: { x:0.0, y:9.8, z:0.0 } }
|
||||
* 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",
|
||||
"description": "A Node-RED node to read data from a TI SensorTag",
|
||||
"version": "0.0.3",
|
||||
"version": "0.0.7",
|
||||
"keywords" : ["node-red","sensortag"],
|
||||
"dependencies": {
|
||||
"sensortag" : "0.1.9"
|
||||
"sensortag": "~1.1.0"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"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.
|
||||
|
||||
**Note** : This is the same node as is/was in the core of Node-RED. If you already
|
||||
have it installed you do NOT need this node.
|
||||
**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.
|
||||
|
||||
Install
|
||||
-------
|
||||
@ -12,7 +12,7 @@ Install
|
||||
Run the following command in the root directory of your Node-RED install, usually
|
||||
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.
|
||||
These may look like failures... as they report as failure to compile errors -
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "node-red-node-serialport",
|
||||
"version" : "0.0.1",
|
||||
"version" : "0.0.3",
|
||||
"description" : "Node-RED nodes to talk to an serial port",
|
||||
"dependencies" : {
|
||||
"serialport" : "1.7.*"
|
||||
|
20
package.json
20
package.json
@ -17,17 +17,15 @@
|
||||
],
|
||||
"devDependencies": {
|
||||
"grunt": "0.4.5",
|
||||
"grunt-cli": "0.1.13",
|
||||
"grunt-simple-mocha": "0.4.0",
|
||||
"grunt-contrib-jshint": "0.11.0",
|
||||
"grunt-lint-inline": "0.4.3",
|
||||
"grunt-jscs": "0.8.*",
|
||||
"jshint-stylish": "1.0.1",
|
||||
"mocha": "2.1.0",
|
||||
"should": "4.6.5",
|
||||
"sinon": "1.12.2",
|
||||
"supertest": "0.15.0",
|
||||
"proxyquire": "1.4.0",
|
||||
"grunt-contrib-jshint": "0.11.2",
|
||||
"grunt-lint-inline": "0.4.4",
|
||||
"grunt-jscs": "1.8.*",
|
||||
"mocha": "2.2.5",
|
||||
"should": "7.0.1",
|
||||
"sinon": "1.15.4",
|
||||
"supertest": "1.0.1",
|
||||
"proxyquire": "1.6.0",
|
||||
"pushbullet": "1.4.*",
|
||||
"when": "^3.6.4",
|
||||
"exif": "0.4.0",
|
||||
@ -36,6 +34,6 @@
|
||||
"imap" : "0.8.14"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8 <0.11"
|
||||
"node": ">=0.8"
|
||||
}
|
||||
}
|
||||
|
@ -25,12 +25,18 @@ module.exports = function(RED) {
|
||||
if (dweetio == null) { dweetio = new DweetClient(); }
|
||||
var node = this;
|
||||
|
||||
var isObject = function(a) {
|
||||
return (!!a) && (a.constructor === Object);
|
||||
};
|
||||
|
||||
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;
|
||||
try {
|
||||
dweetio.dweet_for(thing, {payload:msg.payload}, function(err, dweet) {
|
||||
//console.log(dweet.thing); // "my-thing"
|
||||
dweetio.dweet_for(thing, msg.payload, function(err, dweet) {
|
||||
//console.log(dweet.thing); // "my-thing"
|
||||
//console.log(dweet.content); // The content of the dweet
|
||||
//console.log(dweet.created); // The create date of the dweet
|
||||
});
|
||||
@ -38,7 +44,6 @@ module.exports = function(RED) {
|
||||
catch (err) {
|
||||
node.log(err);
|
||||
}
|
||||
//} else { node.warn("Dweetio only sends payload objects."); }
|
||||
});
|
||||
|
||||
}
|
||||
@ -53,7 +58,7 @@ module.exports = function(RED) {
|
||||
dweetio.listen_for(node.thing, function(dweet) {
|
||||
// This will be called anytime there is a new dweet for my-thing
|
||||
if (dweet.content.hasOwnProperty("payload")) {
|
||||
dweet.payload=dweet.content.payload;
|
||||
dweet.payload = dweet.content.payload;
|
||||
} else {
|
||||
dweet.payload = dweet.content;
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"name" : "node-red-node-dweetio",
|
||||
"version" : "0.0.5",
|
||||
"version" : "0.0.4",
|
||||
"description" : "A Node-RED node to send and receive simple dweets",
|
||||
"dependencies" : {
|
||||
"node-dweetio" : "0.0.11"
|
||||
"node-dweetio" : "0.0.12"
|
||||
},
|
||||
"repository" : {
|
||||
"type":"git",
|
||||
|
@ -127,8 +127,8 @@ module.exports = function(RED) {
|
||||
RED.nodes.createNode(this,n);
|
||||
this.name = n.name;
|
||||
this.repeat = n.repeat * 1000 || 300000;
|
||||
this.inserver = n.server || globalkeys.server || "imap.gmail.com";
|
||||
this.inport = n.port || globalkeys.port || "993";
|
||||
this.inserver = n.server || (globalkeys && globalkeys.server) || "imap.gmail.com";
|
||||
this.inport = n.port || (globalkeys && globalkeys.port) || "993";
|
||||
this.box = n.box || "INBOX";
|
||||
var flag = false;
|
||||
|
||||
@ -201,9 +201,9 @@ module.exports = function(RED) {
|
||||
stream.on('end', function() {
|
||||
if (info.which !== 'TEXT') {
|
||||
var head = Imap.parseHeader(buffer);
|
||||
pay.from = head.from[0];
|
||||
pay.topic = head.subject[0];
|
||||
pay.date = head.date[0];
|
||||
if (head.hasOwnProperty("from")) { pay.from = head.from[0]; }
|
||||
if (head.hasOwnProperty("subject")) { pay.topic = head.subject[0]; }
|
||||
if (head.hasOwnProperty("date")) { pay.date = head.date[0]; }
|
||||
pay.header = head;
|
||||
} else {
|
||||
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.
|
||||
|
||||
**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
|
||||
-------------
|
||||
|
@ -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.
|
||||
|
||||
**Note** : This is the same node as is/was in the core of Node-RED. If you already
|
||||
have it installed you do NOT need this node. However it will be deprecated from
|
||||
the core in due course, at which point you will need to install it from here if
|
||||
still required.
|
||||
**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.
|
||||
|
||||
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.
|
||||
|
||||
**Note** : This is the same node as is/was in the core of Node-RED. If you already
|
||||
have it installed you do NOT need this node. However it will be deprecated from
|
||||
the core in due course, at which point you will need to install it from here if
|
||||
still required.
|
||||
**Note** : This is the same node as was in the core of Node-RED.
|
||||
As of v0.10.8 you will need to install it from here if still required.
|
||||
|
||||
Install
|
||||
-------
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "node-red-node-irc",
|
||||
"version" : "0.0.2",
|
||||
"version" : "0.0.3",
|
||||
"description" : "A Node-RED node to talk to an IRC server",
|
||||
"dependencies" : {
|
||||
"irc" : "0.3.11"
|
||||
|
@ -19,6 +19,10 @@
|
||||
<label for="node-input-title"><i class="fa fa-flag"></i> Title</label>
|
||||
<input type="text" id="node-input-title" placeholder="Node-RED">
|
||||
</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">
|
||||
<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;">
|
||||
@ -36,13 +40,15 @@
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</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/>
|
||||
Only supports priorities 2, 1, 0, and -1.</div>
|
||||
<div class="form-tips" id="node-tip">Tip: Leave title blank to set using <b>msg.topic</b>.<br/>
|
||||
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 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>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>Uses Pushover. See <i><a href="https://pushover.net" target="_new">this link</a></i> for more details.</p>
|
||||
</script>
|
||||
@ -51,8 +57,9 @@
|
||||
RED.nodes.registerType('pushover',{
|
||||
category: 'output',
|
||||
defaults: {
|
||||
title: {value:""},
|
||||
name: {value:""},
|
||||
device: {value:""},
|
||||
title: {value:""},
|
||||
priority: {value:0}
|
||||
},
|
||||
credentials: {
|
||||
@ -72,7 +79,7 @@
|
||||
},
|
||||
oneditprepare: function() {
|
||||
$("#node-input-priority").spinner({
|
||||
min:-1,
|
||||
min:-2,
|
||||
max:2
|
||||
});
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ module.exports = function(RED) {
|
||||
function PushoverNode(n) {
|
||||
RED.nodes.createNode(this,n);
|
||||
this.title = n.title;
|
||||
this.device = n.device;
|
||||
this.priority = n.priority;
|
||||
var credentials = this.credentials;
|
||||
if ((credentials) && (credentials.hasOwnProperty("pushkey"))) { this.pushkey = credentials.pushkey; }
|
||||
@ -43,9 +44,10 @@ module.exports = function(RED) {
|
||||
this.on("input",function(msg) {
|
||||
var titl = this.title || msg.topic || "Node-RED";
|
||||
var pri = this.priority || msg.priority || 0;
|
||||
var dev = this.device || msg.device;
|
||||
if (isNaN(pri)) {pri=0;}
|
||||
if (pri > 2) {pri = 2;}
|
||||
if (pri < -1) {pri = -1;}
|
||||
if (pri < -2) {pri = -2;}
|
||||
if (typeof(msg.payload) === 'object') {
|
||||
msg.payload = JSON.stringify(msg.payload);
|
||||
}
|
||||
@ -58,7 +60,8 @@ module.exports = function(RED) {
|
||||
retry: 30,
|
||||
expire: 600
|
||||
};
|
||||
//console.log("Sending",pushmsg);
|
||||
if (dev) { pushmsg.device = dev; }
|
||||
//node.log("Sending "+JSON.stringify(pushmsg));
|
||||
pusher.send( pushmsg, function(err, response) {
|
||||
if (err) { node.error("Pushover Error: "+err); }
|
||||
//console.log(response);
|
||||
@ -73,6 +76,6 @@ module.exports = function(RED) {
|
||||
credentials: {
|
||||
deviceid: {type:"text"},
|
||||
pushkey: {type: "password"}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -16,7 +16,8 @@ Usage
|
||||
|
||||
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.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "node-red-node-pushover",
|
||||
"version" : "0.0.4",
|
||||
"version" : "0.0.5",
|
||||
"description" : "A Node-RED node to send alerts via Pushover",
|
||||
"dependencies" : {
|
||||
"pushover-notifications" : "0.2.2"
|
||||
|
@ -39,6 +39,7 @@
|
||||
},
|
||||
exportable: false,
|
||||
oneditprepare: function() {
|
||||
var twitterConfigNodeId = this.id;
|
||||
var clickhere = this._("twitter.label.clickhere");
|
||||
var twitterID = this._("twitter.label.twitter-id");
|
||||
function showTwitterAuthStart() {
|
||||
@ -204,6 +205,8 @@
|
||||
<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
|
||||
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 type="text/javascript">
|
||||
|
@ -313,7 +313,8 @@ module.exports = function(RED) {
|
||||
form.append("media[]",msg.media,{filename:"image"});
|
||||
|
||||
} 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) {
|
||||
node.status({fill:"red",shape:"ring",text:"twitter.status.failed"});
|
||||
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.
|
||||
|
||||
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
|
||||
have it installed you do NOT need this node. However it will be deprecated from
|
||||
the core in due course, at which point you will need to install it from here if
|
||||
still required.
|
||||
**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.
|
||||
|
||||
Install
|
||||
-------
|
||||
@ -55,5 +53,6 @@ To send a Direct Message (DM) - use a payload like.
|
||||
|
||||
D {username} {message}
|
||||
|
||||
If **msg.media** exists and is a Buffer object, this node will treat it
|
||||
as an image and attach it to the tweet.</p>
|
||||
If **msg.media** exists and is a Buffer object, this node will treat it as an image and attach it to the tweet.
|
||||
|
||||
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",
|
||||
"version" : "0.1.0",
|
||||
"version" : "0.1.2",
|
||||
"description" : "A Node-RED node to talk to Twitter",
|
||||
"dependencies" : {
|
||||
"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.
|
||||
|
||||
**Note** : This is the same node as is/was in the core of Node-RED. If you already
|
||||
have it installed you do NOT need this node.
|
||||
**Note** : This is the same node as was in the core of Node-RED.
|
||||
As of v0.10.8 you will need to install it from here if still required.
|
||||
|
||||
Pre-requisite
|
||||
-------------
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "node-red-node-mongodb",
|
||||
"version" : "0.0.1",
|
||||
"version" : "0.0.2",
|
||||
"description" : "Node-RED nodes to talk to an Mongo database",
|
||||
"dependencies" : {
|
||||
"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.
|
||||
|
||||
**Note** : This is the same node as is/was in the core of Node-RED. If you already
|
||||
have it installed you do NOT need this node.
|
||||
**Note** : This is the same node as was in the core of Node-RED.
|
||||
As of v0.10.8 you will need to install it from here if still required.
|
||||
|
||||
Pre-requisite
|
||||
-------------
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"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",
|
||||
"dependencies" : {
|
||||
"redis" : "0.12.1"
|
||||
|
@ -16,11 +16,8 @@
|
||||
|
||||
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");
|
||||
//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'));
|
||||
|
||||
try {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2014 IBM Corp.
|
||||
* Copyright 2015 IBM Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (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);
|
||||
});
|
||||
|
||||
describe.skip('email out', function() {
|
||||
describe('email in', 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 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"} ];
|
||||
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', "emailin");
|
||||
n1.should.have.property("repeat", 300000);
|
||||
n1.should.have.property("inserver", "imap.gmail.com");
|
||||
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
|
||||
====================
|
||||
|
||||
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.
|
||||
|
||||
@ -20,10 +23,18 @@ Usage
|
||||
|
||||
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">
|
||||
</div>
|
||||
<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">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
@ -45,6 +45,8 @@
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</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 type="text/x-red" data-help-name="daemon">
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"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.",
|
||||
"dependencies" : {
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user