Rasp-Node-Red-Basic-Nodes
Intro
Voici une petite vue des nœuds déjà disponibles dans l'installation de base.
Sur une installation Raspberry-Pi, l'ensemble des noeuds dévolu au stockage sont plus limités que sur une machine normale.
Les noeuds d'entrée
Vous les trouverez dans la collection de noeud "Input".
Il y a 7 noeuds d'entrée de base dans l'installation par défaut. Ces noeuds couvrent les mécanismes de communication de base utilisé principalement par les applications IoT. Cela s'étale des protocoles Internet fondamentaux tels que UDP et TCP jusqu'à un niveau plus élevé tels que HTTP et les mécanismes MQTT de publication/souscription (publish/subscribe).
Nom de Noeud | Description |
inject | Injects a timestamp or user-configured text into a message. Can be configured to inject manually, at a set interval, or at specific times (using Cron). |
catch | Catches errors thrown by nodes on the same tab. If a node throws an error whilst handling a message, the flow will typically halt. This node can be used to catch those errors returning a message with an error property detailing the error and the source node and type. |
mqtt | Subscribes to an MQTT broker and listens on a topic, returns any data published on the topic as a new message. Supports Quality of Service levels and last data retention. |
http | Receives HTTP requests, allowing Node-RED to act as a basic web server. HTTP body is delivered as an output message along with any response. Message can contain standard URL-encoded data or JSON. |
websocket | Provides an endpoint for a browser to establish a websocket connection with Node-RED. Offers a duplex connection for browser/server combinations. |
tcp | Used to accept incoming TCP requests on a specified port or to connect to a remote TCP port. Generates messages containing the TCP data as a single – or stream of – buffer, string or base64 encoded. |
udp | Used to accept incoming UDP packets (or multicast packets) on a specified port. Generates messages containing the UDP data as a BUFFER, string or base64 encoded string. |
serial in | Reads from a serial port on the local device. Can be configured to read buffers, a specific time period or wait for line breaks. |
Les noeuds de sortie
Vous les trouverez dans la collection de noeud "Output".
The output nodes are essentially the mirror images of the basic set of input nodes and provide a way to send data on the same set of protocols, i.e. mqtt, http, udp etc.
Nom de Noeud | Description |
debug | Provides a simple way to view messages which are displayed in the debug pane. Can be configured to display just the msg.payload or the entire msg object. |
mqtt | Subscribes to an MQTT broker and posts any data (msg.payload) it receives in incoming messages to a topic. Supports Quality of Service levels and last data retention. |
http | Sends responses back to HTTP requests received from a HTTP Input node. The response body is determined by msg.payload, and can have headers and status code defined. |
websocket | Sends msg.payload out on the websocket configured. If msg._session is defined, sends to the origination client, otherwise broadcasts to all connected clients |
tcp | Replies to a configured TCP port. Can also be used to send to a specific port. |
udp | Sends a UDP message to the configured host (ip address) and port. Supports broadcast. Like most nodes, configured through UI or message properties. |
serial out | Sends to the defined serial port. Can be configured to send an optional newline after any message payload. |
Les noeuds de fonction
Vous les trouverez dans la collection de noeuds "Function".
The function category contains a variety of nodes that carry out specific processing functions. These range from the simple delay and switch nodes to the programmable function node that can be adapted to almost any programming need.
Nom de Noeud | Description |
function | Generic programmable function node. Using standard JavaScript, the node can be tailored to carry out complex processing on its input messages generating one or more output messages. Examples 2.1, 2.2, 3.8, 5.1-5.4, 5.7, 6.1-6.8 |
template | Configured with a template (using moustache format) of arbitrary complexity, this node takes an input message containing name:value pairs and inserts into the template. Useful for constructing messages, HTML, config files, etc. Example 1.3 |
delay | A generic node that delays messages by a specific or random time. Can also be configured to throttle a message flow (e.g. 10 msg per sec). |
trigger | Creates two output messages separated by a configurable time interval whenever an input message is received. Can also be used as a watchdog timer. |
comment | A simple visual comment configured with title and body. |
http request | Allows you to construct and send a HTTP request to a specific URL. Method (PUT, GET, etc), headers and payload are all configurable through the UI or programmatically. |
tcp request | A simple TCP request node. It sends the msg.payload to a server tcp port and expects a response. Can be configured to wait for data, wait for a specific character, or return immediately. |
switch | This node routes messages based on their properties. Properties are configured using the UI and can be a variety of logic (>, <, >= etc) applied to a message property. |
change | The change node can be used to set, change or delete properties of incoming messages. A variety of configurable rules allow complex changes including search and replace in the msg.payload |
range | A simple scaling node that will map numerical input to a new output. Useful for converting or bounding ranges of input values, e.g. temperature. Undefined for non-numeric data. |
Nom de Noeud | Description |
csv | This node parses msg.payload and tries to convert to/from CSV. If it receives a string, it outputs a JavaScript object, and if it receives a JavaScript object, it outputs a CSV string. |
html | Extracts elements from an html document in msg.payload using a configurable selector (CSS selector syntax). Essentially allows you to parse out the HTML and returns an array of the elements that match. |
json | This node converts to/from a JSON object. If it receives a JavaScript object, it outputs JSON, and if it receives JSON, it outputs a JavaScript object. |
xml | This node converts to/from XML format. If it receives a JavaScript object, it outputs an XML string, and if it receives an XML string, it outputs a JavaScript object. |
rbe | Report By Exception node. Generates a message only when its input is different from the previous input (string or number) or if the input has changed by a configurable amount (deadband mode) – only for numbers. |
Les noeuds sociaux
The basic social media nodes support interaction with email and with Twitter. They enable flows to send or receive email, or to send or receives tweets.
Nom de Noeud | Description |
xx | xx |
email in | Can be configured to repeatedly read from an IMAP server returning new email as it arrives. Sets msg.topic to email subject and either msg.payload to email text body or msg.html if the email is HTML. |
twitter in | Returns tweets as messages. Can be used to search the public or a user’s stream for tweets containing the configured search term or all tweets by specific users or direct messages received by the authenticated user. |
email out | Sends the incoming message as an email via the configured IMAP server. Topic and recipient all configurable. Will convert binary data to an attachment. |
twitter out | Tweets the msg.payload on the configured account. Can send direct messages and will send binary data as an image. |
Noeud de stockage
Etant donné que nous utilisons une version pour Raspberry-Pi, le contenu de la section "stockage" est plus restreint que sur une installation normale.
Nom de Noeud | Description |
xx | xx |
tail | Tails (i.e. watches for things to be added) to the configured file. (Linux/Mac ONLY). This won’t work on Windows file systems, as it relies on the tail -F command. |
file in | Reads the specified file and sends the content as msg.payload, and the filename as msg.filename. The filename can be configured in the node. If left blank, it should be set on msg.filename in an incoming |
file | Writes msg.payload to the file specified, e.g. to create a log. The filename can be configured in the node. If left blank, it should be set on msg.filename in an incoming message. The default behaviour is to append to the file. This can be changed to overwrite the file each time; for example, if you want to output a “static” web page or report |
sentiment The sentiment node analyses the msg.payload and scores the sentiment of the message based on word analysis. It adds a msg.sentiment object that contains the resulting AFINN-111 sentiment score as msg.sentiment.score. Score typically ranges from -5 to +5.
Source: Raspberry Pi Hosting Node-Red
Créé par C. Mobberley pour AdaFruit Industries.
Traduction réalisée et augmentée par Meurisse D. pour MCHobby.be.
Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : « Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.
L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.
Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com