SENSBLUE ATLAS/Node-RED: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 3: | Line 3: | ||
'''Flow Node-RED''' | '''Flow Node-RED''' | ||
These easy-to- | These easy-to-deploy flows aim to make the integration of the ATLAS into any scenario faster by adding anabstraction layer between the user and the stack. This is achieved through the use of subflows, which containthe code needed for the features and where changes can be made if necessary, exposing a node that "hides"that more complex integration. | ||
=== 1. Import Flows to Example Folder === | === 1. Import Flows to Example Folder === | ||
To import the flows and add them to the Node-RED examples folder, execute the following: | To import the flows and add them to the Node-RED examples folder, execute the following: | ||
1.1 First | 1.1 First copy the ATLAS folder to a folder with permissions, i.e. /pi | ||
1.2 Copy the folder to the Node-RED examples folder using the command:<syntaxhighlight lang="bash"> | 1.2 Copy the folder to the Node-RED examples folder using the command:<syntaxhighlight lang="bash"> | ||
| Line 18: | Line 18: | ||
'''Analog Inputs''' | '''Analog Inputs''' | ||
This flow | This flow implements a demonstration of acquisition and control of analog ports AI1..AI4 via MQTT and theNode-RED Dashboard 2.0. The system is divided into two main subflows: '''Analog Inputs''', for readingchannels AI1 to AI4, and '''Analog Outputs''', for configuring/reading channels AO1 and AO2. The main logic isencapsulated in subflows, allowing reuse in other tabs or projects. | ||
=== 2. Main Components === | === 2. Main Components === | ||
| Line 44: | Line 44: | ||
==== 3.1 Function ==== | ==== 3.1 Function ==== | ||
The Analog Inputs subflow allows | The Analog Inputs subflow allows selecting which AI channels should be read and in which unit/type eachchannel should operate: voltage ('''voltage''') or current ('''current'''). The subflow has four outputs, one perchannel: AI1, AI2, AI3 and AI4. | ||
==== 3.2 ENV Variables ==== | ==== 3.2 ENV Variables ==== | ||
| Line 53: | Line 53: | ||
!Description | !Description | ||
|- | |- | ||
|readAI1 | |'''readAI1''' | ||
|bool | |bool | ||
|true | |'''true''' | ||
|Enables/disables reading of channel AI1. | |Enables/disables reading of channel AI1. | ||
|- | |- | ||
|AI1_type | |'''AI1_type''' | ||
|string | |string | ||
|voltage | |'''voltage''' | ||
|Type of AI1 reading: voltage or current. | |Type of AI1 reading: '''voltage''' or '''current'''. | ||
|- | |- | ||
|readAI2 | |'''readAI2''' | ||
|bool | |bool | ||
|true | |'''true''' | ||
|Enables/disables reading of channel AI2. | |Enables/disables reading of channel AI2. | ||
|- | |- | ||
|AI2_type | |'''AI2_type''' | ||
|string | |string | ||
|voltage | |'''voltage''' | ||
|Type of AI2 reading: voltage or current. | |Type of AI2 reading: '''voltage''' or '''current'''. | ||
|- | |- | ||
|readAI3 | |'''readAI3''' | ||
|bool | |bool | ||
|true | |'''true''' | ||
|Enables/disables reading of channel AI3. | |Enables/disables reading of channel AI3. | ||
|- | |- | ||
|AI3_type | |'''AI3_type''' | ||
|string | |string | ||
|voltage | |'''voltage''' | ||
|Type of AI3 reading: voltage or current. | |Type of AI3 reading: '''voltage''' or '''current'''. | ||
|- | |- | ||
|readAI4 | |'''readAI4''' | ||
|bool | |bool | ||
|true | |'''true''' | ||
|Enables/disables reading of channel AI4. | |Enables/disables reading of channel AI4. | ||
|- | |- | ||
|AI4_type | |'''AI4_type''' | ||
|string | |string | ||
|voltage | |'''voltage''' | ||
|Type of AI4 reading: voltage or current. | |Type of AI4 reading: '''voltage''' or '''current'''. | ||
|} | |} | ||
| Line 108: | Line 108: | ||
} | } | ||
} | } | ||
</syntaxhighlight>If no channel is active, the function emits the warning "No AI channels selected" and does not send a message. | </syntaxhighlight>If no channel is active, the function emits the warning "'''No AI channels selected'''" and does not send a message. | ||
==== 3.4 Configuring the AI mode ==== | ==== 3.4 Configuring the AI mode ==== | ||
The group '''Set acquisition mode''' allows sending the configuration of the analogue channels to <code>analogInputs/config/in</code>. The function '''Set AIX mode''' creates taskParams only for the active channels and sets each channel as:<syntaxhighlight lang="json"> | The group '''Set acquisition mode''' allows sending the configuration of the analogue channels to <code>analogInputs/config/in</code>. The function '''Set AIX mode''' creates '''taskParams''' only for the active channels and sets each channel as:<syntaxhighlight lang="json"> | ||
{ | { | ||
"mode": "single", | "mode": "single", | ||