New to node red. Using it to read temperature from solo controllers and wish to change the set value based on a time delay. How can I do this? Would appreciate some assistance with the code as well
Use several delay nodes or trigger nodes and set the temperature with a change node.
Thanks for the response. I just did that, however, I am getting the following error: "Error: Modbus exception 4: Slave device failure (device reports internal error)"
As Im not using modbus, I can
t tell you what is the right format to set values. If you really want help then you should post your complete flow - may be there is someone who is using the same node types.
That error relates to a modbus node. I suggest you start a new thread with modbus in the title so that those who know about modbus can respond. Also tell us more about the system. What devices you are using, etc.
Here is my flow:
[
{
"id": "20031d8490ba6ecf",
"type": "tab",
"label": "Flow 6",
"disabled": false,
"info": "",
"env":
},
{
"id": "497a97af721602c5",
"type": "inject",
"z": "20031d8490ba6ecf",
"name": "timestamp #2",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "5",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 120,
"wires": [
[
"0272ea633ac1a0bd"
]
]
},
{
"id": "0272ea633ac1a0bd",
"type": "function",
"z": "20031d8490ba6ecf",
"name": "function 17",
"func": "msg.payload = {\n value: msg.payload,\n 'fc': 3,\n 'unitid': 2,\n 'address': 4096,\n 'quantity': 2,\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 380,
"y": 120,
"wires": [
[
"0bd6b7e8ed869159"
]
]
},
{
"id": "0bd6b7e8ed869159",
"type": "modbus-flex-getter",
"z": "20031d8490ba6ecf",
"name": "Modbus Flex Getter #2",
"showStatusActivities": true,
"showErrors": true,
"logIOActivities": true,
"server": "15f0abee0517431e",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"keepMsgProperties": false,
"x": 600,
"y": 120,
"wires": [
[
"d8034c3e7cf9d596"
],
[
"ca8963d14068c3e5",
"bc2f3d283b7cbaba"
]
]
},
{
"id": "d8034c3e7cf9d596",
"type": "modbus-response",
"z": "20031d8490ba6ecf",
"name": "Modbus Response #2",
"registerShowMax": 20,
"x": 860,
"y": 80,
"wires":
},
{
"id": "bc2f3d283b7cbaba",
"type": "function",
"z": "20031d8490ba6ecf",
"name": "function 18",
"func": "var values = msg.payload.data;\nmsg.payload = {\n 'value': values,\n 'fc': 16,\n 'unitid': 1,\n 'address': 4096,\n 'quantity': 2\n}\nflow.set("PV_unit2", msg.payload.value[0]);\nflow.set("SV_unit2", msg.payload.value[1]);\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 220,
"y": 200,
"wires": [
]
},
{
"id": "463d243c57eb664f",
"type": "debug",
"z": "20031d8490ba6ecf",
"name": "debug 3",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "msg.payload.value[0]",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 400,
"y": 240,
"wires":
},
{
"id": "83fb8e885bf549f4",
"type": "function",
"z": "20031d8490ba6ecf",
"name": "function 19",
"func": "msg = {\n "topic": "INSERT INTO TestTable6 (PV, SV) values(" + "\'" + parseFloat(flow.get("PV") / 10) + "," + parseFloat(flow.get("SV") / 10) + ")"\n}\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 970,
"y": 220,
"wires": [
]
},
{
"id": "be048e6733c756db",
"type": "inject",
"z": "20031d8490ba6ecf",
"name": "timestamp #3",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 360,
"wires": [
]
},
{
"id": "ca8963d14068c3e5",
"type": "function",
"z": "20031d8490ba6ecf",
"name": "function 24",
"func": "msg.payload = {\n value: msg.payload,\n 'fc': 3,\n 'unitid': 3,\n 'address': 4096,\n 'quantity': 2,\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 400,
"y": 420,
"wires": [
[
"635592dbc5eca5dc"
]
]
},
{
"id": "635592dbc5eca5dc",
"type": "modbus-flex-getter",
"z": "20031d8490ba6ecf",
"name": "Modbus Flex Getter #3",
"showStatusActivities": true,
"showErrors": true,
"logIOActivities": false,
"server": "15f0abee0517431e",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"keepMsgProperties": false,
"x": 620,
"y": 420,
"wires": [
[
"7b7a982b36b34038"
],
[
"888a9332f530b3c9"
]
]
},
{
"id": "7b7a982b36b34038",
"type": "modbus-response",
"z": "20031d8490ba6ecf",
"name": "Modbus Response #3",
"registerShowMax": 20,
"x": 880,
"y": 380,
"wires":
},
{
"id": "888a9332f530b3c9",
"type": "function",
"z": "20031d8490ba6ecf",
"name": "function 25",
"func": "var values = msg.payload.data;\nmsg.payload = {\n 'value': values,\n 'fc': 16,\n 'unitid': 3,\n 'address': 4096,\n 'quantity': 2\n}\nflow.set("PV_unit3", msg.payload.value[0]);\nflow.set("SV_unit3", msg.payload.value[1]);\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 240,
"y": 500,
"wires": [
[
"abd96f245c99afb5"
]
]
},
{
"id": "af57a47bf7802dc9",
"type": "debug",
"z": "20031d8490ba6ecf",
"name": "debug 5",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "msg.payload.value[0]",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 660,
"y": 540,
"wires":
},
{
"id": "f923863d0195e214",
"type": "inject",
"z": "20031d8490ba6ecf",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "60",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "$now('[H01]:[m01]:[s01]','-0400')",
"payloadType": "jsonata",
"x": 190,
"y": 800,
"wires": [
[
"b5b441edefd63539"
]
]
},
{
"id": "b5b441edefd63539",
"type": "function",
"z": "20031d8490ba6ecf",
"name": "function 22",
"func": "msg = {\n "topic": "INSERT INTO TestTable(Date, PV_unit2, SV_unit2, PV_unit3, SV_unit3) values(" + "\'" + msg.payload + "\'" + "," + parseFloat(flow.get("PV_unit2") / 10) + "," + parseFloat(flow.get("SV_unit2") / 10) + "," + parseFloat(flow.get("PV_unit3") / 10) + "," + parseFloat(flow.get("SV_unit3") / 10) + ")"\n}\nreturn msg;\n//msg = {\n// "topic": "INSERT INTO TestTable(Date, PV_unit2, SV_unit2) values(" + "\'" + msg.payload + "\'" + "," + parseFloat(flow.get("PV_unit2") / 10) + "," + parseFloat(flow.get("SV_unit2") / 10) + ")"\n//}\nreturn msg;\n//msg = {\n// "topic": "INSERT INTO TestTable(PV_unit2, SV_unit2) values(" + parseFloat(flow.get("PV_unit2") / 10) + "," + parseFloat(flow.get("SV_unit2") / 10) + ")"\n//}\n//return msg;\n//msg = {\n// "topic": "INSERT INTO TestTable(PV) values (" + "\'" + parseFloat(flow.get("PV_unit2") / 10) +"\')"\n//}\n//return msg; \n\n\n// $now('[Y0001].[M01].[D01] [H01]:[m01]:[s01]','-0400')\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 410,
"y": 800,
"wires": [
]
},
{
"id": "ad045715973d2d8e",
"type": "sqlite",
"z": "20031d8490ba6ecf",
"mydb": "7a153863ce933edb",
"sqlquery": "msg.topic",
"sql": "",
"name": "",
"x": 750,
"y": 800,
"wires": [
]
},
{
"id": "1e7226ab2b1a4535",
"type": "modbus-flex-write",
"z": "20031d8490ba6ecf",
"name": "",
"showStatusActivities": false,
"showErrors": true,
"server": "15f0abee0517431e",
"emptyMsgOnFail": false,
"keepMsgProperties": false,
"x": 930,
"y": 620,
"wires": [
,
]
},
{
"id": "e43068e26307ca64",
"type": "inject",
"z": "20031d8490ba6ecf",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": "120",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 620,
"wires": [
]
},
{
"id": "41da58f6b123d1e1",
"type": "function",
"z": "20031d8490ba6ecf",
"name": "function 26",
"func": "/\nvar values = msg.payload.data;\nflow.set("values", "1300")\nmsg.payload = {\n 'value': values,\n 'fc': 6,\n 'unitid': 3,\n 'address': 4098,\n 'quantity': 2\n}\n/\n//flow.set("PV_unit2", msg.payload.value[0]);\n//flow.set(msg.payload.value[1], "1300");\n//return msg;\n/\nvar count = context.get('count') || 0;\ncount += 1;\n\nif (count >= 72){\n //SV = 25;\n //flow.set(msg.payload.value[1], 1300);\n flow.set("SV_unit3", "1300")\n //flow.set("PV_unit2", msg.payload.value[0]);\n //flow.set("SV_unit2", msg.payload.value[1]);\n} else if (count >= 24){\n //SV = 130\n flow.set(msg.payload.value[1], 900);\n} else if (count >= 12){\n // SV = 90\n flow.set(msg.payload.value[1], 250);;\n}\n/\n\n//flow.set("SV_unit3", "1300")\n//return msg;\n//context.set("PV_unit2", 80)\n//context.set("SV_unit2", 80)\n/\nvar values = msg.payload.data\nmsg.payload = {\n value: values,\n //value: flow.set(msg.payload.value[1], "1300"),\n //value: "SV_unit3"\n 'fc': 6,\n 'unitid': 3,\n 'address': 4098,\n 'quantity': 2,\n}\nreturn msg;\n/\n\n\n\n//var values = msg.payload.data;\n//msg.payload = {\n// 'value': values,\n // 'fc': 16,\n // 'unitid': 1,\n //'address': 4096,\n //'quantity': 2\n//}\n\n//flow.set("PV_unit2", msg.payload.value[0]);\n//flow.set("SV_unit2", msg.payload.value[1]);\n//return msg;\n\nvar values = msg.payload.data;\nmsg.payload = {\n 'value': values,\n 'fc': 16,\n 'unitid': 3,\n 'address': 4096,\n 'quantity': 2\n}",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 350,
"y": 620,
"wires": [
]
},
{
"id": "9554c05f0216f0b2",
"type": "debug",
"z": "20031d8490ba6ecf",
"name": "debug 6",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload.value[1]",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 480,
"y": 740,
"wires":
},
{
"id": "026aa49d96d0fd61",
"type": "change",
"z": "20031d8490ba6ecf",
"name": "",
"rules": [
{
"t": "set",
"p": "payload.value[1]",
"pt": "msg",
"to": "1300",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 630,
"y": 620,
"wires": [
[
"1e7226ab2b1a4535"
]
]
},
{
"id": "abd96f245c99afb5",
"type": "delay",
"z": "20031d8490ba6ecf",
"name": "",
"pauseType": "delay",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 420,
"y": 560,
"wires": [
[
"026aa49d96d0fd61"
]
]
},
{
"id": "15f0abee0517431e",
"type": "modbus-client",
"name": "Solo Temperature Controller - Master",
"clienttype": "serial",
"bufferCommands": true,
"stateLogEnabled": true,
"queueLogEnabled": true,
"tcpHost": "127.0.0.1",
"tcpPort": "502",
"tcpType": "DEFAULT",
"serialPort": "COM5",
"serialType": "RTU-BUFFERD",
"serialBaudrate": "9600",
"serialDatabits": "8",
"serialStopbits": "1",
"serialParity": "even",
"serialConnectionDelay": "100",
"serialAsciiResponseStartDelimiter": "0x3A",
"unit_id": "1",
"commandDelay": "1",
"clientTimeout": "1000",
"reconnectOnTimeout": true,
"reconnectTimeout": "2000",
"parallelUnitIdsAllowed": true
},
{
"id": "7a153863ce933edb",
"type": "sqlitedb",
"db": "C:\Users\kvasudeva\Downloads\test30.db3",
"mode": "RWC"
}
]
Relevant flow is flow 6.
I am using Solo 4896 for temperature control and DAQ. Let me know if you have any ideas.
In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```
)
```
code goes here
```
You can edit and correct your post
by clicking the pencil icon.
See this post for more details - How to share code or flow json
Here is my code:
[
{
"id": "20031d8490ba6ecf",
"type": "tab",
"label": "Flow 6",
"disabled": false,
"info": "",
"env":
},
{
"id": "497a97af721602c5",
"type": "inject",
"z": "20031d8490ba6ecf",
"name": "timestamp #2",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "5",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 120,
"wires": [
[
"0272ea633ac1a0bd"
]
]
},
{
"id": "0272ea633ac1a0bd",
"type": "function",
"z": "20031d8490ba6ecf",
"name": "function 17",
"func": "msg.payload = {\n value: msg.payload,\n 'fc': 3,\n 'unitid': 2,\n 'address': 4096,\n 'quantity': 2,\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 380,
"y": 120,
"wires": [
[
"0bd6b7e8ed869159"
]
]
},
{
"id": "0bd6b7e8ed869159",
"type": "modbus-flex-getter",
"z": "20031d8490ba6ecf",
"name": "Modbus Flex Getter #2",
"showStatusActivities": true,
"showErrors": true,
"logIOActivities": true,
"server": "15f0abee0517431e",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"keepMsgProperties": false,
"x": 600,
"y": 120,
"wires": [
[
"d8034c3e7cf9d596"
],
[
"ca8963d14068c3e5",
"bc2f3d283b7cbaba"
]
]
},
{
"id": "d8034c3e7cf9d596",
"type": "modbus-response",
"z": "20031d8490ba6ecf",
"name": "Modbus Response #2",
"registerShowMax": 20,
"x": 860,
"y": 80,
"wires":
},
{
"id": "bc2f3d283b7cbaba",
"type": "function",
"z": "20031d8490ba6ecf",
"name": "function 18",
"func": "var values = msg.payload.data;\nmsg.payload = {\n 'value': values,\n 'fc': 16,\n 'unitid': 1,\n 'address': 4096,\n 'quantity': 2\n}\nflow.set("PV_unit2", msg.payload.value[0]);\nflow.set("SV_unit2", msg.payload.value[1]);\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 220,
"y": 200,
"wires": [
]
},
{
"id": "463d243c57eb664f",
"type": "debug",
"z": "20031d8490ba6ecf",
"name": "debug 3",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "msg.payload.value[0]",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 400,
"y": 240,
"wires":
},
{
"id": "83fb8e885bf549f4",
"type": "function",
"z": "20031d8490ba6ecf",
"name": "function 19",
"func": "msg = {\n "topic": "INSERT INTO TestTable6 (PV, SV) values(" + "\'" + parseFloat(flow.get("PV") / 10) + "," + parseFloat(flow.get("SV") / 10) + ")"\n}\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 970,
"y": 220,
"wires": [
]
},
{
"id": "be048e6733c756db",
"type": "inject",
"z": "20031d8490ba6ecf",
"name": "timestamp #3",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 360,
"wires": [
]
},
{
"id": "ca8963d14068c3e5",
"type": "function",
"z": "20031d8490ba6ecf",
"name": "function 24",
"func": "msg.payload = {\n value: msg.payload,\n 'fc': 3,\n 'unitid': 3,\n 'address': 4096,\n 'quantity': 2,\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 400,
"y": 420,
"wires": [
[
"635592dbc5eca5dc"
]
]
},
{
"id": "635592dbc5eca5dc",
"type": "modbus-flex-getter",
"z": "20031d8490ba6ecf",
"name": "Modbus Flex Getter #3",
"showStatusActivities": true,
"showErrors": true,
"logIOActivities": false,
"server": "15f0abee0517431e",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"keepMsgProperties": false,
"x": 620,
"y": 420,
"wires": [
[
"7b7a982b36b34038"
],
[
"888a9332f530b3c9"
]
]
},
{
"id": "7b7a982b36b34038",
"type": "modbus-response",
"z": "20031d8490ba6ecf",
"name": "Modbus Response #3",
"registerShowMax": 20,
"x": 880,
"y": 380,
"wires":
},
{
"id": "888a9332f530b3c9",
"type": "function",
"z": "20031d8490ba6ecf",
"name": "function 25",
"func": "var values = msg.payload.data;\nmsg.payload = {\n 'value': values,\n 'fc': 16,\n 'unitid': 3,\n 'address': 4096,\n 'quantity': 2\n}\nflow.set("PV_unit3", msg.payload.value[0]);\nflow.set("SV_unit3", msg.payload.value[1]);\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 240,
"y": 500,
"wires": [
[
"abd96f245c99afb5"
]
]
},
{
"id": "af57a47bf7802dc9",
"type": "debug",
"z": "20031d8490ba6ecf",
"name": "debug 5",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "msg.payload.value[0]",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 660,
"y": 540,
"wires":
},
{
"id": "f923863d0195e214",
"type": "inject",
"z": "20031d8490ba6ecf",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "60",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "$now('[H01]:[m01]:[s01]','-0400')",
"payloadType": "jsonata",
"x": 190,
"y": 800,
"wires": [
[
"b5b441edefd63539"
]
]
},
{
"id": "b5b441edefd63539",
"type": "function",
"z": "20031d8490ba6ecf",
"name": "function 22",
"func": "msg = {\n "topic": "INSERT INTO TestTable(Date, PV_unit2, SV_unit2, PV_unit3, SV_unit3) values(" + "\'" + msg.payload + "\'" + "," + parseFloat(flow.get("PV_unit2") / 10) + "," + parseFloat(flow.get("SV_unit2") / 10) + "," + parseFloat(flow.get("PV_unit3") / 10) + "," + parseFloat(flow.get("SV_unit3") / 10) + ")"\n}\nreturn msg;\n//msg = {\n// "topic": "INSERT INTO TestTable(Date, PV_unit2, SV_unit2) values(" + "\'" + msg.payload + "\'" + "," + parseFloat(flow.get("PV_unit2") / 10) + "," + parseFloat(flow.get("SV_unit2") / 10) + ")"\n//}\nreturn msg;\n//msg = {\n// "topic": "INSERT INTO TestTable(PV_unit2, SV_unit2) values(" + parseFloat(flow.get("PV_unit2") / 10) + "," + parseFloat(flow.get("SV_unit2") / 10) + ")"\n//}\n//return msg;\n//msg = {\n// "topic": "INSERT INTO TestTable(PV) values (" + "\'" + parseFloat(flow.get("PV_unit2") / 10) +"\')"\n//}\n//return msg; \n\n\n// $now('[Y0001].[M01].[D01] [H01]:[m01]:[s01]','-0400')\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 410,
"y": 800,
"wires": [
]
},
{
"id": "ad045715973d2d8e",
"type": "sqlite",
"z": "20031d8490ba6ecf",
"mydb": "7a153863ce933edb",
"sqlquery": "msg.topic",
"sql": "",
"name": "",
"x": 750,
"y": 800,
"wires": [
]
},
{
"id": "1e7226ab2b1a4535",
"type": "modbus-flex-write",
"z": "20031d8490ba6ecf",
"name": "",
"showStatusActivities": false,
"showErrors": true,
"server": "15f0abee0517431e",
"emptyMsgOnFail": false,
"keepMsgProperties": false,
"x": 930,
"y": 620,
"wires": [
,
]
},
{
"id": "e43068e26307ca64",
"type": "inject",
"z": "20031d8490ba6ecf",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": "120",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 620,
"wires": [
]
},
{
"id": "41da58f6b123d1e1",
"type": "function",
"z": "20031d8490ba6ecf",
"name": "function 26",
"func": "/\nvar values = msg.payload.data;\nflow.set("values", "1300")\nmsg.payload = {\n 'value': values,\n 'fc': 6,\n 'unitid': 3,\n 'address': 4098,\n 'quantity': 2\n}\n/\n//flow.set("PV_unit2", msg.payload.value[0]);\n//flow.set(msg.payload.value[1], "1300");\n//return msg;\n/\nvar count = context.get('count') || 0;\ncount += 1;\n\nif (count >= 72){\n //SV = 25;\n //flow.set(msg.payload.value[1], 1300);\n flow.set("SV_unit3", "1300")\n //flow.set("PV_unit2", msg.payload.value[0]);\n //flow.set("SV_unit2", msg.payload.value[1]);\n} else if (count >= 24){\n //SV = 130\n flow.set(msg.payload.value[1], 900);\n} else if (count >= 12){\n // SV = 90\n flow.set(msg.payload.value[1], 250);;\n}\n/\n\n//flow.set("SV_unit3", "1300")\n//return msg;\n//context.set("PV_unit2", 80)\n//context.set("SV_unit2", 80)\n/\nvar values = msg.payload.data\nmsg.payload = {\n value: values,\n //value: flow.set(msg.payload.value[1], "1300"),\n //value: "SV_unit3"\n 'fc': 6,\n 'unitid': 3,\n 'address': 4098,\n 'quantity': 2,\n}\nreturn msg;\n/\n\n\n\n//var values = msg.payload.data;\n//msg.payload = {\n// 'value': values,\n // 'fc': 16,\n // 'unitid': 1,\n //'address': 4096,\n //'quantity': 2\n//}\n\n//flow.set("PV_unit2", msg.payload.value[0]);\n//flow.set("SV_unit2", msg.payload.value[1]);\n//return msg;\n\nvar values = msg.payload.data;\nmsg.payload = {\n 'value': values,\n 'fc': 16,\n 'unitid': 3,\n 'address': 4096,\n 'quantity': 2\n}",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 350,
"y": 620,
"wires": [
]
},
{
"id": "9554c05f0216f0b2",
"type": "debug",
"z": "20031d8490ba6ecf",
"name": "debug 6",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload.value[1]",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 480,
"y": 740,
"wires":
},
{
"id": "026aa49d96d0fd61",
"type": "change",
"z": "20031d8490ba6ecf",
"name": "",
"rules": [
{
"t": "set",
"p": "payload.value[1]",
"pt": "msg",
"to": "1300",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 630,
"y": 620,
"wires": [
[
"1e7226ab2b1a4535"
]
]
},
{
"id": "abd96f245c99afb5",
"type": "delay",
"z": "20031d8490ba6ecf",
"name": "",
"pauseType": "delay",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 420,
"y": 560,
"wires": [
[
"026aa49d96d0fd61"
]
]
},
{
"id": "15f0abee0517431e",
"type": "modbus-client",
"name": "Solo Temperature Controller - Master",
"clienttype": "serial",
"bufferCommands": true,
"stateLogEnabled": true,
"queueLogEnabled": true,
"tcpHost": "127.0.0.1",
"tcpPort": "502",
"tcpType": "DEFAULT",
"serialPort": "COM5",
"serialType": "RTU-BUFFERD",
"serialBaudrate": "9600",
"serialDatabits": "8",
"serialStopbits": "1",
"serialParity": "even",
"serialConnectionDelay": "100",
"serialAsciiResponseStartDelimiter": "0x3A",
"unit_id": "1",
"commandDelay": "1",
"clientTimeout": "1000",
"reconnectOnTimeout": true,
"reconnectTimeout": "2000",
"parallelUnitIdsAllowed": true
},
{
"id": "7a153863ce933edb",
"type": "sqlitedb",
"db": "C:\Users\kvasudeva\Downloads\test30.db3",
"mode": "RWC"
}
]
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.