Hello everyone,
first of all: this is my first projekt using node-red and my programming skills are ... well I can edit scripts to (maybe) do my bidding, but not create one myself. Here in Germany it's called "gefährliches Halbwissen" which would translate to "dangerous half-knowledge"
I'm trying to set up a automated watering system for my balcony looking like this:
It consits of 3 3way valves and a pump. The pump starts working, pumping in a circle and the valves will direkt the water to the desired location. No sensors so far, it's simply controlled by flow rate and time (ml/sec).
I'm using a Pi Zero and a i2c-relayboard and managed to build something that would work the way I want it:
[
{
"id": "162fe4b273bd1cab",
"type": "tab",
"label": "Flow 2",
"disabled": false,
"info": "",
"env": []
},
{
"id": "0d90552af145dbb3",
"type": "thingzi-timer",
"z": "162fe4b273bd1cab",
"name": "",
"lat": "0",
"lon": "0",
"timerType": "trigger",
"startupMessage": false,
"ontype": "tod",
"ontimesun": "dusk",
"ontimetod": "19:50",
"onpropertytype": "msg",
"onproperty": "payload",
"onvaluetype": "str",
"onvalue": "1",
"onoffset": "",
"onrandomoffset": false,
"offtype": "tod",
"offtimesun": "dawn",
"offtimetod": "18:47",
"offpropertytype": "msg",
"offproperty": "payload",
"offvaluetype": "str",
"offvalue": "OFF",
"offoffset": "",
"offrandomoffset": false,
"mon": true,
"tue": true,
"wed": true,
"thu": true,
"fri": true,
"sat": true,
"sun": true,
"x": 150,
"y": 260,
"wires": [
[
"716941a82c85c631",
"b738ca67820e9a81",
"8587b5b7c4212ea7"
]
]
},
{
"id": "716941a82c85c631",
"type": "trigger",
"z": "162fe4b273bd1cab",
"name": "",
"op1": "AN1C2 ON",
"op2": "AN1C2 OFF",
"op1type": "str",
"op2type": "str",
"duration": "60",
"extend": false,
"overrideDelay": false,
"units": "s",
"reset": "",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 370,
"y": 260,
"wires": [
[
"d6a905e3bceafa3a",
"2d02d61869c62c0d"
]
]
},
{
"id": "b738ca67820e9a81",
"type": "delay",
"z": "162fe4b273bd1cab",
"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": 380,
"y": 380,
"wires": [
[
"1c6b440c14e4f173"
]
]
},
{
"id": "1c6b440c14e4f173",
"type": "trigger",
"z": "162fe4b273bd1cab",
"name": "",
"op1": "AN1C3 ON",
"op2": "AN1C3 OFF",
"op1type": "str",
"op2type": "str",
"duration": "15",
"extend": false,
"overrideDelay": false,
"units": "s",
"reset": "",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 570,
"y": 380,
"wires": [
[
"d6a905e3bceafa3a",
"2d02d61869c62c0d"
]
]
},
{
"id": "8587b5b7c4212ea7",
"type": "delay",
"z": "162fe4b273bd1cab",
"name": "",
"pauseType": "delay",
"timeout": "25",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 390,
"y": 500,
"wires": [
[
"64a83f5d1689236d"
]
]
},
{
"id": "64a83f5d1689236d",
"type": "trigger",
"z": "162fe4b273bd1cab",
"name": "",
"op1": "AN1C4 ON",
"op2": "AN1C4 OFF",
"op1type": "str",
"op2type": "str",
"duration": "15",
"extend": false,
"overrideDelay": false,
"units": "s",
"reset": "",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 590,
"y": 500,
"wires": [
[
"d6a905e3bceafa3a",
"2d02d61869c62c0d"
]
]
},
{
"id": "e3f18831173c58d8",
"type": "i2c out",
"z": "162fe4b273bd1cab",
"name": "Relay 4 - ON ",
"busno": "1",
"address": "16",
"command": "255",
"payload": "[16,4,255]",
"payloadType": "bin",
"count": "3",
"x": 1210,
"y": 320,
"wires": [
[]
]
},
{
"id": "d6a905e3bceafa3a",
"type": "switch",
"z": "162fe4b273bd1cab",
"name": "Relay 1-4 Triggered ON",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "AN1C1 ON",
"vt": "str"
},
{
"t": "eq",
"v": "AN1C2 ON",
"vt": "str"
},
{
"t": "eq",
"v": "AN1C3 ON",
"vt": "str"
},
{
"t": "eq",
"v": "AN1C4 ON",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 4,
"x": 950,
"y": 260,
"wires": [
[
"7bc5f18c1c26907d"
],
[
"bb6d3b27d826ec6e"
],
[
"75e6a649601d712d"
],
[
"e3f18831173c58d8"
]
]
},
{
"id": "7bc5f18c1c26907d",
"type": "i2c out",
"z": "162fe4b273bd1cab",
"name": "Relay 1 - ON ",
"busno": "1",
"address": "16",
"command": "255",
"payload": "[16,1,255]",
"payloadType": "bin",
"count": "3",
"x": 1210,
"y": 200,
"wires": [
[]
]
},
{
"id": "bb6d3b27d826ec6e",
"type": "i2c out",
"z": "162fe4b273bd1cab",
"name": "Relay 2 - ON ",
"busno": "1",
"address": "16",
"command": "255",
"payload": "[16,2,255]",
"payloadType": "bin",
"count": "3",
"x": 1210,
"y": 240,
"wires": [
[]
]
},
{
"id": "75e6a649601d712d",
"type": "i2c out",
"z": "162fe4b273bd1cab",
"name": "Relay 3 - ON ",
"busno": "1",
"address": "16",
"command": "255",
"payload": "[16,3,255]",
"payloadType": "bin",
"count": "3",
"x": 1210,
"y": 280,
"wires": [
[]
]
},
{
"id": "b97f6fb371de8e0a",
"type": "i2c out",
"z": "162fe4b273bd1cab",
"name": "Relay 4 - OFF ",
"busno": "1",
"address": "16",
"command": "255",
"payload": "[16,4,0]",
"payloadType": "bin",
"count": "3",
"x": 1220,
"y": 500,
"wires": [
[]
]
},
{
"id": "2d02d61869c62c0d",
"type": "switch",
"z": "162fe4b273bd1cab",
"name": "Relay 1-4 Triggered OFF",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "AN1C1 OFF",
"vt": "str"
},
{
"t": "eq",
"v": "AN1C2 OFF",
"vt": "str"
},
{
"t": "eq",
"v": "AN1C3 OFF",
"vt": "str"
},
{
"t": "eq",
"v": "AN1C4 OFF",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 4,
"x": 950,
"y": 440,
"wires": [
[
"c03c5b65809ad41b"
],
[
"18b84a231ce51d78"
],
[
"76c58507dd0bb2a7"
],
[
"b97f6fb371de8e0a"
]
]
},
{
"id": "c03c5b65809ad41b",
"type": "i2c out",
"z": "162fe4b273bd1cab",
"name": "Relay 1 - OFF",
"busno": "1",
"address": "16",
"command": "255",
"payload": "[16,1,0]",
"payloadType": "bin",
"count": "3",
"x": 1220,
"y": 380,
"wires": [
[]
]
},
{
"id": "18b84a231ce51d78",
"type": "i2c out",
"z": "162fe4b273bd1cab",
"name": "Relay 2 - OFF",
"busno": "1",
"address": "16",
"command": "255",
"payload": "[16,2,0]",
"payloadType": "bin",
"count": "3",
"x": 1220,
"y": 420,
"wires": [
[]
]
},
{
"id": "76c58507dd0bb2a7",
"type": "i2c out",
"z": "162fe4b273bd1cab",
"name": "Relay 3 - OFF ",
"busno": "1",
"address": "16",
"command": "255",
"payload": "[16,3,0]",
"payloadType": "bin",
"count": "3",
"x": 1220,
"y": 460,
"wires": [
[]
]
},
{
"id": "92b9a69d1a627c2f",
"type": "timeswitch",
"z": "162fe4b273bd1cab",
"name": "",
"mytopic": "",
"lat": "0",
"lon": "0",
"starttime": "5000",
"endtime": "6000",
"timezone": "Europe/Berlin",
"duskoff": "0",
"dawnoff": "0",
"sun": true,
"mon": true,
"tue": true,
"wed": true,
"thu": true,
"fri": true,
"sat": true,
"jan": true,
"feb": true,
"mar": true,
"apr": true,
"may": true,
"jun": true,
"jul": true,
"aug": true,
"sep": true,
"oct": true,
"nov": true,
"dec": true,
"x": 160,
"y": 120,
"wires": [
[
"3d01cccc5eb097b9"
]
]
},
{
"id": "d2bd7842e7712a77",
"type": "trigger",
"z": "162fe4b273bd1cab",
"name": "",
"op1": "AN1C1 ON",
"op2": "0",
"op1type": "str",
"op2type": "str",
"duration": "0",
"extend": false,
"overrideDelay": false,
"units": "ms",
"reset": "0",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 520,
"y": 80,
"wires": [
[
"d6a905e3bceafa3a"
]
]
},
{
"id": "c2d6e2f82550b457",
"type": "trigger",
"z": "162fe4b273bd1cab",
"name": "",
"op1": "AN1C1 OFF",
"op2": "0",
"op1type": "str",
"op2type": "str",
"duration": "0",
"extend": false,
"overrideDelay": false,
"units": "ms",
"reset": "1",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 520,
"y": 160,
"wires": [
[
"2d02d61869c62c0d"
]
]
},
{
"id": "3d01cccc5eb097b9",
"type": "rbe",
"z": "162fe4b273bd1cab",
"name": "",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"septopics": true,
"property": "payload",
"topi": "topic",
"x": 330,
"y": 120,
"wires": [
[
"d2bd7842e7712a77",
"c2d6e2f82550b457"
]
]
},
{
"id": "7f3f58d82654fc4e",
"type": "comment",
"z": "162fe4b273bd1cab",
"name": "Pump (Relay 2)",
"info": "",
"x": 380,
"y": 300,
"wires": []
},
{
"id": "661459d1383d9681",
"type": "comment",
"z": "162fe4b273bd1cab",
"name": "solenoid valve 1 (Relay 3)",
"info": "",
"x": 470,
"y": 420,
"wires": []
},
{
"id": "3f1b8a572b97683b",
"type": "comment",
"z": "162fe4b273bd1cab",
"name": "solenoid valve 2 (Relay 4)",
"info": "",
"x": 510,
"y": 540,
"wires": []
},
{
"id": "e023d531499026f8",
"type": "comment",
"z": "162fe4b273bd1cab",
"name": "Growlight (Relay 1)",
"info": "",
"x": 190,
"y": 80,
"wires": []
},
{
"id": "59ac1c821e10f4ea",
"type": "comment",
"z": "162fe4b273bd1cab",
"name": "Watering",
"info": "",
"x": 140,
"y": 320,
"wires": []
},
{
"id": "c6b24d43b2efbeb2",
"type": "comment",
"z": "162fe4b273bd1cab",
"name": "DockerPi 4 Channel Relay",
"info": "",
"x": 950,
"y": 160,
"wires": []
}
]
Like I said, it's working (thanks to the community and the provided nodes for the relay-board). One relay is currently used for a growlight, so only 2 solenoid valves are in the flow right now. This will change once the plants are big enough.
At the moment I have to manually add the seconds for the pump-runtime.
So it's:
pump runtime = system filling time + solenoid vale 1 runtime + solenoid vale 2 [and so on] + buffer
But ... it's not really that comfortable to use and it's never wrong to learn something so here I am writing this post.
A real improvement would be to be able to only change the seconds for the valves. Would something like that be possible with only using nodes?
Or (maybe) via a smarthome solution where I would be able to set up the time for each valve? But if so - which one?
At the moment I just don't know where to start looking and you can't really search for a tutorial or something if you don't know what you are looking for.
Thanks in advance
Greetings from Germany
Humhum