Skip to content

Instantly share code, notes, and snippets.

@johnty
Created April 18, 2017 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnty/98617b7d9b68b50978590225249b127c to your computer and use it in GitHub Desktop.
Save johnty/98617b7d9b68b50978590225249b127c to your computer and use it in GitHub Desktop.
PiPlant flow
[
{
"id":"1b6d4b38.cc6c95",
"type":"tab",
"label":"PiPlant"
},
{
"id":"7e18a8a7.dea448",
"type":"rpi-gpio out",
"z":"1b6d4b38.cc6c95",
"name":"Relay 1",
"pin":"13",
"set":true,
"level":"0",
"out":"out",
"x":783.5,
"y":65,
"wires":[
]
},
{
"id":"e4bc168d.802b88",
"type":"mcp3008",
"z":"1b6d4b38.cc6c95",
"name":"Water Sensor (CH0)",
"device":"/dev/spidev0.0",
"mode":"0x80",
"interval":"250",
"x":139.5,
"y":179,
"wires":[
[
"4a22d5b5.db323c"
]
]
},
{
"id":"8e59899b.277f78",
"type":"inject",
"z":"1b6d4b38.cc6c95",
"name":"",
"topic":"",
"payload":"start",
"payloadType":"str",
"repeat":"",
"crontab":"",
"once":true,
"x":105.5,
"y":46,
"wires":[
[
"e4bc168d.802b88"
]
]
},
{
"id":"fe0ec7.b57db138",
"type":"inject",
"z":"1b6d4b38.cc6c95",
"name":"",
"topic":"",
"payload":"stop",
"payloadType":"str",
"repeat":"",
"crontab":"",
"once":false,
"x":106,
"y":82,
"wires":[
[
"e4bc168d.802b88"
]
]
},
{
"id":"d500a2a9.53b83",
"type":"rbe",
"z":"1b6d4b38.cc6c95",
"name":"",
"func":"rbe",
"gap":"",
"start":"",
"inout":"out",
"x":487.5,
"y":65,
"wires":[
[
"442146e2.5be678",
"7e18a8a7.dea448"
]
]
},
{
"id":"d306f048.27de7",
"type":"ui_gauge",
"z":"1b6d4b38.cc6c95",
"name":"",
"group":"a4a65d36.51d68",
"order":1,
"width":"0",
"height":"0",
"gtype":"gage",
"title":"Moisture Level",
"label":"moisture",
"format":"{{value}}",
"min":0,
"max":"100",
"colors":[
"#9f0003",
"#e6e600",
"#0aff00"
],
"seg1":"",
"seg2":"",
"x":640.5,
"y":308,
"wires":[
]
},
{
"id":"81dd3b03.edb5f8",
"type":"ui_slider",
"z":"1b6d4b38.cc6c95",
"name":"",
"label":"Set Threshold",
"group":"a4a65d36.51d68",
"order":3,
"width":"0",
"height":"0",
"passthru":true,
"topic":"threshold",
"min":0,
"max":"100",
"step":"",
"x":294.5,
"y":448,
"wires":[
[
"d4bf05ce.fe0c08",
"2c4908e9.865a98"
]
]
},
{
"id":"442146e2.5be678",
"type":"ui_switch",
"z":"1b6d4b38.cc6c95",
"name":"",
"label":"Plant 1 Watering",
"group":"a4a65d36.51d68",
"order":2,
"width":"6",
"height":"1",
"passthru":true,
"topic":"",
"style":"",
"onvalue":"1",
"onvalueType":"num",
"onicon":"",
"oncolor":"",
"offvalue":"0",
"offvalueType":"num",
"officon":"",
"offcolor":"",
"x":641.5,
"y":401,
"wires":[
[
]
]
},
{
"id":"640c0a49.a92a94",
"type":"function",
"z":"1b6d4b38.cc6c95",
"name":"check threshold",
"func":"num = flow.get(\"threshold\") || 50;\n//node.log(\"retr thres = \" + num);\n\nif (msg.payload > num)\n msg.payload = 0;\nelse\n msg.payload = 1;\n\n\nreturn msg;",
"outputs":"1",
"noerr":0,
"x":331.5,
"y":65,
"wires":[
[
"d500a2a9.53b83"
]
]
},
{
"id":"d4bf05ce.fe0c08",
"type":"function",
"z":"1b6d4b38.cc6c95",
"name":"set threshold",
"func":"\n\nflow.set(\"threshold\",msg.payload); \nnode.log(\"threshold set to \" + msg.payload);\n\n",
"outputs":"1",
"noerr":0,
"x":463.5,
"y":496,
"wires":[
[
]
]
},
{
"id":"2c4908e9.865a98",
"type":"ui_text",
"z":"1b6d4b38.cc6c95",
"group":"a4a65d36.51d68",
"order":4,
"width":0,
"height":0,
"name":"",
"label":"Threshold value",
"format":"{{msg.payload}}",
"layout":"row-spread",
"x":640.5,
"y":449,
"wires":[
]
},
{
"id":"e51acae1.87c7e8",
"type":"comment",
"z":"1b6d4b38.cc6c95",
"name":"read moisture value",
"info":"",
"x":123.5,
"y":223,
"wires":[
]
},
{
"id":"c13e2785.21dc38",
"type":"comment",
"z":"1b6d4b38.cc6c95",
"name":"only toggle relay on change",
"info":"",
"x":557,
"y":32,
"wires":[
]
},
{
"id":"eb8a28de.544e28",
"type":"comment",
"z":"1b6d4b38.cc6c95",
"name":"GPIO output on pin13 (left header on PiShield)",
"info":"",
"x":713,
"y":112,
"wires":[
]
},
{
"id":"8508178a.90af48",
"type":"comment",
"z":"1b6d4b38.cc6c95",
"name":"Dashboard UI",
"info":"",
"x":207,
"y":310,
"wires":[
]
},
{
"id":"f137eb44.ee9a48",
"type":"trigger",
"z":"1b6d4b38.cc6c95",
"op1":"1",
"op2":"0",
"op1type":"num",
"op2type":"num",
"duration":"5",
"extend":false,
"units":"s",
"reset":"",
"name":"",
"x":436,
"y":401,
"wires":[
[
"7e18a8a7.dea448",
"442146e2.5be678"
]
]
},
{
"id":"6e9041ab.6698a",
"type":"ui_button",
"z":"1b6d4b38.cc6c95",
"name":"",
"group":"a4a65d36.51d68",
"order":6,
"width":0,
"height":0,
"label":"water now!",
"color":"",
"bgcolor":"",
"icon":"",
"payload":"1",
"payloadType":"num",
"topic":"",
"x":285.5,
"y":401,
"wires":[
[
"f137eb44.ee9a48"
]
]
},
{
"id":"4a22d5b5.db323c",
"type":"smooth",
"z":"1b6d4b38.cc6c95",
"name":"",
"action":"mean",
"count":"5",
"round":"",
"x":268.5,
"y":140,
"wires":[
[
"409336d1.5be148"
]
]
},
{
"id":"af69006.4bbb",
"type":"delay",
"z":"1b6d4b38.cc6c95",
"name":"",
"pauseType":"rate",
"timeout":"5",
"timeoutUnits":"seconds",
"rate":"1",
"nbRateUnits":"1",
"rateUnits":"minute",
"randomFirst":"1",
"randomLast":"5",
"randomUnits":"seconds",
"drop":true,
"x":406,
"y":349,
"wires":[
[
"bce4eed3.35b51",
"a0918d88.59d61"
]
]
},
{
"id":"bce4eed3.35b51",
"type":"ui_chart",
"z":"1b6d4b38.cc6c95",
"name":"",
"group":"a4a65d36.51d68",
"order":5,
"width":0,
"height":0,
"label":"moisture history",
"chartType":"line",
"legend":"false",
"xformat":"HH:mm",
"interpolate":"linear",
"nodata":"",
"ymin":"0",
"ymax":"100",
"removeOlder":"1",
"removeOlderPoints":"1440",
"removeOlderUnit":"86400",
"cutout":0,
"colors":[
"#1f77b4",
"#aec7e8",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"x":610,
"y":349,
"wires":[
[
],
[
]
]
},
{
"id":"409336d1.5be148",
"type":"range",
"z":"1b6d4b38.cc6c95",
"minin":"400",
"maxin":"600",
"minout":"100",
"maxout":"0",
"action":"scale",
"round":true,
"name":"",
"x":346,
"y":180,
"wires":[
[
"640c0a49.a92a94",
"af69006.4bbb",
"d306f048.27de7"
]
]
},
{
"id":"155ae51a.7a16ab",
"type":"comment",
"z":"1b6d4b38.cc6c95",
"name":"map from Moist V2.0 sensor output to 0-100",
"info":"",
"x":464,
"y":224,
"wires":[
]
},
{
"id":"a0918d88.59d61",
"type":"fred out",
"z":"1b6d4b38.cc6c95",
"name":"",
"server":"",
"client":"c0c5ac8d.c7698",
"x":775,
"y":495,
"wires":[
]
},
{
"id":"a4a65d36.51d68",
"type":"ui_group",
"z":"",
"name":"PiPlant Control",
"tab":"9b452f14.609d3",
"order":1,
"disp":true,
"width":"6"
},
{
"id":"c0c5ac8d.c7698",
"type":"fred-client",
"z":"",
"endpoint":"PlantMoisture",
"private":true,
"username":"johnty",
"wholemsg":"false"
},
{
"id":"9b452f14.609d3",
"type":"ui_tab",
"z":"",
"name":"PiPlant",
"icon":"dashboard",
"order":1
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment