Machinechat Bridge for Node-RED
The Machinechat Bridge for Node-RED is a powerful tool that seamlessly integrates your Node-RED workflows with the robust features of Machinechat JEDI. This bridge enables you to leverage the ease of development in Node-RED for prototyping and seamlessly transition your projects to a production-ready environment with JEDI's industrial-grade data management, visualization, security, and integration capabilities.

Note
Machinechat Bridge requires Machinechat JEDI v3.8.5 or newer.
Key Features
-
Seamless Node-RED Integration
The Bridge integrates as a simple node within your Node-RED flows, offering a transparent connection to JEDI.
-
Customizable Decoding
JavaScript files enable full control over how your data is decoded by JEDI, ensuring compatibility with your unique data formats.
-
Scalable Design
Add multiple Bridge nodes, with flexible use of the same or different JavaScript decoders, to handle complex data streams and evolving project needs.
-
Straightforward Configuration
Minimal setup is required – just provide JEDI's host address, port number, and a unique identifier to start bridging data.
Benefits
- Streamlined Data Management: Shift decoding and data source management to JEDI, reducing the complexity of Node-RED flows and simplifying long-term maintenance.
- Potential Performance Gains: Benefit from increased compute power for decoding and processing, particularly when JEDI run on more powerful hardware than the Node-RED gateway.
- Best of Both Worlds: Retain Node-RED's ease of prototyping while unlocking JEDI's industrial-grade features for data management, visualization, and security.
- Focus on Core IoT Functionalities: Keep your Node-RED flows streamlined and focus on core application logic, letting JEDI handle the advanced data processing.
Getting Started with Machinechat Bridge for Node-RED
Step 1: Install the Machinechat Bridge Node
The Machinechat Bridge for Node-RED is now conveniently available within the official Node-RED directory, simplifying the installation process. Here's a step-by-step guide to find and install the bridge node:
1. Access your Node-RED Instance:
- Open a web browser and navigate to the URL where your Node-RED instance is running. This is typically
http://localhost:1880
if you haven't changed the default port.
2. Enter the Manage Palette Menu:
- Click on the hamburger menu (three horizontal lines) in the top right corner of the Node-RED interface.
- From the dropdown menu, select "Manage palette".

3. Access the Install Tab:
- Within the "Manage palette" window, you'll see two tabs: "Installed" and "Install". Click on the "Install" tab.
4. Search for "Machinechat Bridge":
- In the search bar located within the "Install" tab, type "Machinechat Bridge".

5. Locate and Install the Bridge:
- You should see the "Machinechat Bridge" node appear in the search results. Look for the node developed by "@machinechat" (important to ensure you're installing the correct bridge).
- Click on the "install" button next to the "Machinechat Bridge" node.

6. Confirmation and Use:
- Node-RED will display a confirmation message upon successful installation.
- Close the "Manage palette" window.
The Machinechat Bridge for Node-RED is now ready to be used in your Node-RED flows! For detailed information and usage instructions, refer to the official documentation: Link to Machinechat Bridge for Node-RED documentation: https://flows.nodered.org/node/@machinechat/node-red-node-machinechat-bridge.
Step 2: Add the Bridge to Your Flow
Drag and drop the Machinechat Bridge node to the desired location within your Node-RED flow where you want data to be forwarded to JEDI.
Step 3: Configure the Bridge

In the Bridge node configuration window, provide the following details:
-
Host Address: The IP address or hostname of the server running Machinechat JEDI.
-
Port Number: The TCP/IP port number on which JEDI is listening for incoming data.
-
Unique Identifier: A user-defined unique identifier for this specific Bridge node. This will be used by JEDI to select a JavaScript file to load for processing incoming Node-RED messages.
Step 4: Create a JavaScript Decoder File (nodered-unique-identifier.js)
JEDI utilize JavaScript files to decode the incoming Node-RED message ("msg") object into an internal normalized format.
Create a new JavaScript file and name it according to the following convention: nodered-<unique-identifier>.js
, where <unique-identifier>
matches the unique identifier you configured in step 3.
For example, if the Unique Identifier
is "openweathermaps", JEDI will look for the file nodered-openweathermaps.js in the codecs
folder under JEDI's installation directory, and call the decode function in this JavaScript file to decode the "msg" object that was received by Machinechat Bridge.
Step 5: Implement the decode
Function
Within the JavaScript file, implement a function named decode
. This function will receive the Node-RED message ("msg") object as input, along with additional context information provided by the bridge. The decode
function should perform the necessary transformations on the "msg" object to extract the metrics. The function should return a modified "msg" object along with the "mc" (Machinechat) object containing the decoded metrics.
Here is an example decode
function in nodered-openweathermaps.js
file.
The decode
function receives the following input parameters when it is called.
context
: A reserved field for future use.input
: The object forwarded byMachinechat Bridge
. Theinput
format is:timestamp
: The timestamp when the "msg" was received byMachinechat Bridge
.unique_identifier
: The unique_indentifier fromMachinechat Bridge
configuration.node_red_version
: Node-RED version.
{
"machinechat_context" : {
"timestamp": ...,
"unique_identifier": ...
},
"node_red_context" : {
"node_red_version" : ...
},
"msg" : {
...
}
}
decode
function in the JavaScript file implements the logic to decode the "msg" object and extracts metrics.
Each metric is an object:
value
: The metric's value.stype
: Semantic type (optional - for custom data types)ptype
: Primitive type. Supported "float64", "bool", "string"
Example metric
object:
The decoded metrics are stored in the map mc.metrics
with the metric name as the key and metric object as value.
The mc
object is placed inside the machinechat_context
object. The mc
object is read by JEDI to collect metrics.
Here is a sample JavaScript decoder file nodered-openweathermaps.js
that decodes the "msg" sent by the Open Weather Maps node to Machinechat JEDI bridge and extracts metrics
that are read by JEDI.
function decode(context, input) {
payload = input.msg.payload;
let metricsData = payload.main;
const desiredFormat = {};
// Loop through each key-value pair in the "main" object
for (const key in metricsData) {
// Create a new object for each property
desiredFormat[key] = {};
// Handle temperature-related values: round to nearest integer
if (
key === "temp" ||
key === "feels_like" ||
key === "temp_min" ||
key === "temp_max"
) {
desiredFormat[key].value = Math.round(metricsData[key]);
} else {
// For other properties, copy the value directly
desiredFormat[key].value = metricsData[key];
}
// Assign common properties (stype, ptype, units, precision)
desiredFormat[key].stype = "number";
desiredFormat[key].ptype = "float64";
// Set units based on the property (assuming temperature in Celsius)
desiredFormat[key].units = key === "humidity" ? "%" : "°C";
desiredFormat[key].precision = 2;
}
input.machinechat_context["mc"] = {
nodeID: "Sensor1",
metrics: desiredFormat,
};
return input;
}
You can now add metrics to dashboards, create rules, and more...
Need help or have a question?
Contact our support team: support@machinechat.io