Thanks for your reply! Actually would be something like, if a memory address in the PLC is TRUE, run the function node....
Kinda like what I am trying to do here:
[
{
"id": "b17d4b93202e9c4b",
"type": "tab",
"label": "DB Logging",
"disabled": false,
"info": "",
"env": []
},
{
"id": "f1a8a57d.896448",
"type": "inject",
"z": "b17d4b93202e9c4b",
"name": "CREATE",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 160,
"y": 220,
"wires": [
[]
]
},
{
"id": "d8886e88.2e352",
"type": "debug",
"z": "b17d4b93202e9c4b",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 690,
"y": 220,
"wires": []
},
{
"id": "565b9eff.a027b",
"type": "inject",
"z": "b17d4b93202e9c4b",
"name": "TriggerTrue",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "true",
"payloadType": "bool",
"x": 150,
"y": 300,
"wires": [
[]
]
},
{
"id": "2ac9919.fbaf86e",
"type": "function",
"z": "b17d4b93202e9c4b",
"name": "INSERT",
"func": "\nvar values = msg.payload;\nvar topic = \"INSERT INTO beamshaper.lensstack (LeftSide_Dist, RightSide_Dist, LeftSide_Shift, RightSide_Shift, TopLens_Angle, BottomLens_Angle, LensCode, `timestamp`) VALUES(\" + values + \", current_timestamp())\";\nmsg.topic = topic; \nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 760,
"y": 540,
"wires": [
[
"7bfdc80134e445cf"
]
]
},
{
"id": "7286764d.703128",
"type": "debug",
"z": "b17d4b93202e9c4b",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 1110,
"y": 480,
"wires": []
},
{
"id": "16d49f4f.2f72e1",
"type": "function",
"z": "b17d4b93202e9c4b",
"name": "TABLE",
"func": "topic = \"CREATE TABLE `access` ( \";\ntopic = topic + \"`no` INT NULL AUTO_INCREMENT,\";\ntopic = topic + \"`date` TIMESTAMP NOT NULL,\";\ntopic = topic + \"`room` INT NULL,\";\ntopic = topic + \"`id` INT NULL,\";\ntopic = topic + \"INDEX `no` (`no`)) COLLATE='latin1_swedish_ci';\";\nmsg.topic = topic;\n\nreturn msg;",
"outputs": 1,
"noerr": 12,
"initialize": "",
"finalize": "",
"libs": [],
"x": 330,
"y": 220,
"wires": [
[
"392b8ab7.e19ac6"
]
]
},
{
"id": "982a5d4d.e294f",
"type": "inject",
"z": "b17d4b93202e9c4b",
"name": "CREATE",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 160,
"y": 160,
"wires": [
[]
]
},
{
"id": "8f16a404.412c08",
"type": "debug",
"z": "b17d4b93202e9c4b",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 690,
"y": 160,
"wires": []
},
{
"id": "3648a443.b264bc",
"type": "function",
"z": "b17d4b93202e9c4b",
"name": "DATABASE",
"func": "var newMsg = {\n\"topic\" : \"CREATE DATABASE `test`;\"\n}\nreturn newMsg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 350,
"y": 160,
"wires": [
[
"1c79da55.f69436"
]
]
},
{
"id": "fdbcc9a.f22b838",
"type": "mysql",
"z": "b17d4b93202e9c4b",
"mydb": "2236dfd1.c909e",
"name": "",
"x": 930,
"y": 540,
"wires": [
[
"7286764d.703128"
]
]
},
{
"id": "392b8ab7.e19ac6",
"type": "mysql",
"z": "b17d4b93202e9c4b",
"mydb": "2236dfd1.c909e",
"name": "",
"x": 530,
"y": 220,
"wires": [
[
"d8886e88.2e352"
]
]
},
{
"id": "1c79da55.f69436",
"type": "mysql",
"z": "b17d4b93202e9c4b",
"mydb": "2236dfd1.c909e",
"name": "",
"x": 530,
"y": 160,
"wires": [
[
"8f16a404.412c08"
]
]
},
{
"id": "74381c4e55d860ae",
"type": "s7 in",
"z": "b17d4b93202e9c4b",
"endpoint": "be6d96b1d96d301f",
"mode": "single",
"variable": "flag_DBLog",
"diff": true,
"name": "",
"x": 170,
"y": 400,
"wires": [
[
"cf3bbcaba93533b8"
]
]
},
{
"id": "12f4f937ddc4e1ab",
"type": "s7 in",
"z": "b17d4b93202e9c4b",
"endpoint": "be6d96b1d96d301f",
"mode": "single",
"variable": "LeftSide_Dist",
"diff": true,
"name": "",
"x": 170,
"y": 440,
"wires": [
[
"450a94417c8b71f7"
]
]
},
{
"id": "4609f6479ce70b29",
"type": "s7 in",
"z": "b17d4b93202e9c4b",
"endpoint": "be6d96b1d96d301f",
"mode": "single",
"variable": "RightSide_Dist",
"diff": true,
"name": "",
"x": 160,
"y": 480,
"wires": [
[
"f6556b2243dac15a"
]
]
},
{
"id": "0100ebfd0ebe2d25",
"type": "s7 in",
"z": "b17d4b93202e9c4b",
"endpoint": "be6d96b1d96d301f",
"mode": "single",
"variable": "LeftSide_Shift",
"diff": true,
"name": "",
"x": 170,
"y": 520,
"wires": [
[
"ac80af684e1dd309"
]
]
},
{
"id": "7952fc36ed071900",
"type": "s7 in",
"z": "b17d4b93202e9c4b",
"endpoint": "be6d96b1d96d301f",
"mode": "single",
"variable": "RightSide_Shift",
"diff": true,
"name": "",
"x": 160,
"y": 560,
"wires": [
[
"08547bcbf3b641dd"
]
]
},
{
"id": "b54836054967eff2",
"type": "s7 in",
"z": "b17d4b93202e9c4b",
"endpoint": "be6d96b1d96d301f",
"mode": "single",
"variable": "TopLens_Angle",
"diff": true,
"name": "",
"x": 160,
"y": 600,
"wires": [
[
"8743a37f034305b5"
]
]
},
{
"id": "a1fa113a9c974f1e",
"type": "s7 in",
"z": "b17d4b93202e9c4b",
"endpoint": "be6d96b1d96d301f",
"mode": "single",
"variable": "BottomLens_Angle",
"diff": true,
"name": "",
"x": 150,
"y": 640,
"wires": [
[
"8e9ad35d97039b8c"
]
]
},
{
"id": "c498b1f2926ea757",
"type": "s7 in",
"z": "b17d4b93202e9c4b",
"endpoint": "be6d96b1d96d301f",
"mode": "single",
"variable": "LensCode",
"diff": true,
"name": "",
"x": 180,
"y": 680,
"wires": [
[
"fd75c103776eb7ce"
]
]
},
{
"id": "df39632c02478634",
"type": "join",
"z": "b17d4b93202e9c4b",
"name": "LensValues",
"mode": "custom",
"build": "string",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": ",",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "7",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 610,
"y": 540,
"wires": [
[
"2ac9919.fbaf86e"
]
]
},
{
"id": "450a94417c8b71f7",
"type": "function",
"z": "b17d4b93202e9c4b",
"name": "LeftSide_Dist",
"func": "var LeftSide_Dist = msg.topic;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 410,
"y": 440,
"wires": [
[
"df39632c02478634"
]
]
},
{
"id": "f6556b2243dac15a",
"type": "function",
"z": "b17d4b93202e9c4b",
"name": "RightSide_Dist",
"func": "var RightSide_Dist = msg.topic;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 400,
"y": 480,
"wires": [
[
"df39632c02478634"
]
]
},
{
"id": "ac80af684e1dd309",
"type": "function",
"z": "b17d4b93202e9c4b",
"name": "LeftSide_Shift",
"func": "var LeftSide_Shift = msg.topic;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 400,
"y": 520,
"wires": [
[
"df39632c02478634"
]
]
},
{
"id": "08547bcbf3b641dd",
"type": "function",
"z": "b17d4b93202e9c4b",
"name": "RightSide_Shift",
"func": "var RightSide_Shift = msg.topic;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 400,
"y": 560,
"wires": [
[
"df39632c02478634"
]
]
},
{
"id": "8743a37f034305b5",
"type": "function",
"z": "b17d4b93202e9c4b",
"name": "TopLens_Angle",
"func": "var TopLens_Angle = msg.topic;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 400,
"y": 600,
"wires": [
[
"df39632c02478634"
]
]
},
{
"id": "8e9ad35d97039b8c",
"type": "function",
"z": "b17d4b93202e9c4b",
"name": "BottomLens_Angle",
"func": "var BottomLens_Angle = msg.topic;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 390,
"y": 640,
"wires": [
[
"df39632c02478634"
]
]
},
{
"id": "fd75c103776eb7ce",
"type": "function",
"z": "b17d4b93202e9c4b",
"name": "LensCode",
"func": "var LensCode = msg.topic;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 410,
"y": 680,
"wires": [
[
"df39632c02478634"
]
]
},
{
"id": "6258119e9a49c374",
"type": "debug",
"z": "b17d4b93202e9c4b",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 640,
"y": 320,
"wires": []
},
{
"id": "7bfdc80134e445cf",
"type": "debug",
"z": "b17d4b93202e9c4b",
"name": "debug 2",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 780,
"y": 420,
"wires": []
},
{
"id": "a4105ffbc5f18bd2",
"type": "inject",
"z": "b17d4b93202e9c4b",
"name": "triggerSend",
"props": [
{
"p": "complete",
"v": "true",
"vt": "bool"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 150,
"y": 340,
"wires": [
[
"df39632c02478634"
]
]
},
{
"id": "cf3bbcaba93533b8",
"type": "change",
"z": "b17d4b93202e9c4b",
"name": "",
"rules": [
{
"t": "set",
"p": "complete",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 430,
"y": 400,
"wires": [
[
"df39632c02478634"
]
]
},
{
"id": "2236dfd1.c909e",
"type": "MySQLdatabase",
"name": "",
"host": "10.54.112.30",
"port": "3306",
"db": "beamshaper",
"tz": "",
"charset": ""
},
{
"id": "be6d96b1d96d301f",
"type": "s7 endpoint",
"transport": "iso-on-tcp",
"address": "10.54.40.240",
"port": "102",
"rack": "0",
"slot": "1",
"localtsaphi": "01",
"localtsaplo": "00",
"remotetsaphi": "01",
"remotetsaplo": "00",
"connmode": "rack-slot",
"adapter": "",
"busaddr": "2",
"cycletime": "1000",
"timeout": "2000",
"name": "",
"vartable": [
{
"addr": "MW10",
"name": "prgNum"
},
{
"addr": "M2.0",
"name": "startBtn"
},
{
"addr": "M2.1",
"name": "stopBtn"
},
{
"addr": "M2.2",
"name": "clearFaultBtn"
},
{
"addr": "IB68",
"name": "ro_step"
},
{
"addr": "M10.0",
"name": "clearSequence"
},
{
"addr": "M200.6",
"name": "flag_DBLog"
},
{
"addr": "DB5,REAL26356",
"name": "LeftSide_Dist"
},
{
"addr": "DB5,REAL26360",
"name": "RightSide_Dist"
},
{
"addr": "DB5,REAL26364",
"name": "LeftSide_Shift"
},
{
"addr": "DB5,REAL26368",
"name": "RightSide_Shift"
},
{
"addr": "DB5,REAL26372",
"name": "TopLens_Angle"
},
{
"addr": "DB5,REAL26376",
"name": "BottomLens_Angle"
},
{
"addr": "DB5,INT26380",
"name": "LensCode"
}
]
}
]