27a1038993
* serial: simplify serialPool.get serialPool.get() has a lot of arguments. Just pass the whole serialConfig object instead. Also introduce early termination to remove one level of indentation. (Just set your diff tool to ignore all whitespace changes to see how very little this patch changes) * serial: move splitting logic onto serialPool All SerialIn and SerialOut nodes for a given port share the same splitting logic as it is indeed set by the common configuration node. Move the code from SerialIn into serialPool so that it can be reused by the serial request node. Notice how the 'data' event will no longer carry single bytes, but the whole payload instead. Also move the output encoding logic into serialPool. * serial: add serial request node Add a "serial request" node to handle simple request/response protocols. This node allows for multiple instances, all sharing the same underlying device. Responses coming from the serial line will only be propagated to the output of the node where the request was originally received (contrary to the "serial in" nodes which all emit the data received from the serial line). Every request received as an input to the node, is transmitted to the serial line, and a matching response must be received before the next one can be transmitted. Any input message received in the meantime is internally enqueued. The node is essentially a merge of serial in and serial out. It shares the same configuration with serial in and serial out for any given port and will not affect the behavior of the existing nodes. This means you can use, alongside with the request node: - as many serial in nodes as you want -- e.g. to "sniff" - serial out to inject mailicious/tampering data onto the serial line, skipping the queueing mechanism * serial request: provide some visual feedback on the node add status indication: - yellow "waiting" when a message is enqueued for sending - green "OK" after an answer is received - red "timeout" after a timeout occurs More sofisticated output would include an indication of the number of messages enqueued and the actual timeout remaining after sending. * serial request: make default response timeout configurable Notice it's a global setting (i.e. stored in the configuration node) as opposed to per-node, but it can be overridden by setting msg.timeout. * serial request: cosmetic changes - added documentation about msg.port - timeout field made wider so to accommodate default value of 10000ms - replaced harcoded text with localizable strings for "waiting" and "timeout" messages * serial: cleanup: remove node.tout this was probably some leftover code from previous implementations. Now all timeouts are handled within the connection objects. * serial: cleanup: set obj.tout to null after clearing it clearing a Timeout without setting it back to null *might* have adverse effects on later code which would check its null-ity. Let's just do it. * serial: cosmetic: add some comments * serial request: fix "split on timeout" case In the case of "split on timeout" case, we're reusing the same .tout for two different purposes: 1) to send a timeout message, in case no answer is received at all [request] 2) to split messages, after receiving the first character [in+request] So in the case of serial request, checking whether .tout is already set is no longer a valid condition for 2). Let's just check whether i === 1, and clear the timeout set up by 1) if it's already there. * serial: add "split on silence" behavior add a fourth logic to split incoming data into messages. The existing "split on timeout" logic starts the timeout upon reception of the first character. This might lead to unwanted behavior if for instance Node-RED is restarted, as data might accumulate into OS buffers (see #410). A different logic might be to only emit a message when enough time has passed, without any new data being received (line silent), a.k.a. interbyte timeout. |
||
---|---|---|
.github | ||
analysis | ||
function | ||
hardware | ||
io | ||
parsers | ||
social | ||
storage | ||
test | ||
time | ||
utility | ||
.gitignore | ||
.jscsrc | ||
.jshintrc | ||
.travis.yml | ||
99-sample.html.demo | ||
99-sample.js.demo | ||
CONTRIBUTING.md | ||
coverall | ||
Gruntfile.js | ||
LICENSE | ||
package-lock.json | ||
package.json | ||
README.md |
Node-RED Nodes
A collection of nodes for Node-RED. See below for a list.
Installation
All of these nodes are available as individual npm packages. See the list below for the npm package names, or search npm.
This repository acts as an overall store for these nodes - and is not intended as a way to install them - unless you really do want some development.
To install - either use the manage palette option in the editor, or change to your Node-RED user directory.
cd ~/.node-red
npm install node-red-node-{filename}
To manually install using this repo:
- cd into the
nodes
directory of Node-RED - Either:
- download the zip of the repository and extract it
- run
git clone https://github.com/node-red/node-red-nodes.git
- run
npm install
in any of the node subfolders to install individual node's dependencies
Running Tests
Node.js v6 or newer is required. To run tests on all of the nodes you will need the node-red runtime:
npm i node-red-nodes
npm test
Contributing
Now that we support npm installation of nodes we recommend people post their own nodes via npm. Please read the packaging guide notes.
For simple typos and single line fixes please just raise an issue pointing out our mistakes. If you need to raise a pull request please read our contribution guidelines before doing so.
Copyright and license
Copyright JS Foundation and other contributors, http://js.foundation under the Apache 2.0 license.
Extra Node Information
NPM name - File-link - Description
Misc
N/A - 99-sample - A sample node with more comments than most to try to help you get started without any other docs...
Analysis
node-red-node-badwords - 74-swearfilter - Analyses the payload and tries to filter out any messages containing bad swear words. This only operates on payloads of type string. Everything else is blocked.
node-red-node-wordpos - 72-wordpos - Analyses the payload and classifies the part-of-speech of each word. The resulting message has msg.pos added with the results. A word may appear in multiple categories (eg, 'great' is both a noun and an adjective).
Function
node-red-node-datagenerater - datagenerator - A node that can generate dummy data in various formats, names, addresses, emails, numbers, words, etc
node-red-node-pidcontrol - pidcontrol - A PID control node for numeric inputs - provides simple contoll loop feedback capability.
node-red-node-random - random - A simple random number generator - can generate integers for x to y - or floats between x and y.
node-red-node-rbe - rbe - A simple node to provide report by exception and deadband / bandgap capability for simple inputs.
node-red-node-smooth - 17-smooth - A simple node to provide various functions across several previous values, including max, min, mean, high and low pass filters.
Hardware
node-red-node-arduino - 35-arduino - A collection of analogue & digital input & output nodes for the Arduino board - uses firmata protocol to talk to the board.
node-red-node-beaglebone - 145-BBB-hardware - A collection of analogue & digital input & output nodes for the Beaglebone Black.
node-red-node-blink1 - 77-blink1 - Provides support for the Blink1 USB LED from ThingM.
node-red-node-blinkstick - 76-blinkstick - Provides support for the BlinkStick USB LED device.
node-red-node-digirgb - 78-digiRGB - Provides support for the DigiSpark RGB USB LED.
node-red-node-heatmiser - 100-heatmiser-in - Read and writes settings for temperature and frost protection to Heatmiser thermostats.
node-red-node-intel-galileo - mraa-spio - A collection of analogue & digital input & output nodes for the Intel Galileo and Edison.
node-red-node-ledborg - 78-ledborg - A simple driver for the LEDborg plug on module for Raspberry Pi.
node-red-node-makeymakey - 42-makey - A Node-RED node to read from a MakeyMakey input device.
node-red-node-pi-gpiod - pigpiod - An alternative to the default PI GPIO nodes that allows remote access - so a host machine can access a remote Pi (via network) and is better for driving multiple servos.
node-red-node-pi-mcp3008 - pimcp3008 - Allows A Raspberry Pi to node to read from MCP300x series Analogue to Digital Converter chips via the SPI bus.
node-red-node-pi-neopixel - neopixel - Allows A Raspberry Pi to drive a strip of NeoPixels directly.
node-red-node-pi-unicorn-hat - unicorn - Lets a Raspbeery Pi control a Pimorini Unicorn HAT 8x8 LED display.
node-red-node-pibrella - 38-rpi-pibrella - Controls a Pibrella add-on board for a Raspberry-Pi.
node-red-node-piface - 37-rpi-piface - Adds support for the PiFace interface module for Raspberry Pi.
node-red-node-piliter - 39-rpi-piliter - Controls a Pimorini Pi-LITEr 8 LED add-on board for a Raspberry-Pi.
node-red-node-sensortag - 79-sensorTag - Reads data from the Ti Bluetooh Low Energy (BLE) SensorTag device.
node-red-node-wemo - 60-wemo - Basic node to drive a WeMo socket and switch. Does not use discovery.
N/A - 101-scanBLE - Scans for a particular Bluetooth Low Energy (BLE) device.
I/O
node-red-node-discovery - mdns - discovers other Avahi/Bonjour services on the network.
node-red-node-emoncms - 88-emoncms - Adds node to post to an Emoncms server.
node-red-node-mqlight - mqlight - Adds nodes to send and receive using MQlight.
node-red-node-ping - 88-ping - Pings a machine and returns the trip time in mS. Returns false if no response received within 3 seconds, or if the host is unresolveable. Default ping is every 20 seconds but can be configured.
node-red-node-serialport - 25-serial - Node to send messages to and receive messages from a physical serial port.
node-red-node-snmp - snmp - Adds simple snmp receivers for single OIDs or OID tables.
node-red-node-stomp - 18-stomp - A Node-RED node to publish and subscribe to and from a STOMP server.
node-red-node-wol - 39-wol - Sends a Wake-On-LAN magic packet to the mac address specified. You may instead set msg.mac to dynamically set the target device mac to wake up.
Parsers
node-red-node-base64 - 70-base64.js - Converts a payload to/from base64 encoded format.
node-red-node-geohash - 70-geohash.js - Converts a lat, lon payload to/from geohash format.
node-red-node-msgpack - 70-msgpack.js - Converts a payload to/from msgpack binary packed format.
node-red-node-what3words - what3words.js - Encodes or Decodes a lat, lon position into what3words text format.
Social
node-red-node-dweetio - 55-dweetio - Uses dweetio to send/receive messages.
node-red-node-email - 61-email - Sends and receives simple emails from services like gmail or smtp or imap servers.
node-red-node-feedparser - 32-feedparse - Reads messages from an atom or rss feed.
node-red-node-irc - 91-irc - Connects to an IRC server to send and receive messages.
node-red-node-nma - 57-nma - DEPRECATED as NMA closed down operations.
node-red-node-notify - 57-notify - Uses Growl to provide a desktop popup containing the payload. Only useful on the local Apple machine.
node-red-node-prowl - 57-prowl - Uses Prowl to push the payload to an Apple device that has the Prowl app installed.
node-red-node-pushbullet - 57-pushbullet - Uses PushBullet to push the payload to an Android device that has the PushBullet app installed.
node-red-node-pusher - 114-pusher - Publish-Subscribe to a Pusher channel/event.
node-red-node-pushover - 57-pushover - Sends alerts via Pushover.
node-red-node-twilio - 56-twilio - Uses Twilio service to send/receive text messages.
node-red-node-twitter - 27-twitter - Listens to Twitter feeds and can also send tweets. (NOTE: this will break soon when Twitter remove their streaming API)
node-red-node-xmpp - 92-xmpp - Connects to an XMPP server to send and receive messages.
Storage
node-red-node-leveldb - 67-leveldb - Uses LevelDB for a simple key value pair database.
node-red-node-mysql - 68-mysql - Allows basic access to a MySQL database. This node uses the query operation against the configured database. This does allow both INSERTS and DELETES. By it's very nature it allows SQL injection... so be careful out there...
node-red-node-sqlite - sqlite - Supports read and write to a local sqlite database.
Time
node-red-node-suncalc - 79-suncalc - Uses the suncalc module to generate an output at sunrise and sunset based on a specified location. Several choices of definition of sunrise and sunset are available.
node-red-node-timeswitch - timeswitch - Lets the user set simple repeating timers for example for simple heating control, etc.
Utility
node-red-node-daemon - daemon - starts up (calls) a long running system program and pipes STDIN, STDOUT and STDERR to and from that process. Good for monitoring long running command line applications,
node-red-node-exif - 94-exif - Extracts GPS and other EXIF information from a passed in jpeg image,