[
    {
        "id": "2d06970981119a56",
        "type": "tab",
        "label": "Change product or line-item",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "0fe2f906f950154a",
        "type": "inject",
        "z": "2d06970981119a56",
        "name": "Data input",
        "props": [],
        "repeat": "",
        "crontab": "00 12 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 230,
        "y": 180,
        "wires": [
            [
                "c254e04714c4fb75"
            ]
        ]
    },
    {
        "id": "c254e04714c4fb75",
        "type": "change",
        "z": "2d06970981119a56",
        "name": "Mapping changeover attributes",
        "rules": [
            {
                "t": "set",
                "p": "product",
                "pt": "msg",
                "to": "",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "locationID",
                "pt": "msg",
                "to": "",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "tabletID",
                "pt": "msg",
                "to": "",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "timestamp",
                "pt": "msg",
                "to": "",
                "tot": "date"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 470,
        "y": 180,
        "wires": [
            [
                "82f5bca21ec635ef"
            ]
        ]
    },
    {
        "id": "bf06063c7959013f",
        "type": "comment",
        "z": "2d06970981119a56",
        "name": "^^ set changeover attributes",
        "info": "",
        "x": 460,
        "y": 220,
        "wires": []
    },
    {
        "id": "de4a03e89217435d",
        "type": "comment",
        "z": "2d06970981119a56",
        "name": "Replace the Data input with your source and data transformation",
        "info": "",
        "x": 390,
        "y": 140,
        "wires": []
    },
    {
        "id": "bd8bd3e9df37f162",
        "type": "mqtt out",
        "z": "2d06970981119a56",
        "name": "Send to oee.ai",
        "topic": "",
        "qos": "1",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "248a8bfc78b28170",
        "x": 980,
        "y": 180,
        "wires": []
    },
    {
        "id": "724f478621dc25ef",
        "type": "inject",
        "z": "2d06970981119a56",
        "name": "Data input",
        "props": [],
        "repeat": "",
        "crontab": "00 12 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 230,
        "y": 480,
        "wires": [
            [
                "4561bb9e352738e9"
            ]
        ]
    },
    {
        "id": "4561bb9e352738e9",
        "type": "change",
        "z": "2d06970981119a56",
        "name": "Mapping changeover attributes",
        "rules": [
            {
                "t": "set",
                "p": "lineitem",
                "pt": "msg",
                "to": "",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "locationID",
                "pt": "msg",
                "to": "",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "tabletID",
                "pt": "msg",
                "to": "",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "timestamp",
                "pt": "msg",
                "to": "",
                "tot": "date"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 470,
        "y": 480,
        "wires": [
            [
                "49f4e8c258adf304"
            ]
        ]
    },
    {
        "id": "eeccdd9849b3f929",
        "type": "comment",
        "z": "2d06970981119a56",
        "name": "^^ set changeover attributes",
        "info": "",
        "x": 460,
        "y": 520,
        "wires": []
    },
    {
        "id": "401670a1a62dc91f",
        "type": "comment",
        "z": "2d06970981119a56",
        "name": "Replace the Data input with your source and data transformation",
        "info": "",
        "x": 390,
        "y": 440,
        "wires": []
    },
    {
        "id": "7e1540b677bf66c4",
        "type": "mqtt out",
        "z": "2d06970981119a56",
        "name": "Send to oee.ai",
        "topic": "",
        "qos": "1",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "248a8bfc78b28170",
        "x": 980,
        "y": 480,
        "wires": []
    },
    {
        "id": "1d5e3a2534eba6a9",
        "type": "comment",
        "z": "2d06970981119a56",
        "name": "Product Changeover",
        "info": "",
        "x": 250,
        "y": 100,
        "wires": []
    },
    {
        "id": "8dd8401d192db217",
        "type": "comment",
        "z": "2d06970981119a56",
        "name": "Line Item Changeover",
        "info": "",
        "x": 260,
        "y": 400,
        "wires": []
    },
    {
        "id": "82f5bca21ec635ef",
        "type": "function",
        "z": "2d06970981119a56",
        "name": "Formatting json payload",
        "func": "const time = new Date(msg.timestamp).toISOString();\n\nmsg.topic = \"oee/tablet/\"+msg.tabletID+\"/changeover\"\nmsg.payload = {\n    \"data\": {\n        \"type\": \"changeovers\",\n        \"attributes\": {\n            \"time\": time\n        },\n        \"relationships\": {\n            \"product\": {\n                \"data\": {\n                    \"id\": msg.product\n                }\n            },\n            \"location\": {\n                \"data\": {\n                    \"id\": msg.locationID\n                }\n            }\n        }\n    }\n}\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 750,
        "y": 180,
        "wires": [
            [
                "bd8bd3e9df37f162"
            ]
        ]
    },
    {
        "id": "49f4e8c258adf304",
        "type": "function",
        "z": "2d06970981119a56",
        "name": "Formatting json payload",
        "func": "const time = new Date(msg.timestamp).toISOString();\n\nmsg.topic = \"oee/tablet/\"+msg.tabletID+\"/changeover\"\nmsg.payload = {\n    \"data\": {\n        \"type\": \"changeovers\",\n        \"attributes\": {\n            \"time\": time\n        },\n        \"relationships\": {\n            \"line-item\": {\n                \"data\": {\n                    \"id\": msg.lineitem\n                }\n            },\n            \"location\": {\n                \"data\": {\n                    \"id\": msg.locationID\n                }\n            }\n        }\n    }\n}\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 750,
        "y": 480,
        "wires": [
            [
                "7e1540b677bf66c4"
            ]
        ]
    },
    {
        "id": "248a8bfc78b28170",
        "type": "mqtt-broker",
        "name": "Server",
        "broker": "mqtt.oee.ai",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }
]
