Skip to content

Instantly share code, notes, and snippets.

@CamDavidsonPilon
Last active June 30, 2020 18:11
Show Gist options
  • Save CamDavidsonPilon/d0fd498658f5e8c9fd1056ede7c28199 to your computer and use it in GitHub Desktop.
Save CamDavidsonPilon/d0fd498658f5e8c9fd1056ede7c28199 to your computer and use it in GitHub Desktop.
Part of tempeh.io blog post
[
{
"id": "328cb8d0.ad53d8",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": ""
},
{
"id": "e064c4c9.ed0b18",
"type": "mqtt in",
"z": "328cb8d0.ad53d8",
"name": "Temperature from DHT22",
"topic": "dht22/temperature",
"qos": "0",
"datatype": "utf8",
"broker": "9eb43060.5c675",
"x": 110,
"y": 140,
"wires": [
[
"3a09f729.d9ec78",
"5113c812.f7dc28"
]
]
},
{
"id": "3a09f729.d9ec78",
"type": "ui_chart",
"z": "328cb8d0.ad53d8",
"name": "Temperature Chart",
"group": "fcaff9ec.23d2d8",
"order": 0,
"width": 0,
"height": 0,
"label": "Temperature from DHT22",
"chartType": "line",
"legend": "false",
"xformat": "HH:mm:ss",
"interpolate": "step",
"nodata": "",
"dot": false,
"ymin": "",
"ymax": "",
"removeOlder": 1,
"removeOlderPoints": "",
"removeOlderUnit": "86400",
"cutout": 0,
"useOneColor": false,
"useUTC": false,
"colors": [
"#1f77b4",
"#aec7e8",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"useOldStyle": false,
"outputs": 1,
"x": 370,
"y": 140,
"wires": [
[]
]
},
{
"id": "1d527ee7.166cd1",
"type": "mqtt in",
"z": "328cb8d0.ad53d8",
"name": "Humidity from DHT22",
"topic": "dht22/humidity",
"qos": "0",
"datatype": "utf8",
"broker": "9eb43060.5c675",
"x": 100,
"y": 320,
"wires": [
[
"8bd609ea.614998",
"2d39e10d.f0789e"
]
]
},
{
"id": "8bd609ea.614998",
"type": "ui_chart",
"z": "328cb8d0.ad53d8",
"name": "Humidity Chart",
"group": "fcaff9ec.23d2d8",
"order": 0,
"width": 0,
"height": 0,
"label": "Humidity from DHT22",
"chartType": "line",
"legend": "false",
"xformat": "HH:mm:ss",
"interpolate": "linear",
"nodata": "",
"dot": false,
"ymin": "",
"ymax": "",
"removeOlder": 1,
"removeOlderPoints": "",
"removeOlderUnit": "86400",
"cutout": 0,
"useOneColor": false,
"useUTC": false,
"colors": [
"#1f77b4",
"#aec7e8",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"useOldStyle": false,
"outputs": 1,
"x": 360,
"y": 320,
"wires": [
[]
]
},
{
"id": "36c9e1e6.bc1bde",
"type": "sqlite",
"z": "328cb8d0.ad53d8",
"mydb": "1b4a1f87.f6076",
"sqlquery": "msg.topic",
"sql": "",
"name": "TemperatureWrite",
"x": 910,
"y": 260,
"wires": [
[]
]
},
{
"id": "370d3feb.4dc36",
"type": "template",
"z": "328cb8d0.ad53d8",
"name": "SQL Insert Template",
"field": "topic",
"fieldType": "msg",
"format": "sql",
"syntax": "mustache",
"template": "INSERT INTO temperature_readings (temperature, experiment_tag, source, timestamp)\nVALUES ({{payload}}, \"{{{experiment_tag}}}\", \"{{{topic}}}\", \"{{timestamp}}\");",
"output": "str",
"x": 660,
"y": 260,
"wires": [
[
"36c9e1e6.bc1bde"
]
]
},
{
"id": "5113c812.f7dc28",
"type": "moment",
"z": "328cb8d0.ad53d8",
"name": "",
"topic": "",
"input": "",
"inputType": "date",
"inTz": "Europe/London",
"adjAmount": 0,
"adjType": "days",
"adjDir": "add",
"format": "",
"locale": "en_GB",
"output": "timestamp",
"outputType": "msg",
"outTz": "Europe/London",
"x": 380,
"y": 200,
"wires": [
[
"e139c8e9.a4ee98"
]
]
},
{
"id": "2d39e10d.f0789e",
"type": "moment",
"z": "328cb8d0.ad53d8",
"name": "",
"topic": "",
"input": "",
"inputType": "date",
"inTz": "Europe/London",
"adjAmount": 0,
"adjType": "days",
"adjDir": "add",
"format": "",
"locale": "en_GB",
"output": "timestamp",
"outputType": "msg",
"outTz": "Europe/London",
"x": 380,
"y": 380,
"wires": [
[
"20228af1.de8786"
]
]
},
{
"id": "89c50e93.8795",
"type": "template",
"z": "328cb8d0.ad53d8",
"name": "SQL Insert Template",
"field": "topic",
"fieldType": "msg",
"format": "sql",
"syntax": "mustache",
"template": "INSERT INTO humidity_readings (humidity, experiment_tag, source, timestamp)\nVALUES ({{payload}}, \"{{{experiment_tag}}}\", \"{{{topic}}}\", \"{{timestamp}}\");",
"output": "str",
"x": 660,
"y": 440,
"wires": [
[
"cd7a58d3.404fc8"
]
]
},
{
"id": "cd7a58d3.404fc8",
"type": "sqlite",
"z": "328cb8d0.ad53d8",
"mydb": "1b4a1f87.f6076",
"sqlquery": "msg.topic",
"sql": "",
"name": "HumidityWrite",
"x": 900,
"y": 440,
"wires": [
[]
]
},
{
"id": "e139c8e9.a4ee98",
"type": "change",
"z": "328cb8d0.ad53d8",
"name": "Set experiment tag",
"rules": [
{
"t": "set",
"p": "experiment_tag",
"pt": "msg",
"to": "experiment_tag",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 370,
"y": 260,
"wires": [
[
"370d3feb.4dc36"
]
]
},
{
"id": "3aeb342c.c1d9cc",
"type": "ui_text_input",
"z": "328cb8d0.ad53d8",
"name": "",
"label": "Experiment Tag",
"tooltip": "The path of the Notions page",
"group": "fcaff9ec.23d2d8",
"order": 2,
"width": 0,
"height": 0,
"passthru": true,
"mode": "text",
"delay": 300,
"topic": "",
"x": 80,
"y": 60,
"wires": [
[
"240b689e.bb7838"
]
]
},
{
"id": "240b689e.bb7838",
"type": "change",
"z": "328cb8d0.ad53d8",
"name": "Set flow.experiment_tag from UI",
"rules": [
{
"t": "set",
"p": "experiment_tag",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 330,
"y": 60,
"wires": [
[]
]
},
{
"id": "20228af1.de8786",
"type": "change",
"z": "328cb8d0.ad53d8",
"name": "Set experiment tag",
"rules": [
{
"t": "set",
"p": "experiment_tag",
"pt": "msg",
"to": "experiment_tag",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 370,
"y": 440,
"wires": [
[
"89c50e93.8795"
]
]
},
{
"id": "a6c5c576.752568",
"type": "camerapi-takephoto",
"z": "328cb8d0.ad53d8",
"filemode": "1",
"filename": "current.jpg",
"filedefpath": "1",
"filepath": "",
"fileformat": "jpeg",
"resolution": "3",
"rotation": "0",
"fliph": "0",
"flipv": "0",
"brightness": "50",
"contrast": "0",
"sharpness": "0",
"quality": "80",
"imageeffect": "none",
"exposuremode": "auto",
"iso": "0",
"agcwait": "1.0",
"led": "0",
"awb": "auto",
"name": "Take photo",
"x": 310,
"y": 540,
"wires": [
[
"542e34f2.65579c"
]
]
},
{
"id": "542e34f2.65579c",
"type": "ui_template",
"z": "328cb8d0.ad53d8",
"group": "fcaff9ec.23d2d8",
"name": "",
"order": 3,
"width": 0,
"height": 0,
"format": "<img src= \"http://192.168.0.15:1880/current.jpg\" alt='Image not found' />\n",
"storeOutMessages": true,
"fwdInMessages": true,
"resendOnRefresh": true,
"templateScope": "local",
"x": 520,
"y": 540,
"wires": [
[]
]
},
{
"id": "b962a586.f7c278",
"type": "inject",
"z": "328cb8d0.ad53d8",
"d": true,
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "300",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 110,
"y": 540,
"wires": [
[
"a6c5c576.752568"
]
]
},
{
"id": "9eb43060.5c675",
"type": "mqtt-broker",
"z": "",
"name": "python_pub",
"broker": "192.168.0.15",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": false,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
},
{
"id": "fcaff9ec.23d2d8",
"type": "ui_group",
"z": "",
"name": "Default",
"tab": "a8ebd328.a89bd",
"order": 1,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "1b4a1f87.f6076",
"type": "sqlitedb",
"z": "",
"db": "/home/pi/db/measurements.db",
"mode": "RW"
},
{
"id": "a8ebd328.a89bd",
"type": "ui_tab",
"z": "",
"name": "HomeTest",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment