node-red-contrib-voltage_undivider
Advanced tools
Comparing version 0.7.8 to 0.8.9
{ | ||
"name": "node-red-contrib-voltage_undivider", | ||
"version": "0.7.8", | ||
"version": "0.8.9", | ||
"description": "A Node to un-divide a voltage that was divided prior to taking a reading to protect a input when reading its value.", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/meeki007/node-red-contrib-voltage_undivider", |
@@ -12,2 +12,3 @@ node-red-contrib-voltage_undivider | ||
* [Usage](#usage) | ||
* [Property](#Property) | ||
* [Voltage_In](#Voltage_In) | ||
@@ -43,3 +44,2 @@ * [Resistor_1](#Resistor_1) | ||
Be sure to send the voltage as msg.payload. After the voltage_undivider does its work the output will also be sent via msg.payload | ||
@@ -49,2 +49,7 @@ ![examplenode.png](./doc/examplenode.png) | ||
### Property | ||
Define the msg property name you wish. The name you select (msg.example) will also be the output property</p> | ||
The payload must be a number! Anything else will try to be parsed into a number and rejected if that fails. | ||
### Voltage_In | ||
@@ -110,2 +115,7 @@ | ||
version 0.8.9 | ||
Property option added to node | ||
bug fix for checks if null value | ||
version 0.7.8 | ||
@@ -112,0 +122,0 @@ updated help txt |
@@ -15,2 +15,3 @@ module.exports = function(RED) | ||
// config | ||
this.property = config.property||"payload"; | ||
this.Voltage_Input = config.Voltage_Input || "V-Volts"; | ||
@@ -29,11 +30,16 @@ this.Resistor_1Types = config.Resistor_1Types || "Ω-Ohm"; | ||
{ | ||
//clear status icon | ||
node.status({}); | ||
// if property of msg.* is not filled then set to msg.payload | ||
if (this.property == undefined) | ||
{ | ||
return this.error("msg property was not set. Please set msg propery to a non null value", msg); | ||
} | ||
//get the voltage value the user chose to pass with msg.* | ||
//get imput voltage | ||
var voltage_in = msg.payload; | ||
var voltage_in = RED.util.getMessageProperty(msg,node.property); | ||
//Make sure msg.payload is a number!! | ||
@@ -49,2 +55,4 @@ if( isNaN(voltage_in) || !isFinite(voltage_in) ) | ||
{ | ||
//send all msg along even if it faild a check | ||
RED.util.setMessageProperty(msg,node.property,voltage_in); | ||
node.send(msg); | ||
@@ -263,4 +271,4 @@ return this.error("Voltage into this node as msg.payload is not numeric! Please only send it numbers", msg); | ||
//set msg payload | ||
msg.payload = round; | ||
//set msg.* out | ||
RED.util.setMessageProperty(msg,node.property,round); | ||
//send the payload | ||
@@ -267,0 +275,0 @@ node.send(msg); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76762
231
131