@circutor/node-red-contrib-emod-grpc 1.0.3
A gRPC client for emod grpc
node-red-contrib-emod-grpc
Node-RED package to integrate eManager expansion modules over gRPC to monitor and control digital & analogue inputs, relays, energy meters, temperature sensors and more. eManager is an OEM industrial controller built with eMOD, the industrial modular hardware technology.
The eManager Platform is an open source embedded platform, built on Linux and designed for easy develop industrial and edge computing applications. It's ready to run, build, and IoT connect out-of-the-box.
Installation
You can install the nodes using node-red's "Manage palette" in the side bar.
Or run the following command in the root directory of your Node-RED installation
npm install node-red-contrib-emod-grpc --save
Usage
All module nodes require a eMod-gRPC-Server configuration node that defines the gRPC server address and port. The server node manages the connection, keepalive, and automatic reconnection — dependent nodes receive server-up / server-down messages when the connection state changes.
Each module node can operate in Poll mode (request data on demand via input messages) or in Event mode (the module pushes data when a configured condition is met). The available event modes vary per module type.
Supercap
Connects to a Supercap eMOD module to monitor the external power source status and to trigger a controlled power-off.
This node has 1 output: Power source change.
Working modes
- Event: the module streams a notification whenever the external power state changes.
Available functions
power_off: triggers a controlled power-off of the system. Only executes when the value is truthy.
Example:
{"power_off": true}
5DI+2PR (5 Digital Inputs + 2 Power Relays)
Connects to a 5DI+2PR eMOD module to manage 5 digital inputs and 2 relays individually or jointly.
This node has 2 outputs: Digital inputs and Relays.
Working modes
- Poll
- [Event] Time interval: module reports all input statuses at a fixed time interval
- [Event] Input value change: module notifies when a digital input changes
- [Event] Pulse count change: module notifies when the pulse counter surpasses the threshold from last notification
Available functions for digital inputs
di_get_one (Poll mode only): obtains the status or pulse count of a single digital input.
Examples:
To obtain the status of a single digital input:
{"di_get_one": {"index": 3, "mode": "status"}}Response:
{"status": {"index": 3, "value": true}}To obtain the pulse count:
{"di_get_one": {"index": 3, "mode": "pulse_count"}}Response:
{"counter": {"index": 3, "value": 15}}di_get_all (Poll mode only): obtains the status or pulse count of all digital inputs.
Examples:
To obtain the status of all digital inputs:
{"di_get_all": "status"}Response:
{"all_status": [false, false, false, true, false]}To obtain the pulse count of all digital inputs:
{"di_get_all": "pulse_count"}Response:
{"all_counters": [0, 5, 10, 2, 23]}reset_pulse_count: resets one or all pulse counters.
Examples:
Reset the third input:
{"reset_pulse_count": 2}Reset all inputs:
{"reset_pulse_count": "all"}
Available functions for relays
relay_get_one: obtains the status of a single relay.
{"relay_get_one": 0}Response:
{"status": {"index": 0, "value": false}}relay_get_all: obtains the status of all relays.
{"relay_get_all": "status"}Response:
{"all_status": [true, false]}relay_set_one: activates or deactivates a single relay.
{"relay_set_one": {"index": 0, "value": true}}Response:
{"status": {"index": 0, "value": true}}relay_set: activates or deactivates some relays. Use
trueto activate,falseto deactivate, ornullto leave unchanged.{"relay_set": [true, false]}Response:
{"all_status": [true, false]}relay_set_all: activates or deactivates all relays.
{"relay_set_all": true}Response:
{"all_status": [true, true]}
7AI+2PR (7 Analog Inputs + 2 Power Relays)
Connects to a 7AI+2PR eMOD module to manage 7 analog inputs and 2 relays individually or jointly.
Each analog input can be configured as voltage or current mode. Relay pulse width is configurable.
This node has 2 outputs: Analog inputs and Relays.
Working modes
Analog inputs:
- Poll
- [Event] Time interval: module keeps notifying values of all inputs at a fixed time interval
- [Event] Value threshold: module notifies when the measured value in any input surpasses 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
Relays operate in Poll mode only.
Available functions for analog inputs
ai_get_one (Poll mode only): obtains the value of a single analog input.
{"ai_get_one": 3}Response (when configured as voltage):
{"voltage": {"index": 3, "value": 3.1}}Response (when configured as current):
{"current": {"index": 3, "value": 0.3}}ai_get_all (Poll mode only): obtains the value of all analog inputs.
{"ai_get_all": "status"}Response:
{"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
Same as 5DI+2PR relay functions (2 relays).
3DI+2AI+1T+2SR (3 Digital Inputs + 2 Analog Inputs + 1 Temperature Sensor + 2 Signal Relays)
Connects to a 3DI+2AI+1T+2SR eMOD module to manage 3 digital inputs, 2 analog inputs, 1 temperature sensor and 2 relays.
This node has 4 outputs: Digital inputs, Analog inputs, Thermometers and Relays.
Working modes
Digital inputs, analog inputs, and the temperature sensor each have independent event mode configuration:
Digital inputs:
- Poll
- [Event] Time interval
- [Event] Input value change
- [Event] Pulse count change
Analog inputs:
- Poll
- [Event] Time interval
- [Event] Value threshold
- [Event] Value within range
- [Event] Value out of range
Temperature sensor:
- Poll
- [Event] Time interval
- [Event] Value threshold
- [Event] Value within range
- [Event] Value out of range
Relays operate in Poll mode only.
Available functions
Digital input functions (di_get_one, di_get_all, reset_pulse_count) and relay functions (relay_get_one, relay_get_all, relay_set_one, relay_set, relay_set_all) work the same as in the 5DI+2PR module, adjusted for 3 digital inputs and 2 relays.
Analog input functions (ai_get_one, ai_get_all) work the same as in the 7AI+2PR module, adjusted for 2 analog inputs.
Temperature sensor functions
temp_get_one (Poll mode only): obtains the temperature reading from the sensor.
{"temp_get_one": {"index": 0}}Response:
{"status": {"index": 0, "value": 23.45, "error": "NONE"}}If the sensor is unplugged:
{"index": 0, "value": 0, "status": "UNPLUGGED"}If the sensor is wrongly configured:
{"index": 0, "value": 0, "status": "WRONG_CONFIGURATION"}
EM3 (3-Phase Energy Meter)
Connects to an EM3 eMOD module to read power and energy parameters from a 3-phase energy meter.
This node has 1 output.
Working modes
- Poll
- [Event] Time interval: module streams all meter readings at a fixed time interval (minimum 1000 ms)
Configuration
The EM3 configuration node allows setting:
- Work mode and metering standard
- Current full scale and secondary current full scale per phase (L1, L2, L3)
- Voltage full scale and secondary voltage full scale per phase
- Current direction per phase
Available functions (Poll mode only)
power_get_one: obtains power parameters for a single phase.
{"power_get_one": {"phase": 1}}Response includes: voltage, current, frequency, cosine, angle, active/apparent/reactive power (imported and exported), and maximeter.
power_get_combined: obtains combined power parameters across all phases.
{"power_get_combined": true}Response includes: neutral current, power factor, neutral angle, phase rotation, active/apparent/reactive power (imported and exported), and maximeter.
power_get_all: obtains power parameters for all 3 phases plus the combined values in a single call.
{"power_get_all": true}energy_get_one: obtains energy parameters for a single phase.
{"energy_get_one": {"phase": 1}}Response includes: active/apparent/inductive/capacitive energy (imported and exported).
energy_get_combined: obtains combined energy parameters across all phases.
{"energy_get_combined": true}energy_get_all: obtains energy parameters for all 3 phases plus the combined values in a single call.
{"energy_get_all": true}reset: resets all energy meters. After resetting, automatically returns the energy values for all phases.
{"reset": true}