@autocodingsystems/node-red-contrib-integration

3.4.1 • Public • Published

ACS Node Red Utils

Utility nodes for making workflows using the ACS Gateway

Nodes available

Gateway

Gateway nodes allow specific actions to be taken on an ACS Gateway.

  • gateway-device-resolve find a named device across multiple gateways
  • gateway-device-update sends a job to a device
  • gateway-device-clear clear the job from a device
  • gateway-event receive events from a gateway

Flow

A "flow" is a controlled sequence for always running processes.

Messages originate from a begin node and flow towards an end node. Once reached, a new message will be emitted from the begin node, making a never ending sequence of messages. A new message will not be emitted from begin until the previous message has hit an end, meaning there is only ever a single message in the flow.

If a flow message is split between 2 or more paths, the first message to hit an end node invalidates all other messages originating from the original begin message.

A message that has been invalidated will not pass through an inactive node, so you can kill dead messages before they take any action by ensuring the action is guarded by these nodes.

Flow messages can be trapped in a trap node and released at a later date by specially crafted release messages or http requests. A trapped message will be immediately destroyed if a sibling flow message hits an end node. A trap node can only hold one message at a time.

  • begin signals the start of message flow.
  • end terminates the current message flow and starts a new one.
  • isactive only passes messages that are part of an active message flow.
  • trap hold on to a message until it is released or until the flow is ended.
  • route send flow messages to one output or the other - is toggled by sending control messages to the node.

Miscellany

General nodes for handling common situations

  • array-split a simplified version of the split node that only supports arrays and has a dedicated "empty" output so that the associated array-join node can be triggered correctly even if there are no items in the array.
  • array-join wait for all the messages from the previous array-split to arrive, collate their payloads and carry on processing. Also wire the "empty" output from the array-split to the input to carry on processing if the array was empty.

Example flow for reporting

[
    {
        "id": "a8214027.9a1af",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": ""
    },
    {
        "id": "6c3fffae.55e7",
        "type": "vision-inspection-receive",
        "z": "a8214027.9a1af",
        "name": "",
        "server": "eb5561b.8f601a",
        "x": 150,
        "y": 140,
        "wires": [
            [],
            [],
            [
                "d813a864.50e5b8"
            ],
            [
                "a7139310.1bc3e"
            ],
            [],
            [
                "d560af39.23e9e"
            ]
        ]
    },
    {
        "id": "d813a864.50e5b8",
        "type": "function",
        "z": "a8214027.9a1af",
        "name": "Increment batch",
        "func": "let batchid = flow.get('batchid') || 0\n\nbatchid = batchid + 1\nif (batchid > 255) batchid = 1\n\nmsg.payload.batchid = batchid\n\nflow.set('batchid', batchid)\nflow.set('inbatch', true)\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 440,
        "y": 100,
        "wires": [
            [
                "7c1b5b76.02fcf4"
            ]
        ]
    },
    {
        "id": "7c1b5b76.02fcf4",
        "type": "vision-inspection-send",
        "z": "a8214027.9a1af",
        "name": "",
        "server": "eb5561b.8f601a",
        "x": 740,
        "y": 140,
        "wires": []
    },
    {
        "id": "a7139310.1bc3e",
        "type": "function",
        "z": "a8214027.9a1af",
        "name": "Clear batch",
        "func": "msg.payload.batchid = 0\nflow.set('inbatch', false)\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 430,
        "y": 140,
        "wires": [
            [
                "7c1b5b76.02fcf4"
            ]
        ]
    },
    {
        "id": "d560af39.23e9e",
        "type": "function",
        "z": "a8214027.9a1af",
        "name": "Build report",
        "func": "let batchid = flow.get('batchid') || 0\nlet inbatch = flow.get('inbatch') || false\n\nif (!batchid || !inbatch) { return msg }\n\nmsg.payload.batchid = batchid\nmsg.payload.parameters.push({\n    name: 'BatchId',\n    value: batchid\n})\n        \nmsg.payload.parameters.push({\n    name: 'Data Descriptor Name 3',\n    value: 88\n})\n\nmsg.payload.events.push({\n    name: 'FirstEvent',\n    parameters: [{\n        name: 'An Event',\n        value: 'Some value 58'\n    }]\n})\n\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 430,
        "y": 180,
        "wires": [
            [
                "7c1b5b76.02fcf4"
            ]
        ]
    },
    {
        "id": "eb5561b.8f601a",
        "type": "vision-inspection-config",
        "z": "",
        "port": "3111",
        "firmware": "Node-red implemented vision inspection system",
        "version": "1.0",
        "connectionmode": "single",
        "initialisemode": "auto",
        "updatemode": "manual",
        "clearmode": "manual",
        "resetmode": "auto",
        "reportmode": "manual",
        "datadescriptor": "#BatchEvent=FirstEvent    \n#\n    Name=An Event\n    Description=Just some event\n    Type=String\n    InformationType=Event\n    ReportingClass=Special:FirstEvent\n    #\n    Name=BatchId\n    Description=Visualise the batch id\n    Type=Decimal\n    InitialValue=0\n    InformationType=BatchSpecific_Fixed\n    ReportingClass=Special\n    #\n    Name=Data Descriptor Name 3\n    Description=Description of Data Descriptor Name 3\n    Type=Decimal\n    InitialValue=0\n    InformationType=BatchSpecific_Variable\n    ReportingClass=Special\n",
        "name": "Virtual Device A"
    }
]]

Readme

Keywords

Package Sidebar

Install

npm i @autocodingsystems/node-red-contrib-integration

Weekly Downloads

2

Version

3.4.1

License

ISC

Unpacked Size

238 kB

Total Files

33

Last publish

Collaborators

  • autocodingadmin