Want to install the xbee node in node-red.

858 views
Skip to first unread message

TitusRathinaraj Stalin

unread,
Aug 23, 2016, 2:42:32 PM8/23/16
to Node-RED
Dear All,

I want to install the XBee (Zigbee) node red modules to my raspberry pi3 board and getting some issue while installing via npm.

I've followed the below links.
https://github.com/jankolkmeier/NR-XBeeAPI
https://www.npmjs.com/package/node-red-contrib-zblight

pi@raspberrypi:~/.node-red $ npm install xbee-api
/home/pi/.node-red
├── node-red-con...@1.0.0
├── node-red-n...@0.0.9
├── node-red-nod...@0.3.0
└── xbee...@0.4.3

npm WARN enoent ENOENT: no such file or directory, open '/home/pi/.node-red/package.json'
npm WARN .node-red No description
npm WARN .node-red No repository field.
npm WARN .node-red No README data
npm WARN .node-red No license field.
pi@raspberrypi:~/.node-red $

What could be the problem ?

Regards,
Titus S.

Mark Setrem

unread,
Aug 23, 2016, 2:46:56 PM8/23/16
to Node-RED
I'm guessing it's exactly the same as with the other node you posted about. You using a newer version of node and npm than is currently recommended, whilst it might/probably will work if you want to avoid the messages you need to downgrade node and npm to the versions recommended in the install docs on the nodered.org website

Dave C-J

unread,
Aug 23, 2016, 2:54:18 PM8/23/16
to node...@googlegroups.com

Warn is NOT an error. So it should be working OK anyway.

Zenofmud

unread,
Aug 23, 2016, 3:28:54 PM8/23/16
to node...@googlegroups.com
I would say that the fact that the xbee-api hasn’t been updated since December of 2014, that it is out of date and the packaging is not current. However, those are warnings, so did it install?

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
For more options, visit https://groups.google.com/d/optout.

Mike Wilson

unread,
Aug 23, 2016, 4:21:28 PM8/23/16
to Node-RED
I tried to use the modules, but had stability issues.  I moved to a serial in node and some function nodes.  This has been working for 2 years now
The flow is attached.  Some of the complication is to time out on lost communication and could be removed. 
The application is a tank of water 50m away, feeding a Ground Source heat-pump.  I need to be sure of sufficient head before starting the heat-pump

