1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2025-05-13 22:06:55 +02:00

update node-red

This commit is contained in:
kev 2017-07-03 15:00:40 +08:00
parent f8a2ad006e
commit a04f905a70
3 changed files with 3 additions and 0 deletions

View File

@ -10,6 +10,7 @@ RUN set -xe \
ca-certificates \ ca-certificates \
curl \ curl \
nodejs \ nodejs \
nodejs-npm \
python3 \ python3 \
python3-dev \ python3-dev \
&& ln -sf /usr/bin/python3 /usr/bin/python \ && ln -sf /usr/bin/python3 /usr/bin/python \

View File

@ -10,6 +10,7 @@ RUN set -xe \
ca-certificates \ ca-certificates \
curl \ curl \
nodejs \ nodejs \
nodejs-npm \
python3 \ python3 \
python3-dev \ python3-dev \
&& ln -sf /usr/bin/python3 /usr/bin/python \ && ln -sf /usr/bin/python3 /usr/bin/python \

View File

@ -84,6 +84,7 @@ module.exports = function(RED) {
node.child.stdout.on('data', function (data) { node.child.stdout.on('data', function (data) {
var d = data.toString().trim().split("\n"); var d = data.toString().trim().split("\n");
for (var i = 0; i < d.length; i++) { for (var i = 0; i < d.length; i++) {
if (d[i] === '') { return; }
if (node.running && node.buttonState !== -1 && !isNaN(Number(d[i])) && node.buttonState !== d[i]) { if (node.running && node.buttonState !== -1 && !isNaN(Number(d[i])) && node.buttonState !== d[i]) {
node.send({ topic:"pi/"+node.pin, payload:Number(d[i]) }); node.send({ topic:"pi/"+node.pin, payload:Number(d[i]) });
} }