Node-RED eMOD API Modules
Node-RED allows you to focus on what really matters, bring our added value to the solutions.
We have gone one step further on the integration of eManager and Node-RED creating customized nodes for each of our expansion modules.
Getting Started
This Getting Started guide covers setting up eMOD nodes, with a description of what each can do, what functions are available, along with usage examples for each of the eMOD nodes.
Installation
No installation is required, as EMOD nodes come already installed by default in our eManager. Specifically, each one incorporates the nodes corresponding to the installed hardware modules.
8 Signal relays API
Connects to a 8SR eMOD module to manage the 8 relays individually or jointly.
It allows to manage the following functionalities on the module:
- Set the pulse width for each relay
- Activate or deactivate one, some or all relays
- Get the current relays status
Available functions:
- get_one: obtains the status of a single relay. Examples:
- get_all: obtains the status of all relays. Examples:
- set_one: activates or deactivates a single relay. On completion of action, input message with result is sent to output port. Examples:
- set: activates or deactivates some relays. On completion of action, input message with result is sent to output port.
- An 8-element array of one among the following:
- true: activates relay
- false: deactivates relay
- null: does not change the status of the relay
- set_all: activates or deactivates all relays. On completion of action, input message with result is sent to output port. Examples:
To obtain the status of the relay 0:
{"get_one": 0}
In this case, the response tells us that relay 0 is deactivated:
{"status": {"index":0, "value":false}}
To obtain the status of all relays:
{"get_all": "status"}
In this case, the first and fourth relays are activated:
{"all_status": [true, false, false, true, false, false, false, false] }
Activates relay 0:
{"set_one": {"index": 0, "value": true}}
Output tells us that relay 0 is activated:
{"status": {"index":0, "value":true}}
Deactivates relay 0:
{"set_one": {"index": 0, "value": false}}
Output tells us that relay 0 is deactivated:
{"status": {"index":0, "value":false}}
Parameters:
Activate the first and fourth relays and deactivate the eighth:
{"set": [true, null, null, true, null, null, null, false]}
Output tells us all relay status:
{"all_status":[true,true,true,true,false,true,false,false]}
To activate all relays:
{"set_all": true}
Output tells us all relay status:
{"all_status":[true,true,true,true,true,true,true,true]}
To deactivate all relays:
{"set_all": false}
Output tells us all relay status:
{"all_status":[false,false,false,false,false,false,false,false]}
10 Digital inputs Node-RED API
Connects to a 10DI eMOD module to manage the 10 digital inputs individually or jointly.
It allows to manage the following functionalities on the module:
- Configure module parameters
- Poll input status for one or all inputs
- Poll pulse counter for one or all inputs
- Reset pulse counters
Working modes:
10DI eMOD module can operate in two different ways: Poll mode and Event mode.
In Poll mode, user starts the flow and asks for data when he needs it.
In Event mode user configures certain condition when he wants to be notified and it is the module that notifies him when it has been met.
Module can operate in the following working modes:
- Poll
- [Event] Input value change: module notifies when a digital input changes
- [Event] Pulse count change: module notifies when the pulse counter surpases the threshold from last notification
Available functions:
- get_one (only in Poll mode): obtains the status or pulse count of a single digital input. Examples:
- get_all (only in Poll mode): obtains the status or pulse count of all digital inputs. Examples:
- reset_pulse_count: resets one or all inputs. Examples:
To obtain the status of a single digital input:
{"get_one": {"index": 3, "mode": "status"}}
In this case, fourth digital input is in high state:
{"status": {"index": 3, "value": true}}
To obtain the pulse count of a digital input:
{"get_one": {"index": 3, "mode": "pulse_count"}}
In this case, pulse count of fourth digital input is 15:
{"counter": {"index": 3, "value": 15}}
To obtain the status of all digital input:
{"get_all": "status"}
In this case, only fourth digital input is high state:
{"all_status": [false, false, false, true, false, false, false, false, false, false] }
To obtain the pulse count of all digital input:
{"get_all": "pulse_count"}
Function returns following pulse counts:
{"all_counters": [0, 5, 10, 2, 23, 5, 71, 3, 0, 0] }
Resets the ninth input:
{"reset_pulse_count": 8}
Resets all input:
{"reset_pulse_count": "all"}
7 Analog inputs and 2 power relays API
Connects to a 7AI+2PR eMOD module to manage the 7 analog inputs and 2 relays individually or jointly.
It allows to manage the following functionalities on the module:
- Set the pulse width for each relay
- Set the input mode (current or voltage) for each analog input and also the working mode
- Get the input value for one or all inputs
- Activate or deactivate one, some or all relays
- Get the current relays status
Working modes:
7AI can operate in two different ways: Poll mode and Event mode.
In Poll mode, user starts the flow and asks for data when he needs it.
In Event mode user configures certain condition when he wants to be notified and it is the module that notifies him when it has been met.
Module can operate in the following working modes:
- Poll
- [Event] Time interval: module keeps notifying values of all inputs in a fixed time interval
- [Event] Value threshold: module notifies when the measured value in any input surpases the threshold from last notification
- [Event] Value within range: module notifies when the measured value in any input enters within a value range
- [Event] Value out of range: module notifies when the measured value in any input falls out of a value range
2PR only can operate in Poll mode.
This module has 2 output: one for the relays and the other for the analog inputs.
Available functions for analog inputs :
- ai_get_one (only in Poll mode): obtains the value of a single analog input. Examples:
- ai_get_all (only in Poll mode): obtains the value of all analog inputs. Examples:
To obtain the value of a single analog input:
{"ai_get_one": 3}
In this case, fourth analog input is configured as voltage and its value is 3.1 V:
{"voltage": {"index": 3, "value": 3.1}}
To obtain the value of all analog inputs:
{"ai_get_all": "status"}
In this case, the first three inputs are configured as voltage and the rest as current. Each one has a different value:
{"values": [{"voltage": {"index": 0, "value": 5.2}}, {"voltage": {"index": 1, "value": 3.2}} , {"voltage": {"index": 2, "value": 4.8}}, {"current": {"index": 3, "value": 0.3}}, {"current": {"index": 4, "value": 0.2}}, {"current": {"index": 5, "value": 0.4}}, {"current": {"index": 6, "value": 0.3}} ]}
Available functions for relays:
- relay_get_one: obtains the status of a single relay. Examples:
- relay_get_all: obtains the status of all relays. Examples:
- relay_set_one: activates or deactivates a single relay. On completion of action, input message with result is sent to output port. Examples:
- relay_set: activates or deactivates some relays. On completion of action, input message with result is sent to output port.
- An 8-element array of one among the following:
- true: activates relay
- false: deactivates relay
- null: does not change the status of the relay
- relay_set_all: activates or deactivates all relays. On completion of action, input message with result is sent to output port. Examples:
To obtain the status of the relay 0:
{"relay_get_one": 0}
In this case, the response tells us that relay 0 is deactivated:
{"status": {"index":0, "value":false}}
To obtain the status of all relays:
{"relay_get_all": "status"}
In this case, only the first relay is activated:
{"all_status": [true, false] }
Activates relay 0:
{"relay_set_one": {"index": 0, "value": true}}
Output tells us that relay 0 is activated:
{"status": {"index":0, "value":true}}
Deactivates relay 0:
{"relay_set_one": {"index": 0, "value": false}}
Output tells us that relay 0 is deactivated:
{"status": {"index":0, "value":false}}
Parameters:
Activate the first and deactivate the second:
{relay_set: [true, false]}
Output tells us all relay status:
{"all_status":[true,false]}
To activate all relays:
{"relay_set_all": true}
Output tells us all relay status:
{"all_status":[true,true]}
To deactivate all relays:
{"relay_set_all": false}
Output tells us all relay status:
{"all_status":[false,false]}
12 Analog inputs Node-RED API
Connects to a 12AI eMOD module to manage the 12 analog inputs individually or jointly.
It allows to manage the following functionalities on the module:
- Set the input mode (current or voltage) for each analog input and also the working mode
- Get the input value for one or all inputs
Working modes:
12AI can operate in two different ways: Poll mode and Event mode.
In Poll mode, user starts the flow and asks for data when he needs it.
In Event mode user configures certain condition when he wants to be notified and it is the module that notifies him when it has been met.
Module can operate in the following working modes:
- Poll
- [Event] Time interval: module keeps notifying values of all inputs in a fixed time interval
- [Event] Value threshold: module notifies when the measured value in any input surpases the threshold from last notification
- [Event] Value within range: module notifies when the measured value in any input enters within a value range
- [Event] Value out of range: module notifies when the measured value in any input falls out of a value range
Available functions:
- ai_get_one (only in Poll mode): obtains the value of a single analog input. Examples:
- ai_get_all (only in Poll mode): obtains the value of all analog inputs. Examples:
To obtain the value of a single analog input:
{"ai_get_one": 3}
In this case, fourth analog input is configured as voltage and its value is 3.1 V:
{"voltage": {"index": 3, "value": 3.1}}
To obtain the value of all analog inputs:
{"ai_get_all": "status"}
In this case, the first three inputs are configured as voltage and the rest as current. Each one has a different value:
{"values": [{"voltage": {"index": 0, "value": 5.2}}, {"voltage": {"index": 1, "value": 3.2}} , {"voltage": {"index": 2, "value": 4.8}}, {"current": {"index": 3, "value": 0.3}}, {"current": {"index": 4, "value": 0.2}}, {"current": {"index": 5, "value": 0.4}}, {"current": {"index": 6, "value": 0.3}} ]}
5 digital inputs and 2 power relays API
Connects to a 5DI+2PR eMOD module to manage the 5 digital inputs and 2 relays individually or jointly.
It allows to manage the following functionalities on the module:
- Configure module parameters
- Get the input value for one or all inputs
- Poll input status for one or all inputs
- Poll pulse counter for one or all inputs
- Reset pulse counters
- Set the pulse width for each relay
- Activate or deactivate one, some or all relays
Working modes:
5DI eMOD module can operate in two different ways: Poll mode and Event mode.
In Poll mode, user starts the flow and asks for data when he needs it.
In Event mode user configures certain condition when he wants to be notified and it is the module that notifies him when it has been met.
Module can operate in the following working modes:
- Poll
- [Event] Input value change: module notifies when a digital input changes
- [Event] Pulse count change: module notifies when the pulse counter surpases the threshold from last notification
Available functions:
- di_get_one (only in Poll mode): obtains the status or pulse count of a single digital input. Examples:
- di_get_all (only in Poll mode): obtains the status or pulse count of all digital inputs. Examples:
- reset_pulse_count: resets one or all inputs. Examples:
To obtain the status of a single digital input:
{"di_get_one": {"index": 3, "mode": "status"}}
In this case, fourth digital input is in high state:
{"status": {"index": 3, "value": true}}
To obtain the pulse count of a digital input:
{"di_get_one": {"index": 3, "mode": "pulse_count"}}
In this case, pulse count of fourth digital input is 15:
{"counter": {"index": 3, "value": 15}}
To obtain the status of all digital input:
{"di_get_all": "status"}
In this case, only fourth digital input is high state:
{"all_status": [false, false, false, true, false, false, false, false, false, false] }
To obtain the pulse count of all digital input:
{"di_get_all": "pulse_count"}
Function returns following pulse counts:
{"all_counters": [0, 5, 10, 2, 23, 5, 71, 3, 0, 0] }
Resets the ninth input:
{"reset_pulse_count": 8}
Resets all input:
{"reset_pulse_count": "all"}
Available functions for relays:
- relay_get_one: obtains the status of a single relay. Examples:
- relay_get_all: obtains the status of all relays. Examples:
- relay_set_one: activates or deactivates a single relay. On completion of action, input message with result is sent to output port. Examples:
- relay_set: activates or deactivates some relays. On completion of action, input message with result is sent to output port.
- An 2-element array of one among the following:
- true: activates relay
- false: deactivates relay
- null: does not change the status of the relay
- relay_set_all: activates or deactivates all relays. On completion of action, input message with result is sent to output port. Examples:
To obtain the status of the relay 0:
{"relay_get_one": 0}
In this case, the response tells us that relay 0 is deactivated:
{"status": {"index":0, "value":false}}
To obtain the status of all relays:
{"relay_get_all": "status"}
In this case, only the first relay is activated:
{"all_status": [true, false] }
Activates relay 0:
{"relay_set_one": {"index": 0, "value": true}}
Output tells us that relay 0 is activated:
{"status": {"index":0, "value":true}}
Deactivates relay 0:
{"relay_set_one": {"index": 0, "value": false}}
Output tells us that relay 0 is deactivated:
{"status": {"index":0, "value":false}}
Parameters:
Activate the first and deactivate the second:
{"relay_set": [true, false]}
Output tells us all relay status:
{"all_status":[true,false]}
To activate all relays:
{"relay_set_all": true}
Output tells us all relay status:
{"all_status":[true,true]}
To deactivate all relays:
{"relay_set_all": false}
Output tells us all relay status:
{"all_status":[false,false]}
SuperCap Node
Notifies when there is a change in the power source of the device.
It has one output:
- Power source change: Notifies when power source switches from external power (AC) to internal (supercap module if present)
Restrictions
Working mode
- Each module can only be configured in polling mode or event mode, but never with both work modes at the same time.
- In polling mode there can be as many nodes as we need
- In event mode there can only be one node, which is the one that receives the events
RECOMMENDATION
Create only one configuration node (e.g. 10DI-Config). If several are created only one will be active.