THis is my flow.
I want to get information of weather, store it in a database, retrive it and create a chart from it.
my flow:
[{"id":"c40d8c91.ae6f3","type":"ui_tab","z":"7ed71e0a.377cd8","name":"HISTORY","icon":"dashboard","order":"2"},{"id":"f7c004a6.665e4","type":"ui_tab","z":"","name":"WEATHER","icon":"dashboard","order":"1"},{"id":"9cb4c385.634b4","type":"sqlitedb","db":"/home/karthhic/weather"},{"id":"2c320d48.59ff02","type":"openweathermap in","z":"7ed71e0a.377cd8","name":"","lon":"","lat":"","city":"Tampere","country":"Finland","x":84,"y":85,"wires":[["da4a1d3f.077c8"]]},{"id":"537e7081.111108","type":"debug","z":"7ed71e0a.377cd8","name":"","active":false,"console":"false","complete":"topic","x":777,"y":145,"wires":[]},{"id":"6e7cc218.88ea54","type":"template","z":"7ed71e0a.377cd8","name":"insert data","field":"topic","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"INSERT INTO temperature (date,time,temperature,humidity,look,detail)\nVALUES ({{date}},\"{{time}}\",{{payload.tempc}},{{payload.humidity}},\"{{payload.weather}}\",\"{{payload.detail}}\");","x":491,"y":81,"wires":[["88876ba0.6da6f8"]]},{"id":"da4a1d3f.077c8","type":"moment","z":"7ed71e0a.377cd8","name":"date","topic":"","input":"payload","format":"DDMMYY","locale":"","output":"date","x":230,"y":85,"wires":[["e7992502.970478"]]},{"id":"88876ba0.6da6f8","type":"sqlite","z":"7ed71e0a.377cd8","mydb":"9cb4c385.634b4","name":"db","x":652,"y":160,"wires":[["537e7081.111108","31ad659b.e87c92","eaccf76b.92c0b8","4d1aa0b5.7a743","b3c03490.964338","f2427fd3.a428e"]]},{"id":"e7992502.970478","type":"moment","z":"7ed71e0a.377cd8","name":"time","topic":"","input":"","format":"HH:mm:ss","locale":"","output":"time","x":349,"y":85,"wires":[["6e7cc218.88ea54"]]},{"id":"31ad659b.e87c92","type":"debug","z":"7ed71e0a.377cd8","name":"","active":false,"console":"false","complete":"payload","x":788,"y":179,"wires":[]},{"id":"54b746e4.4d99f8","type":"ui_button","z":"7ed71e0a.377cd8","tab":"f7c004a6.665e4","name":"Delete","payload":"","topic":"","group":"CLEAR DATA","order":1,"x":106,"y":157,"wires":[["25a87100.e67ade"]]},{"id":"25a87100.e67ade","type":"template","z":"7ed71e0a.377cd8","name":"del data","field":"topic","format":"handlebars","template":"DELETE FROM temperature;","x":497,"y":158,"wires":[["88876ba0.6da6f8"]]},{"id":"601802d8.00c73c","type":"comment","z":"7ed71e0a.377cd8","name":"inserting data to the DB","info":"Whenever there is a change in the reading the data will be inserted into the database\n\nwait for changes.\nwhen data changes send the values.\nadd date in ddmmyy format\nadd time.\nsql injection inside the database.","x":265,"y":44,"wires":[]},{"id":"2746e421.9de08c","type":"comment","z":"7ed71e0a.377cd8","name":"Clear all data in the DB","info":"one code to clear all the data in the database.","x":264,"y":130,"wires":[]},{"id":"4504491a.162438","type":"ui_text_input","z":"7ed71e0a.377cd8","tab":"f7c004a6.665e4","mode":"text","delay":"2000","name":"","topic":"","group":"input","order":"3","x":79,"y":241.5,"wires":[["e5f08a46.fe9c88"]]},{"id":"e5f08a46.fe9c88","type":"template","z":"7ed71e0a.377cd8","name":"retrive data","field":"topic","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"SELECT time,temperature FROM temperature WHERE date like {{payload}};","x":481.5,"y":241.5,"wires":[["88876ba0.6da6f8"]]},{"id":"eaccf76b.92c0b8","type":"ui_text","z":"7ed71e0a.377cd8","tab":"f7c004a6.665e4","name":"Text","group":"output","order":1,"format":"{{msg.payload}}","x":804.7222290039062,"y":228.83334350585938,"wires":[]},{"id":"7d925d02.a8173c","type":"comment","z":"7ed71e0a.377cd8","name":"retriving data from the DB","info":"one code to clear all the data in the database.","x":271,"y":205,"wires":[]},{"id":"f2427fd3.a428e","type":"csv","z":"7ed71e0a.377cd8","name":"","sep":",","hdrin":"","hdrout":false,"multi":"one","ret":"\\n","temp":"time, temperature","x":901.9444580078125,"y":54.499969482421875,"wires":[["3d61e007.11ad"]]},{"id":"1df5efda.c7a3","type":"debug","z":"7ed71e0a.377cd8","name":"","active":false,"console":"false","complete":"temperature","x":1071.5,"y":404,"wires":[]},{"id":"4d1aa0b5.7a743","type":"csv","z":"7ed71e0a.377cd8","name":"","sep":",","hdrin":"","hdrout":"","multi":"one","ret":"\\n","temp":"time,","x":770.5556030273438,"y":292.4444274902344,"wires":[["46d6c16f.30e53"]]},{"id":"b3c03490.964338","type":"csv","z":"7ed71e0a.377cd8","name":"","sep":",","hdrin":"","hdrout":false,"multi":"one","ret":"\\n","temp":"temperature,","x":770.5554809570312,"y":339.4443664550781,"wires":[["af067caf.c0dd08"]]},{"id":"8a1028a4.11237","type":"debug","z":"7ed71e0a.377cd8","name":"","active":false,"console":"false","complete":"time","x":1046.666748046875,"y":238.33334350585938,"wires":[]},{"id":"1c9959d5.054a86","type":"ui_template","z":"7ed71e0a.377cd8","tab":"c40d8c91.ae6f3","name":"","group":"graph","order":1,"format":"<html xmlns=\"
http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n\n<head>\n\t<title>chart java script</title>\n\t<meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\" />\n\t<meta name=\"generator\" content=\"Geany 1.23.1\" />\n <script src=\"
https://googledrive.com/host/0B8skak-tVRh0SEFpMHhSWXkzV0k\"></script>\n</head>\n\n<body>\n<canvas id=\"myChart\" width=\"400\" height=\"400\"></canvas>\n<script>\nvar ctx = document.getElementById(\"myChart\");\nvar tm = {{msg.time}};\nvar tem = {{msg.temperature}};\nvar myChart = new Chart(ctx, {\n type: 'line',\n data: {\n labels: [tm],\n datasets: [{\n label: '# of Votes',\n data: [tem]\n }]\n },\n options: {\n scales: {\n yAxes: [{\n ticks: {\n beginAtZero:true\n }\n }]\n }\n }\n});\n</script>\n\n</body>\n\n</html>","storeOutMessages":true,"fwdInMessages":true,"x":1085.4444580078125,"y":359.6666259765625,"wires":[[]]},{"id":"3d61e007.11ad","type":"file","z":"7ed71e0a.377cd8","name":"","filename":"/home/karthhic/Desktop/data.csv","appendNewline":true,"createDir":false,"overwriteFile":"true","x":1022.77783203125,"y":117.2221908569336,"wires":[]},{"id":"85f498d4.ae901","type":"template","z":"7ed71e0a.377cd8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\t\"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"
http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n\n<head>\n\t<title>chart java script</title>\n\t<meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\" />\n\t<meta name=\"generator\" content=\"Geany 1.23.1\" />\n <script src=\"Chart.js\"></script>\n</head>\n\n<body>\n<canvas id=\"myChart\" width=\"400\" height=\"400\"></canvas>\n<script>\nvar ctx = document.getElementById(\"myChart\");\nvar myChart = new Chart(ctx, {\n type: 'line',\n data: {\n labels: [{{msg.payload}} ],\n datasets: [{\n label: '# of Votes',\n data: [ ]\n }]\n },\n options: {\n scales: {\n yAxes: [{\n ticks: {\n beginAtZero:true\n }\n }]\n }\n }\n});\n</script>\n\n</body>\n\n</html>","x":1080.5,"y":317.5,"wires":[["32199384.9c33d4","2a3de9cd.81567e"]]},{"id":"46d6c16f.30e53","type":"template","z":"7ed71e0a.377cd8","name":"","field":"time","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}}","x":895.5,"y":292.5,"wires":[["8a1028a4.11237","85f498d4.ae901","1c9959d5.054a86"]]},{"id":"af067caf.c0dd08","type":"template","z":"7ed71e0a.377cd8","name":"","field":"temperature","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}}","x":889,"y":341,"wires":[["1df5efda.c7a3","85f498d4.ae901","1c9959d5.054a86"]]},{"id":"32199384.9c33d4","type":"debug","z":"7ed71e0a.377cd8","name":"","active":true,"console":"false","complete":"false","x":1248.5,"y":317,"wires":[]},{"id":"2a3de9cd.81567e","type":"file","z":"7ed71e0a.377cd8","name":"","filename":"/home/karthhic/Desktop/html/index2.html","appendNewline":true,"createDir":false,"overwriteFile":"true","x":1307,"y":247,"wires":[]}]
Thank you,
BR
Karthhic