the 5 function of this group, which determine whether the supply-pump must run
{
"id": "4d9ed806.e42d08",
"type": "link in",
"z": "efd2f080.df5cf8",
"name": "Supply_ON",
"links": [
"449c44f9.470ec4",
"72b230cd.0ce04",
"7e061671.e95e5",
"ca652598.ea8308",
"d998e505.7c1e1",
"e6d79acc.a1d8a8",
"f781820.c59fc8",
"2ce6a98.580b656"
],
"x": 179.00003051757812,
"y": 460.6666507720947,
"wires": [
[
"fd7d64f9.3ce9f8",
"b2367205.f8f6f",
"53d5220c.eda60c",
"b548c003.07b5c"
]
]
},
{
"id": "fd7d64f9.3ce9f8",
"type": "function",
"z": "efd2f080.df5cf8",
"name": "Valve 6 + 7",
"func": "var Valve7Open = msg.Valve7Open;\nvar Valve6Open = msg.Valve6Open;\nvar Supply4 = msg.Supply4;\n\nflow.set('Valve7Open', Valve7Open);\n\nflow.set('Valve6Open', Valve6Open);\n\n//node.warn(\"Valve 7 is \" + Valve7Open);\n//node.warn(\"Valve 6 is \" + Valve6Open);\n\nif ( Valve7Open === 1 || Valve6Open === 1 ) {\n Supply4 = true;\n }\n else {\n if ( Valve7Open === 0 && Valve6Open === 0 ) {\n Supply4 = false;\n }\n }\n \nflow.set('Supply4', Supply4);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 314.0000305175781,
"y": 400.6666507720947,
"wires": [
[
"e7c3c751.2a2878"
]
]
},
{
"id": "b2367205.f8f6f",
"type": "function",
"z": "efd2f080.df5cf8",
"name": "Valve 5 + 2",
"func": "var Valve5Open = msg.Valve5Open;\nvar Valve2Open = msg.Valve2Open;\nvar Supply3 = msg.Supply3;\n\nflow.set('Valve5Open', Valve5Open);\n\nflow.set('Valve2Open', Valve2Open);\n\nnode.warn(\"Valve 5 is \" + Valve5Open);\nnode.warn(\"Valve 2 is \" + Valve2Open);\n\nif ( Valve5Open === 1 || Valve2Open === 1 ) {\n Supply3 = true\n }\n else {\n if ( Valve5Open === 0 && Valve2Open === 0 ) {\n Supply3 = false\n }\n }\nflow.set('Supply3', Supply3);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 314.0000305175781,
"y": 440.6666507720947,
"wires": [
[
"e7c3c751.2a2878"
]
]
},
{
"id": "e7c3c751.2a2878",
"type": "function",
"z": "efd2f080.df5cf8",
"name": "Supply?",
"func": "var Supply1 = flow.get('Supply1');\nvar Supply2 = flow.get('Supply2');\nvar Supply3 = flow.get('Supply3');\nvar Supply4 = flow.get('Supply4');\n\nif ( Supply1 === true || \n Supply2 === true || \n Supply3 === true ||\n Supply4 === true ) {\n SupplyON = true\n }\n else {\n SupplyON = false\n }\n\nflow.set('SupplyON', SupplyON);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 504.0000305175781,
"y": 460.6666507720947,
"wires": [
[
"b5b00f0b.bee56"
]
]
},
{
"id": "53d5220c.eda60c",
"type": "function",
"z": "efd2f080.df5cf8",
"name": "Valve 1 + 3",
"func": "var Valve3Open = msg.Valve3Open;\nvar Valve1Open = msg.Valve1Open;\nnode.warn(\"Valve 1 is \" + Valve1Open);\n\nvar Supply1 = msg.Supply1;\n\nflow.set('Valve3Open', Valve3Open);\n\nflow.set('Valve1Open', Valve1Open);\n\n//node.warn(\"Valve 3 is \" + Valve3Open);\n//node.warn(\"Valve 1 is \" + Valve1Open);\n\n\nif ( Valve3Open === 1 || Valve1Open === 1 ) {\n Supply1 = true\n }\n else {\n if ( Valve3Open === 0 && Valve1Open === 0 ) {\n Supply1 = false\n }\n }\n\nflow.set('Supply1', Supply1);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 314.0000305175781,
"y": 520.6666507720947,
"wires": [
[
"e7c3c751.2a2878"
]
]
},
{
"id": "b548c003.07b5c",
"type": "function",
"z": "efd2f080.df5cf8",
"name": "Valve 4",
"func": "var Valve4Open = msg.Valve4Open;\nvar Supply2 = msg.supply2;\n\nflow.set('Valve4Open', Valve4Open);\n\nif ( Valve4Open === 1 ) {\n Supply2 = true\n }\n else {\n if ( Valve4Open === 0 ) {\n Supply2 = false\n }\n }\n\nflow.set('Supply2', Supply2);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 304.0000305175781,
"y": 480.6666507720947,
"wires": [
[
"e7c3c751.2a2878"
]
]
}
]```
there are 7 Valves how get a "open" or a "close"-command to a IOT (3); the IOT brings a return message "Valve(n) is open/close" (7 Link's "Supply_ON")
this 7 Valves is packed in 4 groups (Valve 1 + 3; Valve 4; Valve 5 + 2; Valve 6 + 7)
the only task is, if one of the valves give the message it "... is open", the Supply-Pump must be ON
normally only one valve is open, in this case there is no matter, everything is ok,
*but* if a second valve goes open, then the first Valve-condition is not more available (Valve(n) is undefined) as an effect when the second closes again, then the status "no supply pump" is set, although one valve is still open
so I can't understand the message "Valve(n) is undefined" - because in the Context-Data "Flow" there the first Valve when goes open is displayed; when a second Valve goes open, then this will be displayed, the previous no more