Rasp-Node-Red-Basic-Nodes

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche



MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

Intro

Voici une petite vue des nœuds déjà disponibles dans l'installation de base.

Rasp-Node-Red-Basic-Nodes-00.jpg

Sur une installation Raspberry-Pi, l'ensemble des noeuds dévolu au stockage sont plus limités que sur une machine normale.

Rasp-Node-Red-Basic-Nodes-01.png


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

Vous les trouverez dans la collection de noeuds "Social".

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

Vous les trouverez dans la collection de noeuds "Storage".

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
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

Noeud d'analyse

Analysis nodes perform standard analyses on incoming messages. In the default node set, the only node provided is the sentiment node, which can be used to try and determine the sentiment of an incoming message based on the words used in the message, for example, an email or tweet.

Nom de Noeud Description
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.

Noeud avancés

Il existe également des noeuds offrant des fonctionnalités avancées.

Nom de Noeud Description
watch Watches a directory or file for changes. You can enter a list of comma-separated directories and/or files. You will need to put quotes “…” around any that contain spaces. On Windows, you must use double backslashes \\ in all directory names.
The full filename of the file that actually changed is put into msg.payload, while a stringified version of the watch list is returned in msg.topic.
msg.file contains just the short filename of the file that changed. msg.type has the type changed, usually file or directory, while msg.size holds the file size in bytes.
feedparse This node monitors an RSS/atom feed for new entries and delivers new entries as messages. It can be configured to query the feed at a specific interval.
exec Calls out to a system command and provides 3 outputs: stdout, stderr, and return code. By default uses exec(), which calls the command, blocks while waiting for completion, and then returns the complete result in one go, along with any errors.

Les noeuds Raspberry-Pi

Nom de Noeud Description
rpi_gpio in Raspberry Pi input node. Generates a msg.payload with either a 0 or 1, depending on the state of the input pin. You may also enable the input pullup resistor or the pulldown resistor.
The msg.topic is set to pi/{the pin number}
Requires the RPi.GPIO python library version 0.5.8 (or better) in order to work.
Note: we are using the actual physical pin numbers on connector P1 as they are easier to locate.
rpi_gpio out Raspberry Pi output node. Expects a msg.payload with either a 0 or 1 (or true or false). Will set the selected physical pin high or low, depending on the value passed in. The initial value of the pin at deploy time can also be set to 0 or 1. When using PWM mode, expects an input value of a number 0 – 100.
Requires the RPi.GPIO Python library version 0.5.8 (or better) in order to work.
rpi_mouse Raspberry Pi mouse button node. Generates a msg.payload with either a 1 or 0 when the selected mouse button is pressed and released. Also sets msg.button to the code value, 1 = left, 2 = right, 4 = middle, so you can work out which button or combination was pressed.



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