[FLOW] Fetching data from factoryinsight

This tutorial explains how to extract data from FactoryInsight and calculate the Overall Equipment Efficiency (OEE) of machines, which can be used to create production dashboards and other tools.

[FLOW] Fetching data from factoryinsight
ℹ️
This flow was provided by the community member Onur and is not coming from our team. If you have any questions, feel free to write him on Discord.

In manufacturing, it is important to monitor the performance of machines to improve production efficiency. One way to do this is by calculating the Overall Equipment Efficiency (OEE) of machines. FactoryInsight is an API that provides data on machine performance and can be used to calculate OEE. This tutorial will guide you through the process of extracting data from FactoryInsight and calculating OEE using Node-RED.

Instructions

  1. Open the Node-RED browser interface through <IP of the installation device>:1880/nodered when you are using the United Manufacturing Hub.
  2. Click on the three horizontal lines on the upper right corner to open the menu and select Import.
  3. Copy the following code and paste it in the dialog box:
[
    {
        "id": "6e90fd64e1e6a384",
        "type": "tab",
        "label": "Onur prototype",
        "disabled": false,
        "info": ""
    },
    {
        "id": "f720f16004d56efd",
        "type": "http request",
        "z": "6e90fd64e1e6a384",
        "name": "",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "x": 660,
        "y": 420,
        "wires": [
            [
                "18237fd55d51d160"
            ]
        ]
    },
    {
        "id": "b28fc506f7fe8fdd",
        "type": "function",
        "z": "6e90fd64e1e6a384",
        "name": "",
        "func": "// note: there are some functions in the \"start\" section of this node\n\nlet location = \"testserver\"\nlet asset = \"jeremy\"\nlet valueName = \"orderTable\"\n\nlet from = new Date().removeHours(1)\nlet to = new Date()\n\nmsg.url = \"http://united-manufacturing-hub-factoryinsight-service/api/v1/factoryinsight/\" + location + \"/\" + asset + \"/\" + valueName + \"?from=\" + from.toISOString() + \"&to=\" + to.toISOString();\n\nmsg.headers = {}\n\n// The value for this can be found in Lens under secrets --> factoryinsight-secret --> apiKey\nmsg.headers[\"Authorization\"] = \"Basic ZmFjdG9yeWluc2lnaHQ6NjdjNDBlZGEtOGI5MS00NzM0LTllYWItZTQ1NTJjZTUyZWZl\"\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "\nDate.prototype.addHours = function(h) {\n  this.setTime(this.getTime() + (h*60*60*1000));\n  return this;\n}\n\nDate.prototype.removeHours = function(h) {\n  this.setTime(this.getTime() - (h*60*60*1000));\n  return this;\n}",
        "finalize": "",
        "libs": [],
        "x": 470,
        "y": 420,
        "wires": [
            [
                "f720f16004d56efd"
            ]
        ]
    },
    {
        "id": "42089e12117ba295",
        "type": "inject",
        "z": "6e90fd64e1e6a384",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 290,
        "y": 420,
        "wires": [
            [
                "b28fc506f7fe8fdd"
            ]
        ]
    },
    {
        "id": "d77c61a0aa0c7cfb",
        "type": "debug",
        "z": "6e90fd64e1e6a384",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1110,
        "y": 420,
        "wires": []
    },
    {
        "id": "18237fd55d51d160",
        "type": "json",
        "z": "6e90fd64e1e6a384",
        "name": "",
        "property": "payload",
        "action": "",
        "pretty": false,
        "x": 870,
        "y": 420,
        "wires": [
            [
                "d77c61a0aa0c7cfb"
            ]
        ]
    }
]

Read next

Node-RED meets Benthos!
benthos · Featured

Node-RED meets Benthos!

Yes, we’ve made it possible to bring Node-RED-style simplicity into Benthos pipelines, enabling your chosen LLM to handle tedious manufacturing connectivity and contextualization tasks—whether you’re prototyping or managing production-grade data flows.

Share, Engage, and Contribute!

Discover how you can share your ideas, contribute to our blog, and connect with us on other platforms.