Hello, the Nodered server is not on the same machine as the SQL server.
On Github is nothing related with this error.
Now for the flows:
Flow A:
[
{
"id": "15b82b89.7ee7dc",
"type": "function",
"z": "b4f95417.221508",
"name": "Split String",
"func": "var msg = msg.payload;\nvar DevID={ payload: parseInt(msg.slice(40,42),16)};\nvar Pluv1={ payload: parseInt(msg.slice(0,4),16)/100};\nvar Pluv2={ payload: parseInt(msg.slice(4,8),16)/100};\nvar Pluv3={ payload: parseInt(msg.slice(8,12),16)/100};\nvar Wind={ payload: parseInt(msg.slice(12,18),16)};\nvar Anemo={ payload: parseInt(msg.slice(18,22),16)/100};\nvar Tempsign={ payload: parseInt(msg.slice(22,24),16)};\nvar Temp={ payload: parseInt(msg.slice(24,28),16)/100};\nif (Tempsign.payload == 1) (Temp = { payload: (Temp.payload * (-1))});\nvar Hum={ payload: parseInt(msg.slice(28,32),16)/100};\nvar Press={ payload: parseInt(msg.slice(32,38),16)};\nvar Bat={ payload: parseInt(msg.slice(38,40),16)};\nreturn [DevID,Pluv1,Pluv2,Pluv3,Wind,Anemo,Temp,Hum,Press,Bat];",
"outputs": 10,
"noerr": 0,
"x": 1050,
"y": 420,
"wires": [
[
"c46309a1.359578",
"f7e42d18.d1804"
],
[
"73bf16e0.ee2438",
"f7e42d18.d1804"
],
[
"23cc97.366abb6a",
"f7e42d18.d1804"
],
[
"1bfe6a6e.ba4ee6",
"f7e42d18.d1804"
],
[
"47911896.8df1b8",
"f7e42d18.d1804"
],
[
"e60d01e1.adf32",
"f7e42d18.d1804"
],
[
"29ed72f4.c4c06e",
"f7e42d18.d1804"
],
[
"344664c2.26020c",
"f7e42d18.d1804"
],
[
"721cbc1b.9ca88c",
"f7e42d18.d1804"
],
[
"dfff80a0.04af5",
"f7e42d18.d1804"
]
]
},
{
"id": "f7e42d18.d1804",
"type": "join",
"z": "b4f95417.221508",
"name": "",
"mode": "custom",
"build": "array",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "10",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 1210,
"y": 420,
"wires": [
[
"be047bfa.63f268"
]
]
},
{
"id": "be047bfa.63f268",
"type": "simple-queue",
"z": "b4f95417.221508",
"name": "Insert to DB queue",
"firstMessageBypass": true,
"bypassInterval": "0",
"x": 1390,
"y": 420,
"wires": [
[
"a802c590.5c8848"
]
]
},
{
"id": "a802c590.5c8848",
"type": "MSSQL",
"z": "b4f95417.221508",
"mssqlCN": "989023f3.29ffc8",
"name": "WeatherStationsReads",
"query": "DECLARE @StoreTime as DATETIME;\n\nSET @StoreTime = CURRENT_TIMESTAMP;\n\nINSERT INTO cStoreWeatherStations\n(\n[ReadTime]\n,[DevID]\n,[CurrentHAccRainfall]\n,[PreviousHAccRainfall]\n,[Last24HAccRainfall]\n,[WindDirection]\n,[Anemometer]\n,[Temperature]\n,[Humidity]\n,[Pressure]\n,[BatteryLevel]\n)\nVALUES\n (\n @StoreTime,\n {{{payload.0}}},\n {{{payload.1}}},\n {{{payload.2}}},\n {{{payload.3}}},\n {{{payload.4}}},\n {{{payload.5}}},\n {{{payload.6}}},\n {{{payload.7}}},\n {{{payload.8}}},\n {{{payload.9}}}\n )",
"outField": "payload",
"x": 1610,
"y": 420,
"wires": [
[
"4c299039.e10c58"
]
]
},
{
"id": "989023f3.29ffc8",
"type": "MSSQL-CN",
"z": "",
"tdsVersion": "7_4",
"name": "WeatherStations",
"server": "10.80.x.x",
"port": "1433",
"encyption": false,
"database": "WeatherST",
"useUTC": false,
"connectTimeout": "15000",
"requestTimeout": "15000",
"cancelTimeout": "5000",
"pool": "10"
}
]
Flow B:
[
{
"id": "bd3d408c.87daf",
"type": "function",
"z": "374f65b3.b9a9ea",
"name": "Split String",
"func": "var i;\nfor (i = 0; i < msg.payload.length; i++)\n\nvar UpTimeEpoch = { payload: parseInt(msg.payload[1].slice(9,19))};\n//var UpTime = { payload: parseInt(msg.payload[1].slice(9,19))};\n//var days = Math.trunc(UpTime.payload / (24*3600));\n//var time = (new Date((UpTime.payload - days*24*3600) * 1000)).toUTCString().match(/(\\d\\d:\\d\\d:\\d\\d)/)[0];\n//UpTime.payload = days + \":\" + time;\nvar Load1min = { payload: parseFloat(msg.payload[2].slice(8,13))};\nvar Load5min = { payload: parseFloat(msg.payload[3].slice(0,5))};\nvar Load15min = { payload: parseFloat(msg.payload[4].slice(0,5))};\nvar UsedMem = { payload: parseInt(msg.payload[5].slice(14,20))};\nvar FreeMem = { payload: parseInt(msg.payload[6].slice(7,13))};\nvar GatewayID = { payload: parseInt(msg.payload[8])};\n\nreturn [UpTimeEpoch,Load1min,Load5min,Load15min,UsedMem,FreeMem,GatewayID];",
"outputs": 7,
"noerr": 0,
"x": 890,
"y": 300,
"wires": [
[
"1b351a9c.1e2ef5"
],
[
"1b351a9c.1e2ef5"
],
[
"1b351a9c.1e2ef5"
],
[
"1b351a9c.1e2ef5"
],
[
"1b351a9c.1e2ef5"
],
[
"1b351a9c.1e2ef5"
],
[
"1b351a9c.1e2ef5"
]
]
},
{
"id": "1b351a9c.1e2ef5",
"type": "join",
"z": "374f65b3.b9a9ea",
"name": "",
"mode": "custom",
"build": "array",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "7",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 1050,
"y": 300,
"wires": [
[
"84611128.5813f"
]
]
},
{
"id": "84611128.5813f",
"type": "simple-queue",
"z": "374f65b3.b9a9ea",
"name": "Insert to DB queue",
"firstMessageBypass": true,
"bypassInterval": "5000",
"x": 1210,
"y": 300,
"wires": [
[
"8cf86df0.72483",
"abca801e.ac13d8"
]
]
},
{
"id": "abca801e.ac13d8",
"type": "MSSQL",
"z": "374f65b3.b9a9ea",
"mssqlCN": "cd65dbe6.c215d",
"name": "GatewayStats",
"query": "DECLARE @StoreTime as DATETIME;\n\nSET @StoreTime = CURRENT_TIMESTAMP;\n\nINSERT INTO GatewayStats\n(\n[ReadTime]\n,[GatewayID]\n,[UpTime]\n,[LoadOne]\n,[LoadFive]\n,[LoadFifteen]\n,[RamUsed]\n,[RamFree]\n)\nVALUES\n (\n @StoreTime,\n {{{payload.6}}},\n {{{payload.0}}},\n {{{payload.1}}},\n {{{payload.2}}},\n {{{payload.3}}},\n {{{payload.4}}},\n {{{payload.5}}}\n )\n ",
"outField": "payload",
"x": 1420,
"y": 300,
"wires": [
[]
]
},
{
"id": "cd65dbe6.c215d",
"type": "MSSQL-CN",
"z": "",
"tdsVersion": "7_4",
"name": "IoT",
"server": "10.80.x.x",
"port": "1433",
"encyption": false,
"database": "IoT",
"useUTC": false,
"connectTimeout": "15000",
"requestTimeout": "15000",
"cancelTimeout": "5000",
"pool": "10"
}
]