[ { "id": "48acf0a74b57fcc9", "type": "tab", "label": "Flow 5", "disabled": false, "info": "" }, { "id": "2e20d6086aa2abc8", "type": "postgres", "z": "48acf0a74b57fcc9", "postgresdb": "f368632229c86926", "name": "PgData", "output": true, "perrow": false, "rowspermsg": "1", "return_on_error": false, "limit_queries": "0", "limit_by": "payload", "limit_value": "1", "limit_drop_intermediate": false, "limit_drop_if_in_queue": false, "outputs": true, "x": 800, "y": 320, "wires": [ [] ] }, { "id": "d529a78a2e573d90", "type": "inject", "z": "48acf0a74b57fcc9", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payloadType": "date", "x": 140, "y": 120, "wires": [ [ "4a76f8c584e41fb2", "15b28e14c0288025", "4217e30cd0c26996", "e07778d9b2c8fb02" ] ] }, { "id": "4a76f8c584e41fb2", "type": "s7comm read", "z": "48acf0a74b57fcc9", "connection": "8243af575e4cc6d1", "payload": "{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"W\",\"S7_Offset\":\"0\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"Data1\"}", "s7Name": "Data1", "topic": "", "name": "", "signalSetted": false, "none": "true", "repeat": "", "once": false, "x": 380, "y": 120, "wires": [ [ "3b60fa3d52f17542" ] ] }, { "id": "5e6689052a9c45e6", "type": "comment", "z": "48acf0a74b57fcc9", "name": "Read from PLC", "info": "", "x": 140, "y": 40, "wires": [] }, { "id": "20cc6b5c533c30e6", "type": "function", "z": "48acf0a74b57fcc9", "name": "Write to PostgreSQL", "func": "var a = global.get('value1');\nvar b = global.get('value2');\nvar c = global.get('value3');\nvar now = new Date().toLocaleString(\"DE\");\n\nmsg.payload = \"INSERT INTO temperature (speed1,speed2,speed3) VALUES (\"+a+\",\"+b+\",\"+c+\");\"\nreturn msg;\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 580, "y": 320, "wires": [ [ "2e20d6086aa2abc8", "f5e2c8b9af25420c" ] ] }, { "id": "3b60fa3d52f17542", "type": "split", "z": "48acf0a74b57fcc9", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": "2", "arraySpltType": "len", "stream": false, "addname": "parse1", "x": 550, "y": 120, "wires": [ [ "97b8418a2b3c7f7a", "f5e2c8b9af25420c" ] ] }, { "id": "97b8418a2b3c7f7a", "type": "function", "z": "48acf0a74b57fcc9", "name": "", "func": "global.set('value1',msg.payload);\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 740, "y": 120, "wires": [ [] ] }, { "id": "15b28e14c0288025", "type": "s7comm read", "z": "48acf0a74b57fcc9", "connection": "8243af575e4cc6d1", "payload": "{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"W\",\"S7_Offset\":\"2\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"Data2\"}", "s7Name": "Data2", "topic": "", "name": "", "signalSetted": false, "none": "true", "repeat": "", "once": false, "x": 380, "y": 180, "wires": [ [ "eca912ed55ac92e7" ] ] }, { "id": "4217e30cd0c26996", "type": "s7comm read", "z": "48acf0a74b57fcc9", "connection": "8243af575e4cc6d1", "payload": "{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"W\",\"S7_Offset\":\"4\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"Data3\"}", "s7Name": "Data3", "topic": "", "name": "", "signalSetted": false, "none": "true", "repeat": "", "once": false, "x": 380, "y": 240, "wires": [ [ "f4dd6d25ef641ba8" ] ] }, { "id": "eca912ed55ac92e7", "type": "split", "z": "48acf0a74b57fcc9", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "parse2", "x": 550, "y": 180, "wires": [ [ "e36f24485a5ee562", "f5e2c8b9af25420c" ] ] }, { "id": "f4dd6d25ef641ba8", "type": "split", "z": "48acf0a74b57fcc9", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "parse3", "x": 550, "y": 240, "wires": [ [ "6b21c14081f45bfd", "f5e2c8b9af25420c" ] ] }, { "id": "e36f24485a5ee562", "type": "function", "z": "48acf0a74b57fcc9", "name": "", "func": "global.set('value2',msg.payload);\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 740, "y": 180, "wires": [ [] ] }, { "id": "6b21c14081f45bfd", "type": "function", "z": "48acf0a74b57fcc9", "name": "", "func": "global.set('value3',msg.payload);\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 740, "y": 240, "wires": [ [] ] }, { "id": "f5e2c8b9af25420c", "type": "debug", "z": "48acf0a74b57fcc9", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 750, "y": 60, "wires": [] }, { "id": "e07778d9b2c8fb02", "type": "delay", "z": "48acf0a74b57fcc9", "name": "", "pauseType": "delay", "timeout": "1", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "x": 370, "y": 320, "wires": [ [ "20cc6b5c533c30e6" ] ] }, { "id": "f368632229c86926", "type": "postgresdb", "cfgname": "postgres", "hostname": "localhost", "port": "5432", "db": "node-red-temp", "ssl": false }, { "id": "8243af575e4cc6d1", "type": "s7comm", "ip": "192.168.0.1", "port": "102", "rack": "0", "slot": "1", "payload": [ { "S7_Type": "DB", "S7_DBnum": "1", "S7_Datatype": "W", "S7_Offset": "0", "S7_BitOffset": "0", "S7_Quantity": "1", "S7_Name": "Data1" }, { "S7_Type": "DB", "S7_DBnum": "1", "S7_Datatype": "W", "S7_Offset": "2", "S7_BitOffset": "0", "S7_Quantity": "1", "S7_Name": "Data2" }, { "S7_Type": "DB", "S7_DBnum": "1", "S7_Datatype": "W", "S7_Offset": "4", "S7_BitOffset": "0", "S7_Quantity": "1", "S7_Name": "Data3" }, { "S7_Type": "DB", "S7_DBnum": "1", "S7_Datatype": "W", "S7_Offset": "6", "S7_BitOffset": "0", "S7_Quantity": "1", "S7_Name": "Data4" }, { "S7_Type": "DB", "S7_DBnum": "1", "S7_Datatype": "W", "S7_Offset": "8", "S7_BitOffset": "0", "S7_Quantity": "1", "S7_Name": "Data5" }, { "S7_Type": "M", "S7_DBnum": "0", "S7_Datatype": "B", "S7_Offset": "0", "S7_BitOffset": "3", "S7_Quantity": "3", "S7_Name": "MB1" } ] } ]