Configuring sensors

Advantech Node-RED Flow

Replace the four highlighted values with your own (the LAN IP Address and three certificate pathnames).


[
    {
        "id": "cd60df85.345da",
        "type": "mqtt in",
        "z": "d8c2d3cd.2d365",
        "name": "Local",
        "topic": "BB/+/data",
        "qos": "0",
        "broker": "87efea0c.b52cb8",
        "x": 70,
        "y": 40,
        "wires": [
            [
                "2170203b.f52b1"
            ]
        ]
    },
    {
        "id": "f19bac60.ac00d",
        "type": "mqtt out",
        "z": "d8c2d3cd.2d365",
        "name": "Solve",
        "topic": "$aws/rules/default",
        "qos": "0",
        "retain": "",
        "broker": "fa9fd6f7.a3a318",
        "x": 470,
        "y": 40,
        "wires": []
    },
    {
        "id": "2170203b.f52b1",
        "type": "json",
        "z": "d8c2d3cd.2d365",
        "name": "JSON",
        "x": 190,
        "y": 40,
        "wires": [
            [
                "43841917.1bea48"
            ]
        ]
    },
    {
        "id": "e9dbea72.7640b8",
        "type": "debug",
        "z": "d8c2d3cd.2d365",
        "name": "Debug",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 472,
        "y": 109,
        "wires": []
    },
    {
        "id": "43841917.1bea48",
        "type": "function",
        "z": "d8c2d3cd.2d365",
        "name": "Enhance",
        "func": "// add reporting module id\nvar thisTopic = msg.topic;\nvar thisIndex = thisTopic.indexOf(\"BB/\");\nvar moduleId = thisTopic.substr(thisIndex +3, 16);\nmsg.payload[\"mod\"] = moduleId;\n\n// add kW\nif (! isNaN (msg.payload.ai1)) msg.payload[\"ai1\"] = +(parseFloat(msg.payload.ai1)/1000*120/1000).toFixed(3);\nif (! isNaN (msg.payload.ai2)) msg.payload[\"ai2\"] = +(parseFloat(msg.payload.ai2)/1000*120/1000).toFixed(3);\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 320,
        "y": 40,
        "wires": [
            [
                "f19bac60.ac00d",
                "e9dbea72.7640b8"
            ]
        ]
    },
    {
        "id": "87efea0c.b52cb8",
        "type": "mqtt-broker",
        "z": "",
        "broker": "192.168.1.1",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": true,
        "keepalive": "60",
        "cleansession": true,
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": ""
    },
    {
        "id": "fa9fd6f7.a3a318",
        "type": "mqtt-broker",
        "z": "",
        "broker": "mqtt.solve360.com",
        "port": "8883",
        "tls": "6b04529c.4b332c",
        "clientid": "",
        "usetls": true,
        "compatmode": true,
        "keepalive": "60",
        "cleansession": true,
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": ""
    },
    {
        "id": "6b04529c.4b332c",
        "type": "tls-config",
        "z": "",
        "name": "Solve",
        "cert": "/home/lxcroot/9932d07a99-crt.txt",
        "key": "/home/lxcroot/9932d07a99-key.txt",
        "ca": "/home/lxcroot/9932d07a99-ca.txt",
        "verifyservercert": false
    }
]