Skip to content

Commit

Permalink
NodeRed update
Browse files Browse the repository at this point in the history
  • Loading branch information
Loic74650 committed Mar 30, 2020
1 parent d9f4385 commit f5c208d
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 137 deletions.
Binary file modified NodeRed/NodeRed-to-Blynk.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
87 changes: 80 additions & 7 deletions NodeRed/NodeRedBLYNKFlow.txt → NodeRed/NodeRedFlow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@
"name": "JSON from PoolMaster",
"topic": "Home/Pool",
"qos": "1",
"datatype": "json",
"broker": "99099cd5.b5ffa8",
"x": 120.28334045410156,
"y": 235,
"wires": [
[
"7573043.a3fc4fc"
"7573043.a3fc4fc",
"58bd9ea8.646dd",
"6679fce8.af4b5c"
]
]
},
Expand All @@ -65,7 +68,7 @@
"type": "function",
"z": "f12e8a0a.1aa5c",
"name": "Split JSON",
"func": "var msgarray = msg.payload.split(',');\n\nvar msg0={};\nvar msg1={};\nvar msg2={};\nvar msg3={};\nvar msg4={};\nvar msg5={};\nvar msg6={};\nvar msg7={};\nvar msg8={};\n\nmsg0.payload = msgarray[0].split(':')[1]/100.0;//W temp\nmsg1.payload = msgarray[1].split(':')[1]/100.0;//pH\nmsg2.payload = msgarray[2].split(':')[1]/100.0;//PSI\nmsg3.payload = msgarray[3].split(':')[1];//Orp\nmsg4.payload = msgarray[4].split(':')[1]/60;//Filtration Uptime\nmsg5.payload = msgarray[5].split(':')[1]/60;//pH Uptime\nmsg6.payload = msgarray[6].split(':')[1]/60;//Chl Uptime\nmsg7.payload = msgarray[7].split(':')[1];//IO\nvar tmp = msgarray[8].split(':')[1];//IO2\nmsg8.payload = tmp.substring(0, tmp.length - 1);\n\nreturn [msg0,msg1,msg2,msg3,msg4,msg5,msg6,msg7,msg8]",
"func": "if(typeof msg.payload.Tmp !== 'undefined')\n{\n var msg0={};\n var msg1={};\n var msg2={};\n var msg3={};\n var msg4={};\n var msg5={};\n var msg6={};\n var msg7={};\n var msg8={};\n \n msg0.payload = msg.payload.Tmp/100.0;//W temp\n msg1.payload = msg.payload.pH/100.0;//pH\n msg2.payload = msg.payload.PSI/100.0;//PSI\n msg3.payload = msg.payload.Orp;//Orp\n msg4.payload = msg.payload.FilUpT/60.0;//Filtration Uptime\n msg5.payload = msg.payload.pHUpT/60.0;//pH Uptime\n msg6.payload = msg.payload.ChlUpT/60.0;//Chl Uptime\n msg7.payload = msg.payload.IO;//IO\n msg8.payload = msg.payload.IO2;//IO2;\n \n return [msg0,msg1,msg2,msg3,msg4,msg5,msg6,msg7,msg8]\n}\n\n",
"outputs": 9,
"noerr": 0,
"x": 336.2833251953125,
Expand Down Expand Up @@ -175,7 +178,7 @@
"type": "function",
"z": "f12e8a0a.1aa5c",
"name": "Split IO mask",
"func": "var mask = parseInt(msg.payload, 10);\n\nvar msg0={};\nvar msg1={};\nvar msg2={};\nvar msg3={};\nvar msg4={};\nvar msg5={};\nvar msg6={};\nvar msg7={};\n\nmsg0.payload = (mask & 128) == 128 ? 1:0;\nmsg1.payload = (mask & 64) == 64 ? 1:0;\nmsg2.payload = (mask & 32) == 32 ? 1:0;\nmsg3.payload = (mask & 16) == 16 ? 1:0;\nmsg4.payload = (mask & 8) == 8 ? 1:0;\nmsg5.payload = (mask & 4) == 4 ? 1:0;\nmsg6.payload = (mask & 2) == 2 ? 1:0;\nmsg7.payload = (mask & 1) == 1 ? 1:0;\n\nreturn [msg0,msg1,msg2,msg3,msg4,msg5,msg6,msg7]",
"func": "var mask = msg.payload;\n\nvar msg0={};\nvar msg1={};\nvar msg2={};\nvar msg3={};\nvar msg4={};\nvar msg5={};\nvar msg6={};\nvar msg7={};\n\nmsg0.payload = (mask >> 7) & 1;\nmsg1.payload = (mask >> 6) & 1;\nmsg2.payload = (mask >> 5) & 1;\nmsg3.payload = (mask >> 4) & 1;\nmsg4.payload = (mask >> 3) & 1;\nmsg5.payload = (mask >> 2) & 1;\nmsg6.payload = (mask >> 1) & 1;\nmsg7.payload = (mask >> 0) & 1;\n\nreturn [msg0,msg1,msg2,msg3,msg4,msg5,msg6,msg7]",
"outputs": 8,
"noerr": 0,
"x": 560.2833251953125,
Expand Down Expand Up @@ -305,7 +308,7 @@
"type": "function",
"z": "f12e8a0a.1aa5c",
"name": "Split IO2 mask",
"func": "var mask = parseInt(msg.payload, 10);\n\nvar msg0={};\nvar msg1={};\nvar msg2={};\nvar msg3={};\nvar msg4={};\nvar msg5={};\nvar msg6={};\nvar msg7={};\n\nmsg0.payload = (mask & 128) == 128 ? 1:0;\nmsg1.payload = (mask & 64) == 64 ? 1:0;\nmsg2.payload = (mask & 32) == 32 ? 1:0;\nmsg3.payload = (mask & 16) == 16 ? 1:0;\nmsg4.payload = (mask & 8) == 8 ? 1:0;\nmsg5.payload = (mask & 4) == 4 ? 1:0;\nmsg6.payload = (mask & 2) == 2 ? 1:0;\nmsg7.payload = (mask & 1) == 1 ? 1:0;\n\nreturn [msg0,msg1,msg2,msg3,msg4,msg5,msg6,msg7]",
"func": "var mask = msg.payload;\n\nvar msg0={};\nvar msg1={};\nvar msg2={};\nvar msg3={};\nvar msg4={};\nvar msg5={};\nvar msg6={};\nvar msg7={};\n\nmsg0.payload = (mask >> 7) & 1;\nmsg1.payload = (mask >> 6) & 1;\nmsg2.payload = (mask >> 5) & 1;\nmsg3.payload = (mask >> 4) & 1;\nmsg4.payload = (mask >> 3) & 1;\nmsg5.payload = (mask >> 2) & 1;\nmsg6.payload = (mask >> 1) & 1;\nmsg7.payload = (mask >> 0) & 1;\n\nreturn [msg0,msg1,msg2,msg3,msg4,msg5,msg6,msg7]",
"outputs": 8,
"noerr": 0,
"x": 559.2833251953125,
Expand Down Expand Up @@ -422,13 +425,71 @@
"y": 448,
"wires": []
},
{
"id": "ad612c0a.14cbd",
"type": "influxdb out",
"z": "f12e8a0a.1aa5c",
"influxdb": "45a93ed5.79a518",
"name": "PoolMaster",
"measurement": "PoolMaster",
"precision": "",
"retentionPolicy": "",
"x": 626.255615234375,
"y": 824.5166015625,
"wires": []
},
{
"id": "8b8f8000.a3e598",
"type": "debug",
"z": "f12e8a0a.1aa5c",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 618.0333862304688,
"y": 875.1277465820312,
"wires": []
},
{
"id": "58bd9ea8.646dd",
"type": "function",
"z": "f12e8a0a.1aa5c",
"name": "Decode MySensor Message",
"func": "if(typeof msg.payload.IO !== 'undefined')\n{\n var mask = msg.payload.IO;\n var mask2 = msg.payload.IO2;\n \n msg.payload.FiltState = (mask >> 7) & 1;\n msg.payload.pHPumpState = (mask >> 6) & 1;\n msg.payload.ChlPumpState = (mask >> 5) & 1;\n msg.payload.pHLevel = (mask >> 4) & 1;\n msg.payload.ChlLevel = (mask >> 3) & 1;\n msg.payload.PSIError = (mask >> 2) & 1;\n msg.payload.pHPumpUpTimeErr = (mask >> 1) & 1;\n msg.payload.ChlPumpUpTimeErr = (mask >> 0) & 1;\n \n msg.payload.pHPIDMode = (mask2 >> 7) & 1;\n msg.payload.ChlPIDMode = (mask2 >> 6) & 1;\n msg.payload.AutoMode = (mask2 >> 5) & 1;\n msg.payload.WaterHeat = (mask2 >> 4) & 1;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 403.1444091796875,
"y": 824.4054565429688,
"wires": [
[
"8b8f8000.a3e598",
"ad612c0a.14cbd"
]
]
},
{
"id": "6679fce8.af4b5c",
"type": "debug",
"z": "f12e8a0a.1aa5c",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 337.5,
"y": 341.875,
"wires": []
},
{
"id": "52f071e8.d90a9",
"type": "blynk-ws-client",
"z": "",
"name": "Blynk Cloud",
"path": "ws://blynk-cloud.com/websockets",
"key": "xxxxxxxxxxxxxxxxxxx",
"key": "cca39e78c5494531a626615644be4b9a",
"dbg_all": true,
"dbg_read": false,
"dbg_write": false,
Expand All @@ -449,9 +510,9 @@
"type": "mqtt-broker",
"z": "",
"name": "Local Broker",
"broker": "192.168.0.xx",
"broker": "192.168.0.38",
"port": "1883",
"clientid": "XXXXXX",
"clientid": "CharNodeRed",
"usetls": false,
"compatmode": true,
"keepalive": "60",
Expand All @@ -466,5 +527,17 @@
"willQos": "0",
"willRetain": "true",
"willPayload": "offline"
},
{
"id": "45a93ed5.79a518",
"type": "influxdb",
"z": "",
"hostname": "127.0.0.1",
"port": "8086",
"protocol": "http",
"database": "POOL",
"name": "Pool",
"usetls": false,
"tls": ""
}
]
128 changes: 0 additions & 128 deletions NodeRed/NodeRedGrafanaInfluxDBFlow.txt

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ Below are the Payloads/commands to publish on the "PoolTopicAPI" topic (see hard
<li>{"DelayPID":30} -> Delay (in mins) after FiltT0 before the PID regulation loops will start. This is to let the Orp and pH readings stabilize first. 30mins in this example. Should not be > 59mins</li>
<li>{"TempExt":4.2} -> Provide the system with the external temperature. Should be updated regularly and will be used to start filtration when temperature is less than 2°C. 4.2deg in this example</li>
<li>{"PSIHigh":1.0} -> set the water high-pressure threshold (1.0bar in this example). When water pressure is over that threshold, an error flag is set</li>
<li>{"pHTank":[20,100]} -> call this function when the Acid tank is replaced or refilled. First parameter is the tank volume, second parameter is its percentage fill (100% when full)</li>
<li>{"ChlTank":[20,100]} -> call this function when the Chlorine tank is replaced or refilled. First parameter is the tank volume, second parameter is its percentage fill (100% when full)</li>
<li>{"pHTank":[20,100]} -> call this function when the Acid tank is replaced or refilled. First parameter is the tank volume in Liters, second parameter is its percentage fill (100% when full)</li>
<li>{"ChlTank":[20,100]} -> call this function when the Chlorine tank is replaced or refilled. First parameter is the tank volume in Liters, second parameter is its percentage fill (100% when full)</li>

</ul>
</p><br />
Expand Down

0 comments on commit f5c208d

Please sign in to comment.