[{"id":"40c1c85a.a3e938","type":"serial-port","z":"a1439b9d.3aaa2","serialport":"/dev/ttyUSBPort1","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","newline":"1000","bin":"bin","out":"time","addchar":false},{"id":"87a016d2.f6c07","type":"serial in","z":"a1439b9d.3aaa2","name":"","serial":"40c1c85a.a3e938","x":180,"y":260,"wires":[["4c63f9db.f7629","710038c6.caaee"]]},{"id":"f6044272.485008","type":"inject","z":"a1439b9d.3aaa2","name":"1 Min","topic":"TimeStamp","payload":"","payloadType":"date","repeat":"60","crontab":"","once":false,"x":170,"y":320,"wires":[["6fb08d60.780b34"]]},{"id":"928a16d0.f0ff1","type":"inject","z":"a1439b9d.3aaa2","name":"Init","topic":"Init","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"x":170,"y":360,"wires":[["6fb08d60.780b34"]]},{"id":"4c63f9db.f7629","type":"function","z":"a1439b9d.3aaa2","name":"Xbee","func":"var buf = msg.payload;\nvar quality = true;\nif (buf[0] != 0x7e) { quality = false;}\nif (buf.length != buf[2] + 4)  { quality = false;}\nif (buf[14] != 0x01) { quality = false;}\nif (buf[15] != 0x01) { quality = false;}\nif (quality){\n    msg = {};\n    msg.payload = {};\n    for (x = 0; x < 16; x++){\n        var mask = 1 << x;\n        if (buf[17] & mask){\n            dig = \"D\" + x;\n            msg.payload[dig] = 1 & (buf[20] >> x);\n        }\n        if (buf[16] & mask){\n            dig = \"D\" + (x+8);\n            msg.payload[dig] = 1 & (buf[19] >> x);\n        }\n    }\n    if (buf[18] & 1 == 1){\n        msg.payload[\"A0\"] = ((buf[21] * 256) + buf[22]); \n    }\n    msg.topic = \"FieldTank\";\n    return msg;\n}","outputs":1,"noerr":0,"x":350,"y":260,"wires":[["6fb08d60.780b34","c58588ea.ffa0e"]]},{"id":"6fb08d60.780b34","type":"function","z":"a1439b9d.3aaa2","name":"Tank Status","func":"msgLog = null;\nvar LastTopic = context.get('LastTopic')||\"\";\nvar Permit = context.get('Permit')||false;\nvar NodeStatus = context.get('NodeStatus')||'Bad';\nvar IllCount = context.get('IllCount')||0;\nif (msg.topic == 'Init'){\n    context.set('NodeStatus','Bad');\n    node.status({fill:\"red\",shape:\"ring\",text:\"Bad\"});\n    msgLog = {};\n    msgLog.payload = \"Start Bad\"\n    return [null, msgLog];\n}\nif (msg.topic == 'TimeStamp'){\n    if (LastTopic == 'TimeStamp'){\n        msg.payload = {};\n        msg.payload.link = 'XBEE Not Connected' \n        Permit = false;\n        if (NodeStatus != 'Bad'){\n            context.set('NodeStatus','Bad');\n            node.status({fill:\"red\",shape:\"ring\",text:\"Bad\"});\n            msgLog = {};\n            msgLog.payload = \"Timeout Bad\";\n        }\n        return [null, msgLog];\n    }\n    LastTopic = msg.topic;\n    context.set('LastTopic',LastTopic);\n}\nif (msg.topic == 'FieldTank'){\n    var s1 = ((msg.payload.D2 == 1) ? true : false);\n    var s2 = ((msg.payload.D4 == 1) ? true : false);\n    var s3 = ((msg.payload.D11 == 1) ? true : false);\n    var vlts = parseFloat(msg.payload.A0) * 12 / 271; \n    msgState = {};\n    msgState.payload = {};\n    msgState.payload.link = 'XBEE Connected' ;\n    var Health = true;\n    if (!s1 && !s2 && !s3){\n        msgState.payload.level = \"Empty\";\n        Health = false;\n        Permit = false;\n    } else if (s1 && !s2 && !s3){\n        msgState.payload.level = \"Low\";\n    } else if (s1 && s2 && !s3){\n        msgState.payload.level = \"Medium\";\n    } else if (s1 && s2 && s3){\n        msgState.payload.level = \"High\";\n        Permit = true;\n    } else {\n        msgState.payload.level = \"Error\";\n        Health = false;\n    }\n    if (Health){\n        IllCount = 0;\n    }else{\n        IllCount ++\n        console.log(msg.payload);\n    }\n    if (IllCount < 2){\n        if (NodeStatus != 'Good'){\n            context.set('NodeStatus','Good');\n            node.status({fill:\"green\",shape:\"dot\",text:\"Good\"});\n            msgLog = {};\n            msgLog.payload = \"Good\";\n        }\n    }else{\n        if (NodeStatus != 'Bad'){\n            context.set('NodeStatus','Bad');\n            node.status({fill:\"red\",shape:\"ring\",text:\"Bad\"});\n            msgLog = {};\n            msgLog.payload = \"Tank Bad\";\n        }\n    }\n    msgState.payload.bot = s1; \n    msgState.payload.mid = s2; \n    msgState.payload.top = s3; \n    msgState.payload.volts =  vlts;   \n    msgState.payload.permit = Permit;\n    LastTopic = 'NewMsg' ;\n    context.set('LastTopic',LastTopic);\n    context.set('Permit',Permit);\n    context.set('IllCount',IllCount);\n    return [msgState, msgLog];\n}\n","outputs":"2","noerr":0,"x":490,"y":320,"wires":[["b4023307.9be5b8","f9e8ee87.f3e6e8","bc786200.ec39a","f507d8a2.ebaf9","38141dd1.fa62c2"],["13953fcd.351fc8"]]}]

TitusRathinaraj Stalin

unread,
Aug 24, 2016, 1:17:33 PM8/24/16
to Node-RED
Thanks Mike for the flow.
Thank you so much guys!

Mark Setrem, Paul Woodard and Dave. :-)

Yes, it get installed, I didn't aware that its installed.
Thanks again.


Regards,
Titus S.

TitusRathinaraj Stalin

unread,
Aug 24, 2016, 1:52:10 PM8/24/16
to Node-RED
Hi Guys,

I am able to see the xbee modules under "node_modules" folder but not able to detect by node-red.
Here is the log.

pi@raspberrypi:~ $
pi@raspberrypi:~ $
pi@raspberrypi:~ $
pi@raspberrypi:~ $ node-red

Welcome to Node-RED
===================

24 Aug 17:47:57 - [info] Node-RED version: v0.14.6
24 Aug 17:47:57 - [info] Node.js  version: v5.12.0
24 Aug 17:47:57 - [info] Linux 4.1.18-v7+ arm LE
24 Aug 17:47:57 - [info] Loading palette nodes
24 Aug 17:47:59 - [info] UI started at /ui
24 Aug 17:48:01 - [warn] ------------------------------------------------------
24 Aug 17:48:01 - [warn] [arduino] Error: Could not locate the bindings file. Tried:
 → /home/pi/.node-red/node_modules/firmata/node_modules/serialport/build/serialport.node
 → /home/pi/.node-red/node_modules/firmata/node_modules/serialport/build/Debug/serialport.node
 → /home/pi/.node-red/node_modules/firmata/node_modules/serialport/build/Release/serialport.node
 → /home/pi/.node-red/node_modules/firmata/node_modules/serialport/out/Debug/serialport.node
 → /home/pi/.node-red/node_modules/firmata/node_modules/serialport/Debug/serialport.node
 → /home/pi/.node-red/node_modules/firmata/node_modules/serialport/out/Release/serialport.node
 → /home/pi/.node-red/node_modules/firmata/node_modules/serialport/Release/serialport.node
 → /home/pi/.node-red/node_modules/firmata/node_modules/serialport/build/default/serialport.node
 → /home/pi/.node-red/node_modules/firmata/node_modules/serialport/compiled/5.12.0/linux/arm/serialport.node
24 Aug 17:48:01 - [warn] ------------------------------------------------------
24 Aug 17:48:01 - [info] Settings file  : /home/pi/.node-red/settings.js
24 Aug 17:48:01 - [info] User directory : /home/pi/.node-red
24 Aug 17:48:01 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
24 Aug 17:48:01 - [info] Server now running at http://127.0.0.1:1880/
24 Aug 17:48:01 - [info] Waiting for missing types to be registered:
24 Aug 17:48:01 - [info]  - xbee-api in
24 Aug 17:48:01 - [info]  - xbee-api out



^C24 Aug 17:49:04 - [info] Stopping flows
pi@raspberrypi:~ $
pi@raspberrypi:~ $
pi@raspberrypi:~ $
pi@raspberrypi:~ $
pi@raspberrypi:~ $
pi@raspberrypi:~ $ cd ..
pi@raspberrypi:/home $ ls
pi
pi@raspberrypi:/home $ cd pi/
pi@raspberrypi:~ $ ls
bacnet_0_8_3_bin         Documents   i2c.py     node-bacnet-master      npm-debug.log  pid.txt       Templates
bacnet_0_8_3_bin.tar.gz  Downloads   Jesus.txt  node-bacnet-master.zip  NR-XBeeAPI     Public        Videos
Desktop                  i2c_bkp.py  Music      node_modules            Pictures       python_games  workdir
pi@raspberrypi:~ $ cd .node-red/
pi@raspberrypi:~/.node-red $ ls
build  flows_raspberrypi_cred.json  flows_raspberrypi.json  johnny-five  lib  node_modules  npm-debug.log  NR-XBee  NR-XBeeAPI  settings.js
pi@raspberrypi:~/.node-red $ cd node_modules/
pi@raspberrypi:~/.node-red/node_modules $ ls
after               chalk                 foreach                minimist                  parsejson             temporal
ansi-regex          color-convert         freakent-nodes_xbee    mqtt                      parseqs               through2
ansi-styles         commander             function-bind          mqtt-connection           parseuri              to-array
arraybuffer.slice   commist               graceful-readlink      mqtt-packet               process-nextick-args  typedarray
asn1                component-bind        has-ansi               mqtt-serial               pump                  udp-serial
async               component-emitter     has-binary             ms                        punycode              ultron
backo               component-inherit     has-cors               nan                       querystring           url
backo2              concat-stream         help-me                nanotimer                 readable-stream       utf8
base64-arraybuffer  core-util-is          i2c                    node-red-contrib-ui       reduplexer            util-deprecate
benchmark           debug                 indexof                node-red-contrib-zblight  reinterval            websocket-stream
better-assert       define-properties     inherits               node-red-node-arduino     serialport            wordwrap
bindings            duplexify             isarray                node-red-node-serialport  sf                    wrappy
bl                  ease-component        json3                  node-rsa                  skynet-serial         ws
blob                end-of-stream         jsonify                npm-debug.log             socket.io-client      xbee-api
bluebird            engine.io-client      json-stable-stringify  object.assign             socket.io-parser      xmlhttprequest-ssl
browser-serialport  engine.io-parser      leven                  object-component          split2                xtend
buffer-builder      es6-promise           lodash                 object-keys               stream-shift          yeast
buffer-reader       es6-shim              lodash.clonedeep       once                      string_decoder
buffer-shims        escape-string-regexp  lodash.debounce        optimist                  strip-ansi
callsite            firmata               meshblu                options                   supports-color
pi@raspberrypi:~/.node-red/node_modules $

What could be the problem ?
Why its not detecting by node-red ?
In node-red browser also I could not see in the left side of the panel.

Thanks for the support.

Regards,
Titus S.

TitusRathinaraj Stalin

unread,
Aug 25, 2016, 12:51:37 PM8/25/16
to Node-RED
Any help guys ?


Regards,
Titus S.

Nicholas O'Leary

unread,
Aug 25, 2016, 6:06:47 PM8/25/16
to Node-RED Mailing List
Hi Titus,

going back to the beginning here, you ran 'npm install xbee-api' in your .node-reds directory. xbee-api is a regular node.js module - it does not contain any node-red nodes.

The https://github.com/jankolkmeier/NR-XBeeAPI repo appears to be the node-red wrapper for that module which provides the nodes you are looking for. However it is very old, has not been packaged properly and has not been published to npm. You need to copy its .js/.html files into your .node-red/nodes directory and then manually install any dependencies it has - serialport and xbee-api in .node-red

If you have any issues with that, you should raise them against that repo.

Nick






--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.

TitusRathinaraj Stalin

unread,
Aug 26, 2016, 12:48:54 PM8/26/16
to Node-RED
Hi Nick,
Thanks for the reply.
Just now checked this post. It helped a lot.
Yes, I've followed as you said and able to fix the problem.
Reply all
Reply to author
Forward
0 new messages