1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

add host property to outgoing msg

to close #687
This commit is contained in:
Dave Conway-Jones 2020-09-15 16:12:03 +01:00
parent 4becf68848
commit d26cb057f9
No known key found for this signature in database
GPG Key ID: 302A6725C594817F
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "node-red-node-pi-gpiod",
"version": "0.0.13",
"version": "0.1.0",
"description": "A node-red node for PiGPIOd",
"dependencies" : {
"js-pigpio": "*"

View File

@ -46,13 +46,13 @@ module.exports = function(RED) {
PiGPIO.set_glitch_filter(node.pin,node.debounce);
node.status({fill:"green",shape:"dot",text:"node-red:common.status.ok"});
node.cb = PiGPIO.callback(node.pin, PiGPIO.EITHER_EDGE, function(gpio, level, tick) {
node.send({ topic:"pi/"+node.pio, payload:Number(level) });
node.send({ topic:"pi/"+node.pio, payload:Number(level), host:node.host });
node.status({fill:"green",shape:"dot",text:level});
});
if (node.read) {
setTimeout(function() {
PiGPIO.read(node.pin, function(err, level) {
node.send({ topic:"pi/"+node.pio, payload:Number(level) });
node.send({ topic:"pi/"+node.pio, payload:Number(level), host:node.host });
node.status({fill:"green",shape:"dot",text:level});
});
}, 20);