Skip to content

Commit

Permalink
Added new pulse conversion rate for L
Browse files Browse the repository at this point in the history
Changed switch to check msg.unit for diferent pulse sensors before conversion
  • Loading branch information
st-randers committed May 31, 2024
1 parent 3c47ff3 commit bf0a109
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 11 deletions.
2 changes: 2 additions & 0 deletions node-red/flows_js/_order.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"junction.f95e5611728b1e83.flows.js",
"junction.3150c301cadb8a59.flows.js",
"junction.6afc07dac143d279.flows.js",
"junction.028c44fb899568ec.flows.js",
"prometheus_metric_config.7a80158bbfee95fe.flows.js",
"prometheus_metric_config.e47b437e1ecdc573.flows.js",
"prometheus_metric_config.36feaadaa1b1982a.flows.js",
Expand All @@ -35,6 +36,7 @@
"change.968a0d7d993a1719.flows.js",
"switch.4a02547fe228c1a9.flows.js",
"change.603b599ad5e95714.flows.js",
"change.8384db191bf875a1.flows.js",
"debug.071a7a3c275c82f7.flows.js",
"catch.91e8aa626025470f.flows.js",
"status.c3049ebe67d10519.flows.js",
Expand Down
4 changes: 2 additions & 2 deletions node-red/flows_js/change.603b599ad5e95714.flows.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const Node = {
"t": "set",
"p": "data",
"pt": "msg",
"to": "data ~> | $.values | {\t \"value\": value * 0.1\t} |",
"to": "data ~> | $.values | {\t\t /* 1 pulse = 0.1 m3 */\t \"value\": value * 0.1\t} |",
"tot": "jsonata"
}
],
Expand All @@ -17,7 +17,7 @@ const Node = {
"from": "",
"to": "",
"reg": false,
"x": 630,
"x": 650,
"y": 140,
"wires": [
[]
Expand Down
27 changes: 27 additions & 0 deletions node-red/flows_js/change.8384db191bf875a1.flows.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const Node = {
"id": "8384db191bf875a1",
"type": "change",
"z": "f93fc1e5c4176e6a",
"name": "Multiply values for L conversion",
"rules": [
{
"t": "set",
"p": "data",
"pt": "msg",
"to": "data ~> | $.values | {\t \t /* 1 pulse = 10 liter */\t \"value\": value * 10\t} |",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 650,
"y": 180,
"wires": [
[]
]
}

module.exports = Node;
7 changes: 7 additions & 0 deletions node-red/flows_js/change.89e54413776207ed.flows.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ const Node = {
"to": "data.productType",
"tot": "msg",
"dc": true
},
{
"t": "set",
"p": "unit",
"pt": "msg",
"to": "data.unit",
"tot": "msg"
}
],
"action": "",
Expand Down
2 changes: 1 addition & 1 deletion node-red/flows_js/change.968a0d7d993a1719.flows.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Node = {
"to": "",
"reg": false,
"x": 190,
"y": 160,
"y": 180,
"wires": [
[
"4a02547fe228c1a9"
Expand Down
12 changes: 12 additions & 0 deletions node-red/flows_js/junction.028c44fb899568ec.flows.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const Node = {
"id": "028c44fb899568ec",
"type": "junction",
"z": "f93fc1e5c4176e6a",
"x": 780,
"y": 220,
"wires": [
[]
]
}

module.exports = Node;
8 changes: 5 additions & 3 deletions node-red/flows_js/junction.8bfbbd8a03d0531e.flows.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ const Node = {
"id": "8bfbbd8a03d0531e",
"type": "junction",
"z": "f93fc1e5c4176e6a",
"x": 500,
"y": 180,
"x": 520,
"y": 220,
"wires": [
[]
[
"028c44fb899568ec"
]
]
}

Expand Down
6 changes: 5 additions & 1 deletion node-red/flows_js/subflow.f93fc1e5c4176e6a.flows.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ const Node = {
"port": 0
},
{
"id": "8bfbbd8a03d0531e",
"id": "8384db191bf875a1",
"port": 0
},
{
"id": "028c44fb899568ec",
"port": 0
}
]
Expand Down
16 changes: 12 additions & 4 deletions node-red/flows_js/switch.4a02547fe228c1a9.flows.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ const Node = {
"type": "switch",
"z": "f93fc1e5c4176e6a",
"name": "",
"property": "productType",
"property": "unit",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "pulse",
"v": "m3",
"vt": "str"
},
{
"t": "eq",
"v": "L",
"vt": "str"
},
{
Expand All @@ -17,13 +22,16 @@ const Node = {
],
"checkall": "true",
"repair": false,
"outputs": 2,
"outputs": 3,
"x": 390,
"y": 160,
"y": 180,
"wires": [
[
"603b599ad5e95714"
],
[
"8384db191bf875a1"
],
[
"8bfbbd8a03d0531e"
]
Expand Down

0 comments on commit bf0a109

Please sign in to comment.