Skip to content

Instantly share code, notes, and snippets.

@dexterlabora
Created July 28, 2020 17:24
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 dexterlabora/c27c2b5b2c7f2a57241be5d59ba7df3e to your computer and use it in GitHub Desktop.
Save dexterlabora/c27c2b5b2c7f2a57241be5d59ba7df3e to your computer and use it in GitHub Desktop.
Is basement humidity above 50%? Is current power draw in Watts below 5.0 on dehumidfier? Only if both of those are true, then trigger the next step in the flow.
[
{
"id": "8d3e6c8e.8cbc9",
"type": "inject",
"z": "e941d247.46185",
"name": "51%",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "humidity",
"payload": "51",
"payloadType": "num",
"x": 330,
"y": 180,
"wires": [
[
"2e209753.9b4fb8"
]
]
},
{
"id": "d08663fb.931a3",
"type": "inject",
"z": "e941d247.46185",
"name": "49%",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "humidity",
"payload": "49",
"payloadType": "num",
"x": 330,
"y": 240,
"wires": [
[
"2e209753.9b4fb8"
]
]
},
{
"id": "f249379b.160858",
"type": "debug",
"z": "e941d247.46185",
"name": "Trigger the thing?",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 810,
"y": 640,
"wires": []
},
{
"id": "5e9c463a.27fc68",
"type": "inject",
"z": "e941d247.46185",
"name": "6",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "power",
"payload": "6",
"payloadType": "num",
"x": 330,
"y": 360,
"wires": [
[
"a54e7199.6374"
]
]
},
{
"id": "37566273.473d5e",
"type": "inject",
"z": "e941d247.46185",
"name": "4",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "power",
"payload": "4",
"payloadType": "num",
"x": 330,
"y": 420,
"wires": [
[
"a54e7199.6374"
]
]
},
{
"id": "a54e7199.6374",
"type": "change",
"z": "e941d247.46185",
"name": "set power",
"rules": [
{
"t": "set",
"p": "power",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 620,
"y": 380,
"wires": [
[
"415e4fa7.4acc8"
]
]
},
{
"id": "415e4fa7.4acc8",
"type": "debug",
"z": "e941d247.46185",
"name": "power",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 820,
"y": 380,
"wires": []
},
{
"id": "de50d254.81b9c",
"type": "comment",
"z": "e941d247.46185",
"name": "Humidity",
"info": "",
"x": 240,
"y": 120,
"wires": []
},
{
"id": "db4148b8.c373f8",
"type": "comment",
"z": "e941d247.46185",
"name": "Power",
"info": "",
"x": 230,
"y": 300,
"wires": []
},
{
"id": "cfb9c3af.f6f99",
"type": "debug",
"z": "e941d247.46185",
"name": "humidity",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 820,
"y": 200,
"wires": []
},
{
"id": "49318b1c.5960f4",
"type": "function",
"z": "e941d247.46185",
"name": "Check power and humidity level",
"func": "var power = flow.get('power')\nvar humidity = flow.get('humidity')\n\nvar minPower = 5;\nvar minHumidity = 50;\n\n// Check Levels\nif(power < minPower && humidity > minHumidity){\n msg.payload = true;\n}else{\n msg.payload = false;\n}\n\nreturn msg\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 510,
"y": 640,
"wires": [
[
"f249379b.160858"
]
]
},
{
"id": "2e209753.9b4fb8",
"type": "change",
"z": "e941d247.46185",
"name": "set humidity",
"rules": [
{
"t": "set",
"p": "humidity",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 610,
"y": 200,
"wires": [
[
"cfb9c3af.f6f99",
"566cc94a.99f208"
]
]
},
{
"id": "a535b1aa.3022a",
"type": "link in",
"z": "e941d247.46185",
"name": "Humidity Workflow",
"links": [
"566cc94a.99f208"
],
"x": 305,
"y": 640,
"wires": [
[
"49318b1c.5960f4"
]
]
},
{
"id": "566cc94a.99f208",
"type": "link out",
"z": "e941d247.46185",
"name": "Humidity",
"links": [
"a535b1aa.3022a"
],
"x": 745,
"y": 240,
"wires": []
},
{
"id": "243e481a.080958",
"type": "comment",
"z": "e941d247.46185",
"name": "Workflow",
"info": "",
"x": 240,
"y": 520,
"wires": []
},
{
"id": "1370c306.727e1d",
"type": "comment",
"z": "e941d247.46185",
"name": "onHumidity",
"info": "",
"x": 270,
"y": 580,
"wires": []
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment