How can i connect usb sensors to node red? Is there some library?
What sort of usb sensors?
Digi xstick
Isnt this a usb zigbee transceiver? A possible way would be to use Openhab as they have a Zigbee binding that supports this stick and their is nodes to communicate with openhab.
But there is a big caveat. I know this would be a lot of overhead especially on a pi to install openhab just for this.
I like the node-red, and i already work on some project, so i wish to continue work with it. I install some libraries from manage palette (zigbee, xbee, thingspeak, sql, etc.), but after i update the node-red, node.js i can't find some of the libraries i was already installed, any help?
What hardware and operating system are you running on.=?
How did you upgrade node-red and nodejs?
Run
node-red-stop
node-red-start
and post the startup log here.
If you upgraded the version of nodejs itself (for example from v8 to v10 or v12) - then you will probably need to rebuild any nodes that have a binary component... which usb is highly likely to. go into your user directory - usually ~/.node-red and run npm rebuild
- and report any errors you see there.
OS-raspbian Hardware- raspberry pi 4
I upgrade node-red and nodejs, like in here:
https://nodered.org/docs/getting-started/raspberrypi
After Run
node-red-stop
node-red-start
pi@raspberrypi:~ $ node-red-stop
Stop Node-RED
Use node-red-start to start Node-RED again
pi@raspberrypi:~ $ node-red-start
Start Node-RED
Once Node-RED has started, point a browser at http://192.168.1.8:1880
On Pi Node-RED works better with the Firefox or Chrome browser
Use node-red-stop to stop Node-RED
Use node-red-start to start Node-RED again
Use node-red-log to view the recent log output
Use sudo systemctl enable nodered.service to autostart Node-RED at every boot
Use sudo systemctl disable nodered.service to disable autostart on boot
To find more nodes and example flows - go to http//flows.nodered.org
Starting as a systemd service.
17 Apr 15:10:59 - [info]
Welcome to Node-RED
17 Apr 15:10:59 - [info] Node-RED version: v1.0.5
17 Apr 15:10:59 - [info] Node.js version: v12.16.2
17 Apr 15:10:59 - [info] Linux 4.19.97-v7l+ arm LE
17 Apr 15:11:00 - [info] Loading palette nodes
17 Apr 15:11:04 - [info] Dashboard version 2.20.0 started at /ui
17 Apr 15:11:05 - [warn] ------------------------------------------------------
17 Apr 15:11:05 - [warn] [node-red-node-sqlite/sqlite] Error: Cannot find module '/home/pi/.node-red/node_modules/sqlite3/lib/binding/node-v72-linux-arm/node_sqlite3.node'
Require stack:
- /home/pi/.node-red/node_modules/sqlite3/lib/sqlite3.js
- /home/pi/.node-red/node_modules/node-red-node-sqlite/sqlite.js
- /usr/lib/node_modules/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/lib/node_modules/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/lib/node_modules/node-red/lib/red.js
- /usr/lib/node_modules/node-red/red.js
17 Apr 15:11:05 - [warn] [node-red-contrib-xbee/xbee] Error: libnode.so.64: cannot open shared object file: No such file or directory
17 Apr 15:11:05 - [warn] ------------------------------------------------------
17 Apr 15:11:05 - [info] Settings file : /home/pi/.node-red/settings.js
17 Apr 15:11:05 - [info] Context store : 'default' [module=memory]
17 Apr 15:11:05 - [info] User directory : /home/pi/.node-red
17 Apr 15:11:05 - [warn] Projects disabled : editorTheme.projects.enabled=false
17 Apr 15:11:05 - [info] Flows file : /home/pi/.node-red/flows_raspberrypi.json
17 Apr 15:11:05 - [warn]
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
17 Apr 15:11:05 - [info] Starting flows
17 Apr 15:11:05 - [info] Started flows
17 Apr 15:11:05 - [info] Server now running at http//127.0.0.1:1880/
I run npm rebuild
but nothing appear
It appears the sqlite node is not fully installed. In a terminal run
cd ~/.node-red
npm remove node-red-node-sqlite
npm install node-red-node-sqlite
The install may produce lots of output, but if at the end it says it has installed then you can ignore the rest. I don't know about the xbee error, but try removing and installing that too. Then restart node-red.
After npm rebuild
I'v got too much out put and cant put it here.
Here is a write up from Peter Scargill that might help
I fix some of the problems, like sql. Thank you so much!. But i can't install some of this features:
https://flows.nodered.org/search?term=xbee
Any help?
You said earlier that didn't do anything.
All we need to see, probably, is the last dozen lines.
osenv@0.1.5 /home/pi/.node-red/node_modules/osenv
os-homedir@1.0.2 /home/pi/.node-red/node_modules/os-homedir
os-tmpdir@1.0.2 /home/pi/.node-red/node_modules/os-tmpdir
npm-packlist@1.4.8 /home/pi/.node-red/node_modules/npm-packlist
ignore-walk@3.0.3 /home/pi/.node-red/node_modules/ignore-walk
minimatch@3.0.4 /home/pi/.node-red/node_modules/minimatch
brace-expansion@1.1.11 /home/pi/.node-red/node_modules/brace-expansion
balanced-match@1.0.0 /home/pi/.node-red/node_modules/balanced-match
concat-map@0.0.1 /home/pi/.node-red/node_modules/concat-map
npm-bundled@1.1.1 /home/pi/.node-red/node_modules/npm-bundled
npm-normalize-package-bin@1.0.1 /home/pi/.node-red/node_modules/npm-normalize-package-bin
rimraf@2.7.1 /home/pi/.node-red/node_modules/rimraf
glob@7.1.6 /home/pi/.node-red/node_modules/glob
fs.realpath@1.0.0 /home/pi/.node-red/node_modules/fs.realpath
inflight@1.0.6 /home/pi/.node-red/node_modules/inflight
path-is-absolute@1.0.1 /home/pi/.node-red/node_modules/path-is-absolute
tar@4.4.13 /home/pi/.node-red/node_modules/tar
fs-minipass@1.2.7 /home/pi/.node-red/node_modules/fs-minipass
minipass@2.9.0 /home/pi/.node-red/node_modules/minipass
yallist@3.1.1 /home/pi/.node-red/node_modules/yallist
minizlib@1.3.3 /home/pi/.node-red/node_modules/minizlib
request@2.88.2 /home/pi/.node-red/node_modules/request
aws-sign2@0.7.0 /home/pi/.node-red/node_modules/aws-sign2
aws4@1.9.1 /home/pi/.node-red/node_modules/aws4
caseless@0.12.0 /home/pi/.node-red/node_modules/caseless
combined-stream@1.0.8 /home/pi/.node-red/node_modules/combined-stream
delayed-stream@1.0.0 /home/pi/.node-red/node_modules/delayed-stream
extend@3.0.2 /home/pi/.node-red/node_modules/extend
forever-agent@0.6.1 /home/pi/.node-red/node_modules/forever-agent
form-data@2.3.3 /home/pi/.node-red/node_modules/form-data
asynckit@0.4.0 /home/pi/.node-red/node_modules/asynckit
har-validator@5.1.3 /home/pi/.node-red/node_modules/har-validator
ajv@6.12.0 /home/pi/.node-red/node_modules/ajv
fast-deep-equal@3.1.1 /home/pi/.node-red/node_modules/fast-deep-equal
fast-json-stable-stringify@2.1.0 /home/pi/.node-red/node_modules/fast-json-stable-stringify
json-schema-traverse@0.4.1 /home/pi/.node-red/node_modules/json-schema-traverse
uri-js@4.2.2 /home/pi/.node-red/node_modules/uri-js
punycode@2.1.1 /home/pi/.node-red/node_modules/punycode
har-schema@2.0.0 /home/pi/.node-red/node_modules/har-schema
http-signature@1.2.0 /home/pi/.node-red/node_modules/http-signature
assert-plus@1.0.0 /home/pi/.node-red/node_modules/assert-plus
jsprim@1.4.1 /home/pi/.node-red/node_modules/jsprim
extsprintf@1.3.0 /home/pi/.node-red/node_modules/extsprintf
json-schema@0.2.3 /home/pi/.node-red/node_modules/json-schema
verror@1.10.0 /home/pi/.node-red/node_modules/verror
sshpk@1.16.1 /home/pi/.node-red/node_modules/sshpk
asn1@0.2.4 /home/pi/.node-red/node_modules/asn1
bcrypt-pbkdf@1.0.2 /home/pi/.node-red/node_modules/bcrypt-pbkdf
tweetnacl@0.14.5 /home/pi/.node-red/node_modules/tweetnacl
dashdash@1.14.1 /home/pi/.node-red/node_modules/dashdash
ecc-jsbn@0.1.2 /home/pi/.node-red/node_modules/ecc-jsbn
jsbn@0.1.1 /home/pi/.node-red/node_modules/jsbn
getpass@0.1.7 /home/pi/.node-red/node_modules/getpass
is-typedarray@1.0.0 /home/pi/.node-red/node_modules/is-typedarray
isstream@0.1.2 /home/pi/.node-red/node_modules/isstream
json-stringify-safe@5.0.1 /home/pi/.node-red/node_modules/json-stringify-safe
oauth-sign@0.9.0 /home/pi/.node-red/node_modules/oauth-sign
performance-now@2.1.0 /home/pi/.node-red/node_modules/performance-now
qs@6.5.2 /home/pi/.node-red/node_modules/qs
tough-cookie@2.5.0 /home/pi/.node-red/node_modules/tough-cookie
psl@1.8.0 /home/pi/.node-red/node_modules/psl
uuid@3.4.0 /home/pi/.node-red/node_modules/uuid
growly@1.3.0 /home/pi/.node-red/node_modules/growly
node-notifier@5.2.1 /home/pi/.node-red/node_modules/node-notifier
shellwords@0.1.1 /home/pi/.node-red/node_modules/shellwords
node-red-node-notify@0.1.1 /home/pi/.node-red/node_modules/node-red-node-notify
pi@raspberrypi:~/.node-red $
No sign of any errors there.
What happened when you re-installed the two nodes? Did it fix the problem?
pi@raspberrypi:~ cd ~/.node-red
pi@raspberrypi:~/.node-red npm install node-red- contrib-xbee
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/node-red- - Not found
npm ERR! 404
npm ERR! 404 'node-red-@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2020-04-17T15_59_53_935Z-debug.log
pi@raspberrypi:~/.node-red $
When using computers it is important to get the details right. If you look carefully at the command you entered you will see you have added a space in the middle of the node name. It is also worth looking at error messages to see if anything can be gleaned from them. In this case it cannot find a node called node-red-
which immediately tells you where to look for the error.
I fix the above, but when i try to install some usb utilities via manage palette i've got this:
Failed to install: node-red-contrib-usb
Install failed
Any help?
I would have thought it was obvious, try it from the command line and see what the eror is. You know how to install from the command line, don't forget to go to the .node-red folder first.
pi@raspberrypi:~ $ cd ~/.node-red
pi@raspberrypi:~/.node-red $ npm install node-red-contrib-usb
usb@1.6.3 install /home/pi/.node-red/node_modules/usb
prebuild-install --verbose || node-gyp rebuild
prebuild-install info begin Prebuild-install version 5.3.3
prebuild-install info looking for cached prebuild @ /home/pi/.npm/_prebuilds/470134-usb-v1.6.3-node-v72-linux-arm.tar.gz
prebuild-install http request GET https://github.com/tessel/node-usb/releases/download/v1.6.3/usb-v1.6.3-node-v72-linux-arm.tar.gz
prebuild-install http 404 https://github.com/tessel/node-usb/releases/download/v1.6.3/usb-v1.6.3-node-v72-linux-arm.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=12.16.2 runtime=node arch=arm libc= platform=linux)
make: Entering directory '/home/pi/.node-red/node_modules/usb/build'
CC(target) Release/obj.target/libusb/libusb/libusb/core.o
CC(target) Release/obj.target/libusb/libusb/libusb/descriptor.o
CC(target) Release/obj.target/libusb/libusb/libusb/hotplug.o
CC(target) Release/obj.target/libusb/libusb/libusb/io.o
CC(target) Release/obj.target/libusb/libusb/libusb/strerror.o
CC(target) Release/obj.target/libusb/libusb/libusb/sync.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/poll_posix.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/threads_posix.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_usbfs.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_udev.o
../libusb/libusb/os/linux_udev.c:40:10: fatal error: libudev.h: No such file or directory
#include <libudev.h>
^~~~~~~~~~~
compilation terminated.
make: *** [libusb.target.mk:148: Release/obj.target/libusb/libusb/libusb/os/linux_udev.o] Error 1
make: Leaving directory '/home/pi/.node-red/node_modules/usb/build'
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:310:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 4.19.97-v7l+
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/.node-red/node_modules/usb
gyp ERR! node -v v12.16.2
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/zigbee-herdsman-converters/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/zigbee-herdsman/node_modules/jest-haste-map/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/zigbee-herdsman/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! usb@1.6.3 install: prebuild-install --verbose || node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the usb@1.6.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2020-04-17T16_44_27_808Z-debug.log