@4tunaio/4tuna-iot-node-red 2.1.0
4TUNA IoT nodes for Node-RED
4TUNA IoT Node for Node-RED
4tuna-iot-node-red node for Node-RED.
Prerequisites
- Be a registered user in 4TUNA with IoT Admin permissions in your organization.
- Have a running installation of Node-RED on the IoT device.
- Python version 2.7 must be installed on the IoT device
Setting
Register your device in 4TUNA and generate your certificates. the details are given in the following article: crear-un-nuevo-dispositivo-iot-en-4tuna
Login to your Node-RED server, and install the
@4tunaio/4tuna-iot-node-red
node, for this purpose follow the procedure detailed in the step 3 of the article vincular-4tuna-con-un-dispositivo-iot-usando-node-red.You may also install it from console running
npm install @4tunaio/4tuna-iot-node-red
at the Node-RED main folder.Now you should see the
4tuna event
node available under de 4tuna category on the nodes panel. Add it to your flow, and double clic on it to set it up.First you need to specify the device you want to use to send the event. You can add a new device by clicking on the Device field and selecting
Add new 4tuna-device
, then press on the edit button:Configure the device filling the fields as follows:
- Device ID: the device id assigned in 4TUNA.
- Certificate: copy and paste the certificate text from 4TUNA.
- Private Key: copy and paste the private key text from 4TUNA.
After pressing the done button, you can continue with the configuration of the parameter event you will be sending through this node:
- Name: write a custom name.
- ID: copy and paste the Parameter ID from 4TUNA.
Usage
The node can be used for two types of parameters, analog and event.
Steps to analog mode:
- Connect the variable you want to send to the
4tuna event
node input. - The node has 3 outputs that are activated according to the state of the parameter (normal, warning, danger). these outputs contain the value of the parameter and the condition in the state of danger and warning.
Steps to event mode:
first, it is necessary to create the event in 4tuna following the steps found in the following article: configuracion-de-eventos
create a vector with the following data: [Event start/end, Event code, Motive code].
Event start must be 1, and Event end must be 0.
Event code and Motive code are alphanumeric strings.
Motive code is optional.
Connect the array to
4tuna event
node input.Each event is counted when Event Start is entered.
The node has 3 outputs that are activated according to the action of the parameter (normal, warning, danger). these outputs contain the event code which triggered the action, motive code and status.
- Note: stop-type events will only be recorded with a duration of more than 1 minute
For more information go to step 4 of the article vincular-4tuna-con-un-dispositivo-iot-usando-node-red.
You are ready to go! Now you can login to 4TUNA and visualize your inputs in the Parameters dashboard.
Test connection node (to physical device)
For this it is necessary to use the 4tuna-conn
node, follow the next steps for its configuration:
- Add the
4tuna-conn
node.
- In the configuration tab, under 'Device Name' add a name for the physical equipment with which the connection is to be checked, under timeOut add the time with which the cyclic bit is to be tested, under device select the IoT device (only one 4tuna-device is allowed per
4tuna conn
).
- Next deploy and the node will check if the connection with the physical device is good, in case of error the output and node will be shown as follows.
Other options
offline: Enable this field in the options window of the 4tuna-event node if you want the information to be saved in the iot device, when there is no internet connection.
debug to console: Enable this field in the debug window if you want to see the debug information in the console.
debug to bar: Enable this field in the debug window if you want to see the debug information in the node-red used for this purpose.
For additional help visit our Help Center.
Copyright and License
Copyright 4TUNA, Inc.
Released under the Apache-2.0 License.