2022年2月27日 星期日

Node-RED-Dashboard Charts

 Node-RED-Dashboard Charts

源自於 https://github.com/node-red/node-red-dashboard/blob/master/Charts.md#stored-data



[{"id":"50a1210db09651cd","type":"function","z":"7a7c463842e7e83e","name":"","func":"var m={};\nvar max=100,min=1;\nvar numbers = [0,0,0,0,0,0,0,\n               0,0,0,0,0,0,0,\n               0,0,0,0,0,0,0 ];    \n \nfor (let i = 0; i < 21 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\nm.labels = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\"];\nm.series = ['Series A', 'Series B', 'Series C'];\nm.data = [\n    [numbers[0], numbers[1],numbers[2],numbers[3], numbers[4], numbers[5], numbers[6]],\n    [numbers[7], numbers[8],numbers[9],numbers[10], numbers[11], numbers[12], numbers[13]],\n    [numbers[14], numbers[5],numbers[16],numbers[17], numbers[18], numbers[19], numbers[20]]\n  ];\nreturn {payload:[m]};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":380,"wires":[["a5eb6044d0f6684c","dfa48a2208ec804e","4a7cd4e2e4544212","07faa46aad4cfc35"]]},{"id":"a5eb6044d0f6684c","type":"ui_chart","z":"7a7c463842e7e83e","name":"","group":"89749fb7.87f01","order":1,"width":0,"height":0,"label":"line chart","chartType":"line","legend":"false","xformat":"auto","interpolate":"linear","nodata":"No Data","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":580,"y":120,"wires":[[]]},{"id":"0f12d543c08262aa","type":"function","z":"7a7c463842e7e83e","name":"","func":"var max=100,min=1;\nvar numbers = [0,0,0,0,0,0,0,0,0];\nfor (let i = 0; i < 10 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\n\nvar chart = [{\n    \"series\":[\"A\",\"B\",\"C\"],\n    \"data\":[[{\"x\":1504029632890,\"y\":numbers[0]},\n    {\"x\":1504029636001,\"y\":numbers[1]},\n    {\"x\":1504029638656,\"y\":numbers[2]}],\n    [{\"x\":1504029633514,\"y\":numbers[3]},\n    {\"x\":1504029636622,\"y\":numbers[4]},\n    {\"x\":1504029639539,\"y\":numbers[5]}],\n    [{\"x\":1504029634400,\"y\":numbers[6]},\n    {\"x\":1504029637959,\"y\":numbers[7]},\n    {\"x\":1504029640317,\"y\":numbers[8]}]],\n    \"labels\":[\"\"]\n}];\nmsg.payload = chart;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":220,"wires":[["a5eb6044d0f6684c"]]},{"id":"ad467b317b1f8f86","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":1,"width":0,"height":0,"passthru":false,"label":"Time Line 1","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":170,"y":220,"wires":[["0f12d543c08262aa"]]},{"id":"dfa48a2208ec804e","type":"ui_chart","z":"7a7c463842e7e83e","name":"","group":"89749fb7.87f01","order":2,"width":0,"height":0,"label":"bar chart","chartType":"bar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"No Data","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":580,"y":180,"wires":[[]]},{"id":"41aea532fe90fff1","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":5,"width":0,"height":0,"passthru":false,"label":"array","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":150,"y":380,"wires":[["50a1210db09651cd"]]},{"id":"0414f8cd74349a8f","type":"random","z":"7a7c463842e7e83e","name":"","low":"1","high":"10000000","inte":"true","x":340,"y":580,"wires":[["a5eb6044d0f6684c"]]},{"id":"cb1a82121119b1ed","type":"inject","z":"7a7c463842e7e83e","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"str","x":170,"y":580,"wires":[["0414f8cd74349a8f"]]},{"id":"b8381988437dbd67","type":"function","z":"7a7c463842e7e83e","name":"","func":"var m={};\nm.labels = [10,20,30,40,50,60,70];\nm.series = ['Series A', 'Series B', 'Series C', 'Series D'];\nm.data = [\n    [65, 59, 80, 81, 56, 55, 40],\n    [28, 48, 40, 19, 86, 27, 90],\n    [38, 28, 20, 49, 45, 60, 20],\n    [58, 18, 40, 29, 15, 30, 60]\n  ];\nreturn {payload:[m]};","outputs":1,"noerr":0,"x":310,"y":420,"wires":[["a5eb6044d0f6684c","dfa48a2208ec804e","4a7cd4e2e4544212","07faa46aad4cfc35"]]},{"id":"35afc255ab9e508f","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":6,"width":0,"height":0,"passthru":false,"label":"array2","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":150,"y":420,"wires":[["b8381988437dbd67"]]},{"id":"c64cd847625ed238","type":"function","z":"7a7c463842e7e83e","name":"","func":"var max=100,min=1;\nvar numbers = [0,0,0,0,0,0,0,0,0];\nfor (let i = 0; i < 10 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\n\nvar chart = [{\n    \"series\":[\"A\",\"B\",\"C\"],\n        \"data\":[[{\"x\":1,\"y\":numbers[0]},\n        {\"x\":2,\"y\":numbers[1]},\n        {\"x\":3,\"y\":numbers[2]}],\n        [{\"x\":4,\"y\":numbers[3]},\n        {\"x\":5,\"y\":numbers[4]},\n        {\"x\":6,\"y\":numbers[5]}],\n        [{\"x\":7,\"y\":numbers[6]},\n        {\"x\":8,\"y\":numbers[7]},\n        {\"x\":9,\"y\":numbers[8]}]],\n    \"labels\":[\"\"]\n}];\nmsg.payload = chart;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":260,"wires":[["a5eb6044d0f6684c"]]},{"id":"a4f25167d6ad788c","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":2,"width":0,"height":0,"passthru":false,"label":"Time Line 2","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":170,"y":260,"wires":[["c64cd847625ed238"]]},{"id":"05803022ed50a92b","type":"function","z":"7a7c463842e7e83e","name":"","func":"var m = {};\nm.labels = [\"Download\", \"In-Store\", \"Mail-Order\"];\nm.data = [[300, 500, 100]];\nm.series = [\"Sales\"];\nreturn {payload:[m],topic:msg.topic};","outputs":1,"noerr":0,"x":330,"y":620,"wires":[["07faa46aad4cfc35","dfa48a2208ec804e","a5eb6044d0f6684c","0e2a31d593ad4b65","d12e7d99388993cb","4a7cd4e2e4544212"]]},{"id":"07faa46aad4cfc35","type":"ui_chart","z":"7a7c463842e7e83e","name":"pie chart","group":"89749fb7.87f01","order":3,"width":0,"height":0,"label":"pie chart","chartType":"pie","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":"30","useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":2,"x":620,"y":360,"wires":[[],[]]},{"id":"3e3832632da2a429","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":10,"width":0,"height":0,"passthru":false,"label":"array for pie","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"Pie 4 T","x":170,"y":620,"wires":[["05803022ed50a92b"]]},{"id":"40bcc2be7c742c2e","type":"function","z":"7a7c463842e7e83e","name":"","func":"var max=10,min=1;\nvar numbers = [0,0,0,0,0,0,0,0,0];\nfor (let i = 0; i < 10 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\n\nvar chart = [{\n    \"series\":[\"A\",\"B\",\"C\"],\n        \"data\":[[{\"x\":1000000,\"y\":numbers[0]},\n        {\"x\":2000000,\"y\":numbers[1]},\n        {\"x\":3000000,\"y\":numbers[2]}],\n        [{\"x\":4000000,\"y\":numbers[3]},\n        {\"x\":5000000,\"y\":numbers[4]},\n        {\"x\":6000000,\"y\":numbers[5]}],\n        [{\"x\":7000000,\"y\":numbers[6]},\n        {\"x\":8000000,\"y\":numbers[7]},\n        {\"x\":9000000,\"y\":numbers[8]}]],\n    \"labels\":[\"\"]\n}];\nmsg.payload = chart;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":300,"wires":[["a5eb6044d0f6684c"]]},{"id":"8ae991f172c90b69","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":3,"width":0,"height":0,"passthru":false,"label":"Time Line 3","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":170,"y":300,"wires":[["40bcc2be7c742c2e"]]},{"id":"abb8842ceb107df1","type":"function","z":"7a7c463842e7e83e","name":"","func":"var chart = [{\n    \"series\":[\"A\",\"B\",\"C\"],\n        \"data\":[[{\"x\":1000000000,\"y\":5},\n        {\"x\":2000000000,\"y\":4},\n        {\"x\":3000000000,\"y\":2}],\n        [{\"x\":4000000000,\"y\":6},\n        {\"x\":5000000000,\"y\":7},\n        {\"x\":6000000000,\"y\":6}],\n        [{\"x\":7000000000,\"y\":7},\n        {\"x\":8000000000,\"y\":9},\n        {\"x\":9000000000,\"y\":7}]],\n    \"labels\":[\"\"]\n}];\nmsg.payload = chart;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":340,"wires":[["a5eb6044d0f6684c"]]},{"id":"585ca190f53a05e9","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":4,"width":0,"height":0,"passthru":false,"label":"Time Line 4","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":170,"y":340,"wires":[["abb8842ceb107df1"]]},{"id":"6e0e17374faa2658","type":"function","z":"7a7c463842e7e83e","name":"","func":"var max=10,min=1;\nvar numbers = [0,0,0,0,0,0,0,0,0];\nfor (let i = 0; i < 10 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\n\nvar m={\n    \"series\":[\"X\",\"Y\",\"Z\"],\n    \"data\":[ [ numbers[0],numbers[1],numbers[2] ],[numbers[3],numbers[4],numbers[5]], [numbers[6],numbers[7],numbers[8]]],\n    \"labels\":[\"Jan\",\"Feb\",\"Mar\"]\n};\nreturn {payload:[m]};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":540,"wires":[["a5eb6044d0f6684c","dfa48a2208ec804e","07faa46aad4cfc35","0e2a31d593ad4b65","d12e7d99388993cb","4a7cd4e2e4544212"]]},{"id":"830bfd76d9dc12a2","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":9,"width":0,"height":0,"passthru":false,"label":"array3c","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":160,"y":540,"wires":[["6e0e17374faa2658"]]},{"id":"65d10c57fbcbafae","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":11,"width":0,"height":0,"passthru":false,"label":"array 2 for pie","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"Pie Hole","x":180,"y":660,"wires":[["bce1e6436342529a"]]},{"id":"bce1e6436342529a","type":"function","z":"7a7c463842e7e83e","name":"","func":"var max=100,min=10;\nvar numbers = [0,0,0,0,0,0,0];\nfor (let i = 0; i < 8 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\n\nvar m = {};\nm.labels = ['2006', '2007', '2008', '2009', '2010', '2011', '2012'];\n//m.data = [[28, 48, 40, 19, 86, 27, 90]];\nm.data = [[numbers[0],numbers[1],numbers[2],numbers[3],numbers[4],numbers[5],numbers[6]]];\nm.series = ['Series A'];\nreturn {payload:[m],topic:msg.topic};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":660,"wires":[["07faa46aad4cfc35","dfa48a2208ec804e","d12e7d99388993cb","0e2a31d593ad4b65","a5eb6044d0f6684c","4a7cd4e2e4544212"]]},{"id":"dac9efd322e462ed","type":"function","z":"7a7c463842e7e83e","name":"topic","func":"var max=100,min=0;\nvar numbers = [0,0,0];\nfor (let i = 0; i < 3 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\nvar m = [\n    {topic:\"X\", payload:numbers[0]},\n    {topic:\"Y\", payload:numbers[1]},\n    {topic:\"Z\", payload:numbers[2]}\n    ];\nreturn [m];","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":180,"wires":[["dfa48a2208ec804e","07faa46aad4cfc35","a5eb6044d0f6684c","4a7cd4e2e4544212"]]},{"id":"3246eac28d45a1ac","type":"inject","z":"7a7c463842e7e83e","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"date","x":160,"y":180,"wires":[["dac9efd322e462ed"]]},{"id":"46aecae17ebde3f2","type":"function","z":"7a7c463842e7e83e","name":"label","func":"var max=100,min=0;\nvar numbers = [0,0,0];\nfor (let i = 0; i < 3 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\nvar m = [\n    {label:\"A\", payload:numbers[0]},\n    {label:\"B\", payload:numbers[1]},\n    {label:\"C\", payload:numbers[2]},\n    ];\nreturn [m];","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":140,"wires":[["dfa48a2208ec804e","07faa46aad4cfc35","a5eb6044d0f6684c","4a7cd4e2e4544212"]]},{"id":"ec57a2f242284dc5","type":"inject","z":"7a7c463842e7e83e","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"date","x":160,"y":140,"wires":[["46aecae17ebde3f2"]]},{"id":"13e657299cd01203","type":"function","z":"7a7c463842e7e83e","name":"","func":"var max=10,min=1;\nvar numbers = [0,0,0];\nfor (let i = 0; i < 3 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\n\nvar m={\n    \"series\":[\"X\",\"Y\",\"Z\"],\n    \"data\":[[numbers[0]],[numbers[1]],[numbers[2]]],\n    \"labels\":[\"Jan\"]\n};\nreturn {payload:[m]};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":460,"wires":[["dfa48a2208ec804e","0e2a31d593ad4b65","d12e7d99388993cb","a5eb6044d0f6684c","4a7cd4e2e4544212","07faa46aad4cfc35"]]},{"id":"19e86961f4358cf1","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":7,"width":0,"height":0,"passthru":false,"label":"array3a","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":160,"y":460,"wires":[["13e657299cd01203"]]},{"id":"b3dde2e55b6321c8","type":"function","z":"7a7c463842e7e83e","name":"","func":"var max=10,min=1;\nvar numbers = [0,0,0];\nfor (let i = 0; i < 3 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\nvar m={\n    \"series\":[\"X\"],\n    \"data\":[[numbers[0],numbers[1],numbers[2]]],\n    \"labels\":[\"Jan\",\"Feb\",\"Mar\"]\n};\nreturn {payload:[m]};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":500,"wires":[["dfa48a2208ec804e","a5eb6044d0f6684c","d12e7d99388993cb","0e2a31d593ad4b65","4a7cd4e2e4544212","07faa46aad4cfc35"]]},{"id":"6ab2d58ff7dbd6a9","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":8,"width":0,"height":0,"passthru":false,"label":"array3b","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":160,"y":500,"wires":[["b3dde2e55b6321c8"]]},{"id":"4a7cd4e2e4544212","type":"ui_chart","z":"7a7c463842e7e83e","name":"","group":"4e7edda4.417004","order":2,"width":0,"height":0,"label":"horizontal bar","chartType":"horizontalBar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":"30","colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":2,"x":600,"y":240,"wires":[[],[]]},{"id":"0e2a31d593ad4b65","type":"ui_chart","z":"7a7c463842e7e83e","name":"","group":"4e7edda4.417004","order":3,"width":0,"height":0,"label":"polar chart","chartType":"polar-area","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":"30","colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":2,"x":630,"y":480,"wires":[[],[]]},{"id":"d12e7d99388993cb","type":"ui_chart","z":"7a7c463842e7e83e","name":"","group":"4e7edda4.417004","order":4,"width":0,"height":0,"label":"radar chart","chartType":"radar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":"30","colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":2,"x":630,"y":540,"wires":[[],[]]},{"id":"ca54e373fccde137","type":"function","z":"7a7c463842e7e83e","name":"label","func":"var max=100,min=0;\nvar numbers = [0,0,0,0,0,0,0,0,0];\nfor (let i = 0; i < 10 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\nvar m = [\n    {label:\"A\", payload:numbers[0], series:\"X\"},\n    {label:\"B\", payload:numbers[1], series:\"X\"},\n    {label:\"C\", payload:numbers[2], series:\"X\"},\n    {label:\"A\", payload:numbers[3], series:\"Y\"},\n    {label:\"B\", payload:numbers[4], series:\"Y\"},\n    {label:\"C\", payload:numbers[5], series:\"Y\"},\n    {label:\"A\", payload:numbers[6], series:\"Z\"},\n    {label:\"B\", payload:numbers[7], series:\"Z\"},\n    {label:\"C\", payload:numbers[8], series:\"Z\"}\n    ];\n    \nreturn [m];","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":100,"wires":[["07faa46aad4cfc35","dfa48a2208ec804e","a5eb6044d0f6684c","4a7cd4e2e4544212"]]},{"id":"48cb59cf4938ba17","type":"inject","z":"7a7c463842e7e83e","name":"","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"date","x":160,"y":100,"wires":[["ca54e373fccde137"]]},{"id":"5c4be17ddfb58ec0","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":11,"width":0,"height":0,"passthru":false,"label":"Clear All","color":"","bgcolor":"","icon":"","payload":"[]","payloadType":"json","topic":"","x":300,"y":60,"wires":[["d12e7d99388993cb","0e2a31d593ad4b65","07faa46aad4cfc35","4a7cd4e2e4544212","dfa48a2208ec804e","a5eb6044d0f6684c"]]},{"id":"89749fb7.87f01","type":"ui_group","name":"Charts","tab":"d7901f40.2659d","order":2,"disp":false,"width":"6"},{"id":"ab397e95.29ebe","type":"ui_group","name":"Inputs","tab":"d7901f40.2659d","order":1,"disp":false,"width":"6"},{"id":"4e7edda4.417004","type":"ui_group","name":"Group 3","tab":"d7901f40.2659d","order":3,"disp":false,"width":"6"},{"id":"d7901f40.2659d","type":"ui_tab","name":"Charts","icon":"dashboard","order":2}]

2022年2月20日 星期日

Node-Red : LiteDB資料庫

Node-Red :  LiteDB資料庫

參考來源https://flows.nodered.org/flow/ec03f2483384351bae669da6bcfe40b0







[{"id":"eefd2e0d.1afec","type":"comment","z":"39ec815688599ede","name":"sqlite.org","info":"https://fred.sensetecnic.com/\nhttp://noderedguide.com/tutorial-sqlite-and-node-red/\nhttps://www.sqlite.org/lang.html\nhttps://www.sqlite.org/datatype3.html#expraff\n\nCREATE TABLE RANDOMNUM( TIMESTAMP INT PRIMARY KEY NOT NULL, VALUE INT NOT NULL, BOOL INT NOT NULL)\n\n//INSERT\nvar randomNum = Math.round(Math.random()*100);\nvar largeBool = (randomNum > 50)?1:0;\nvar newMsg = {\n \"topic\": \"INSERT INTO RANDOMNUM VALUES ( \" + msg.payload + \", \" + randomNum + \", \" + largeBool + \")\"\n}\nreturn newMsg;\n\nDELETE FROM RANDOMNUM WHERE TIMESTAMP <= strftime('%s','now', '-30 seconds')*1000\nDELETE FROM RANDOMNUM WHERE TIMESTAMP <= strftime('%s','now', '-24 hours')*1000\nDELETE FROM RANDOMNUM WHERE TIMESTAMP <= strftime('%s','now', '-7 days')*1000\n\nSELECT COUNT(*) FROM RANDOMNUM\n\nUPDATE RANDOMNUM SET BOOL = 1 WHERE VALUE > 80 AND BOOL = 0\n\nSELECT * FROM RANDOMNUM ORDER BY TIMESTAMP DESC LIMIT 100;\n<table style=\"width:100%\">\n  <tr>\n    <th>Index</th> \n    <th>Timestamp</th>\n    <th>Value</th> \n    <th>Bool</th>\n  </tr>\n  <tr ng-repeat=\"x in msg.payload | limitTo:20\">\n    <td>{{$index}}</td>\n    <td>{{msg.payload[$index].TIMESTAMP}}</td>\n    <td>{{msg.payload[$index].VALUE}}</td> \n    <td>{{msg.payload[$index].BOOL}}</td>\n  </tr>\n</table>\n\n","x":120,"y":40,"wires":[]},{"id":"ce813a38.486e28","type":"sqlite","z":"39ec815688599ede","mydb":"97158aa1.026308","sqlquery":"msg.topic","sql":"","name":"db_001","x":360,"y":100,"wires":[["4f3f3858.c6ea58"]]},{"id":"adb5271b.e49118","type":"inject","z":"39ec815688599ede","name":"CREATE DB","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"CREATE TABLE RANDOMNUM( TIMESTAMP INT PRIMARY KEY NOT NULL, VALUE INT NOT NULL, BOOL INT NOT NULL)","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"CREATE TABLE RANDOMNUM( TIMESTAMP INT PRIMARY KEY NOT NULL, VALUE INT NOT NULL, BOOL INT NOT NULL)","payload":"","payloadType":"date","x":150,"y":100,"wires":[["ce813a38.486e28"]]},{"id":"4f3f3858.c6ea58","type":"debug","z":"39ec815688599ede","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":100,"wires":[]},{"id":"36c37ba9.5b67f4","type":"inject","z":"39ec815688599ede","name":"INSERT","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":160,"wires":[["9818d1c4.3144b"]]},{"id":"9818d1c4.3144b","type":"function","z":"39ec815688599ede","name":"INSERT","func":"var randomNum = Math.round(Math.random()*100);\nvar largeBool = (randomNum > 50)?1:0;\nvar newMsg = {\n \"topic\": \"INSERT INTO RANDOMNUM VALUES ( \" + msg.payload + \", \" + randomNum + \", \" + largeBool + \")\"\n}\nreturn newMsg;","outputs":1,"noerr":0,"x":320,"y":160,"wires":[["fba3bbd7.c848f8"]]},{"id":"885a944d.7a7838","type":"debug","z":"39ec815688599ede","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":650,"y":160,"wires":[]},{"id":"fba3bbd7.c848f8","type":"sqlite","z":"39ec815688599ede","mydb":"97158aa1.026308","sqlquery":"msg.topic","sql":"","name":"db_001","x":480,"y":160,"wires":[["885a944d.7a7838"]]},{"id":"6d47683e.0fb558","type":"inject","z":"39ec815688599ede","name":"DELETE 30s","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"DELETE FROM RANDOMNUM WHERE TIMESTAMP <= strftime('%s','now', '-30 seconds')*1000","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"DELETE FROM RANDOMNUM WHERE TIMESTAMP <= strftime('%s','now', '-30 seconds')*1000","payload":"","payloadType":"date","x":150,"y":220,"wires":[["3f405d54.0a4b42"]]},{"id":"3f405d54.0a4b42","type":"sqlite","z":"39ec815688599ede","mydb":"97158aa1.026308","sqlquery":"msg.topic","sql":"","name":"db_001","x":400,"y":220,"wires":[["4f233c28.ad61a4"]]},{"id":"21f6b4e8.c15a4c","type":"inject","z":"39ec815688599ede","name":"DELETE 24h","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"DELETE FROM RANDOMNUM WHERE TIMESTAMP <= strftime('%s','now', '-24 hours')*1000","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"DELETE FROM RANDOMNUM WHERE TIMESTAMP <= strftime('%s','now', '-24 hours')*1000","payload":"","payloadType":"date","x":150,"y":260,"wires":[["3f405d54.0a4b42"]]},{"id":"7d2be4c7.bcd85c","type":"inject","z":"39ec815688599ede","name":"DELETE 7d","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"DELETE FROM RANDOMNUM WHERE TIMESTAMP <= strftime('%s','now', '-7 days')*1000","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"DELETE FROM RANDOMNUM WHERE TIMESTAMP <= strftime('%s','now', '-7 days')*1000","payload":"","payloadType":"date","x":150,"y":300,"wires":[["3f405d54.0a4b42"]]},{"id":"4f233c28.ad61a4","type":"debug","z":"39ec815688599ede","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":220,"wires":[]},{"id":"cd31dbfe.a50238","type":"inject","z":"39ec815688599ede","name":"UPDATE","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"UPDATE RANDOMNUM SET BOOL = 1 WHERE VALUE > 20 AND BOOL = 0","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"UPDATE RANDOMNUM SET BOOL = 1 WHERE VALUE > 20 AND BOOL = 0","payload":"","payloadType":"date","x":140,"y":360,"wires":[["1edfd08.fcc9c3"]]},{"id":"1edfd08.fcc9c3","type":"sqlite","z":"39ec815688599ede","mydb":"97158aa1.026308","sqlquery":"msg.topic","sql":"","name":"db_001","x":400,"y":360,"wires":[["5b075b30.5b3014"]]},{"id":"5b075b30.5b3014","type":"debug","z":"39ec815688599ede","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":360,"wires":[]},{"id":"1a6eb281.ee04dd","type":"inject","z":"39ec815688599ede","name":"COUNT","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"SELECT COUNT(*) FROM RANDOMNUM","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"SELECT COUNT(*) FROM RANDOMNUM","payload":"","payloadType":"date","x":130,"y":400,"wires":[["1edfd08.fcc9c3"]]},{"id":"4667ba0e.d67e64","type":"inject","z":"39ec815688599ede","name":"SELECT","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"SELECT * FROM RANDOMNUM ORDER BY TIMESTAMP DESC LIMIT 100;","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"SELECT * FROM RANDOMNUM ORDER BY TIMESTAMP DESC LIMIT 100;","payload":"","payloadType":"date","x":140,"y":460,"wires":[["9e2dbd84.ab087"]]},{"id":"9e2dbd84.ab087","type":"sqlite","z":"39ec815688599ede","mydb":"97158aa1.026308","sqlquery":"msg.topic","sql":"","name":"db_001","x":400,"y":460,"wires":[["df51560e.5729a8","95eec7a9.8e2a88"]]},{"id":"df51560e.5729a8","type":"ui_template","z":"39ec815688599ede","group":"d40ead3e.334ab","name":"","order":0,"width":"12","height":"10","format":"<table style=\"width:100%\">\n  <tr>\n    \n    <th>Index</th> \n    <th>---</th>\n    <th>Timestamp</th>\n    <th>---</th>    \n    <th>Value</th> \n     <th>---</th>   \n    <th>Bool</th>\n  </tr>\n  <tr ng-repeat=\"x in msg.payload | limitTo:20\">\n    <td>{{$index}}</td>\n    <td>{</td>\n    <td>{{msg.payload[$index].TIMESTAMP}}</td>\n    <td>}{</td>    \n    <td>{{msg.payload[$index].VALUE}}</td> \n    <td>}{</td>    \n    <td>{{msg.payload[$index].BOOL}}</td>\n    <td>}</td>    \n  </tr>\n</table>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","className":"","x":620,"y":460,"wires":[[]]},{"id":"95eec7a9.8e2a88","type":"debug","z":"39ec815688599ede","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":500,"wires":[]},{"id":"97158aa1.026308","type":"sqlitedb","db":"D:\\Node-RED\\litedb\\db_001.db","mode":"RWC"},{"id":"d40ead3e.334ab","type":"ui_group","name":"Group 1","tab":"3c770aff.9ba2a6","order":1,"disp":true,"width":"12","collapse":false,"className":""},{"id":"3c770aff.9ba2a6","type":"ui_tab","name":"Main Tab","icon":"dashboard","order":1}]

1) 新增一資料庫



功能

程式暨說明

備註

CREATE DB 產生新資料庫 D:\Node-RED\litedb\db_001.db

Inject (CREATE DB)

產生資料庫 msg.topic內容

資料表 (Table) 名稱 RANDOMNUM

資料欄位TIMESTAMP, VALUE , BOOL 三項

主索引欄 TIMESTAMP

 

CREATE TABLE RANDOMNUM( TIMESTAMP INT PRIMARY KEY NOT NULL, VALUE INT NOT NULL, BOOL INT NOT NULL)

 

 

 

Litedb (db_001.db)

</> SQL Query

Via msg.topic

 

 

[{"id":"adb5271b.e49118","type":"inject","z":"39ec815688599ede","name":"CREATE DB","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"CREATE TABLE RANDOMNUM( TIMESTAMP INT PRIMARY KEY NOT NULL, VALUE INT NOT NULL, BOOL INT NOT NULL)","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"CREATE TABLE RANDOMNUM( TIMESTAMP INT PRIMARY KEY NOT NULL, VALUE INT NOT NULL, BOOL INT NOT NULL)","payload":"","payloadType":"date","x":150,"y":100,"wires":[["ce813a38.486e28"]]},{"id":"ce813a38.486e28","type":"sqlite","z":"39ec815688599ede","mydb":"97158aa1.026308","sqlquery":"msg.topic","sql":"","name":"db_001","x":360,"y":100,"wires":[["4f3f3858.c6ea58"]]},{"id":"4f3f3858.c6ea58","type":"debug","z":"39ec815688599ede","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":100,"wires":[]},{"id":"97158aa1.026308","type":"sqlitedb","db":"D:\\Node-RED\\litedb\\db_001.db","mode":"RWC"}]

 2) 插入一筆資料


功能

程式暨說明

備註

插入一筆資料

Inject (INSERT)

msg.payload à 資料欄位TIMESTAMP

 

 

functiomn (INSERT)

var randomNum = Math.round(Math.random()*100);

var largeBool = (randomNum > 50)?1:0;

var newMsg = {

 "topic": "INSERT INTO RANDOMNUM VALUES ( " + msg.payload + ", " + randomNum + ", " + largeBool + ")"

}

return newMsg;

 

資料欄位TIMESTAMP, VALUE , BOOL 三項

TIMESTAMP à msg.payload

VALUE à randomNum

BOOL à largeBool

 

Litedb (db_001.db)

</> SQL Query

Via msg.topic

 

 

[{"id":"36c37ba9.5b67f4","type":"inject","z":"39ec815688599ede","name":"INSERT","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":160,"wires":[["9818d1c4.3144b"]]},{"id":"9818d1c4.3144b","type":"function","z":"39ec815688599ede","name":"INSERT","func":"var randomNum = Math.round(Math.random()*100);\nvar largeBool = (randomNum > 50)?1:0;\nvar newMsg = {\n \"topic\": \"INSERT INTO RANDOMNUM VALUES ( \" + msg.payload + \", \" + randomNum + \", \" + largeBool + \")\"\n}\nreturn newMsg;","outputs":1,"noerr":0,"x":320,"y":160,"wires":[["fba3bbd7.c848f8"]]},{"id":"fba3bbd7.c848f8","type":"sqlite","z":"39ec815688599ede","mydb":"97158aa1.026308","sqlquery":"msg.topic","sql":"","name":"db_001","x":480,"y":160,"wires":[["885a944d.7a7838"]]},{"id":"885a944d.7a7838","type":"debug","z":"39ec815688599ede","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":650,"y":160,"wires":[]},{"id":"97158aa1.026308","type":"sqlitedb","db":"D:\\Node-RED\\litedb\\db_001.db","mode":"RWC"}]

  3) 刪除資料

  


功能

程式暨說明

備註

刪除資料

Inject (DELETE 30s)

刪除30秒內的資料

 msg.topic設定

 

DELETE FROM RANDOMNUM WHERE TIMESTAMP <= strftime('%s','now', '-30 seconds')*1000

 

 

Inject (DELETE 24H)

刪除24小時內的資料

 msg.topic設定

 

DELETE FROM RANDOMNUM WHERE TIMESTAMP <= strftime('%s','now', '-24 hours')*1000

 

Inject (DELETE 7d)

刪除7 天內的資料

 Msg.topic設定

 

DELETE FROM RANDOMNUM WHERE TIMESTAMP <= strftime('%s','now', '-7 days')*1000

 

Litedb (db_001.db)

</> SQL Query

Via msg.topic

 

 

   4更新資料庫暨計算資料筆數

功能

程式暨說明

備註

更新資料庫暨計算資料筆數

 

Inject (UPDATE)

Msg.topic設定

 

UPDATE RANDOMNUM SET BOOL = 1 WHERE VALUE > 20 AND BOOL = 0

 

Inject (COUNT)

Msg.topic設定

 

SELECT COUNT(*) FROM RANDOMNUM

 

Litedb (db_001.db)

</> SQL Query

Via msg.topic

 

 

[{"id":"cd31dbfe.a50238","type":"inject","z":"39ec815688599ede","name":"UPDATE","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"UPDATE RANDOMNUM SET BOOL = 1 WHERE VALUE > 20 AND BOOL = 0","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"UPDATE RANDOMNUM SET BOOL = 1 WHERE VALUE > 20 AND BOOL = 0","payload":"","payloadType":"date","x":140,"y":360,"wires":[["1edfd08.fcc9c3"]]},{"id":"1a6eb281.ee04dd","type":"inject","z":"39ec815688599ede","name":"COUNT","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"SELECT COUNT(*) FROM RANDOMNUM","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"SELECT COUNT(*) FROM RANDOMNUM","payload":"","payloadType":"date","x":130,"y":400,"wires":[["1edfd08.fcc9c3"]]},{"id":"5b075b30.5b3014","type":"debug","z":"39ec815688599ede","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":360,"wires":[]},{"id":"1edfd08.fcc9c3","type":"sqlite","z":"39ec815688599ede","mydb":"97158aa1.026308","sqlquery":"msg.topic","sql":"","name":"db_001","x":400,"y":360,"wires":[["5b075b30.5b3014"]]},{"id":"97158aa1.026308","type":"sqlitedb","db":"D:\\Node-RED\\litedb\\db_001.db","mode":"RWC"}]

    5顯示資料庫內容

功能

程式暨說明

備註

顯示資料庫內容

 

Inject (SELECT)

Msg.topic設定

 

SELECT * FROM RANDOMNUM ORDER BY TIMESTAMP DESC LIMIT 100;

 

Litedb (db_001.db)

</> SQL Query

Via msg.topic

 

 

</> template

 

<table style="width:100%">

  <tr>

   

    <th>Index</th>

    <th>---</th>

    <th>Timestamp</th>

    <th>---</th>   

    <th>Value</th>

     <th>---</th>  

    <th>Bool</th>

  </tr>

  <tr ng-repeat="x in msg.payload | limitTo:20">

    <td>{{$index}}</td>

    <td>{</td>

    <td>{{msg.payload[$index].TIMESTAMP}}</td>

    <td>}{</td>   

    <td>{{msg.payload[$index].VALUE}}</td>

    <td>}{</td>   

    <td>{{msg.payload[$index].BOOL}}</td>

    <td>}</td>   

  </tr>

</table>

 

 

 


2022年2月19日 星期六

Node-Red : Tab 切換

  Node-Red : Tab 切換











[{"id":"fa40bcf07266cb0d","type":"ui_button","z":"8eebfc64cae8318e","name":"","group":"80c78d71fd175fbf","order":1,"width":"4","height":"4","passthru":false,"label":"MQTT測試1","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"MQTT","payloadType":"str","topic":"topic","topicType":"msg","x":310,"y":100,"wires":[["2dbcae94fa8b0276"]]},{"id":"2dbcae94fa8b0276","type":"ui_ui_control","z":"8eebfc64cae8318e","name":"","events":"all","x":480,"y":160,"wires":[["f5f5a008e12ede56"]]},{"id":"17688e9c553d10e2","type":"ui_button","z":"8eebfc64cae8318e","name":"","group":"80c78d71fd175fbf","order":2,"width":"4","height":"4","passthru":false,"label":"MQTT測試2","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"Home","payloadType":"str","topic":"topic","topicType":"msg","x":310,"y":200,"wires":[["2dbcae94fa8b0276"]]},{"id":"f5f5a008e12ede56","type":"debug","z":"8eebfc64cae8318e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":160,"wires":[]},{"id":"80c78d71fd175fbf","type":"ui_group","name":"Group 1","tab":"fc4acb4da1369f93","order":1,"disp":false,"width":"24","collapse":false,"className":""},{"id":"fc4acb4da1369f93","type":"ui_tab","name":"首頁","icon":"dashboard","order":1,"disabled":false,"hidden":false}]


[{"id":"7620c466df1bf574","type":"inject","z":"9742b4ffade40c3e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"2","crontab":"","once":true,"onceDelay":0.1,"topic":"","payloadType":"date","x":300,"y":200,"wires":[["9bafdbab6d589c9a"]]},{"id":"9bafdbab6d589c9a","type":"function","z":"9742b4ffade40c3e","name":"","func":"var m;\nm = 100*Math.random();\nmsg.payload = Math.round(m);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":470,"y":200,"wires":[["d8e706bb0f2f4791","86be743fd72e6b64"]]},{"id":"86be743fd72e6b64","type":"ui_gauge","z":"9742b4ffade40c3e","name":"","group":"77022c6eef942630","order":0,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"units","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"33","seg2":"66","className":"","x":650,"y":140,"wires":[]},{"id":"d8e706bb0f2f4791","type":"ui_chart","z":"9742b4ffade40c3e","name":"","group":"35b8a654c00a2209","order":0,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"100","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":650,"y":220,"wires":[[]]},{"id":"77022c6eef942630","type":"ui_group","name":"Gauge","tab":"2711d5a2.d68132","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"35b8a654c00a2209","type":"ui_group","name":"Chart","tab":"2711d5a2.d68132","order":2,"disp":true,"width":"6","collapse":false,"className":""},{"id":"2711d5a2.d68132","type":"ui_tab","name":"MQTT","icon":"dashboard","disabled":false,"hidden":false}]


[{"id":"64b7a1046d679632","type":"mqtt out","z":"921ffb91cd8aaac1","name":"","topic":"alex9ufo/esp32/humidity","qos":"1","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"2db287b.addf978","x":510,"y":20,"wires":[]},{"id":"154ff355146aee5c","type":"mqtt in","z":"921ffb91cd8aaac1","name":"","topic":"alex9ufo/esp32/temperature","qos":"1","datatype":"auto","broker":"2db287b.addf978","nl":false,"rap":false,"x":240,"y":260,"wires":[["87782bdccd9d9566","b1fa8d89b92adcb2"]]},{"id":"87782bdccd9d9566","type":"debug","z":"921ffb91cd8aaac1","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":461,"y":234,"wires":[]},{"id":"1f09b9c0c6708e0d","type":"mqtt in","z":"921ffb91cd8aaac1","name":"","topic":"alex9ufo/esp32/humidity","qos":"1","datatype":"auto","broker":"2db287b.addf978","nl":false,"rap":false,"x":230,"y":160,"wires":[["624c40c20901851e","95b81ba7015ce035"]]},{"id":"624c40c20901851e","type":"debug","z":"921ffb91cd8aaac1","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":450,"y":140,"wires":[]},{"id":"b1fa8d89b92adcb2","type":"ui_chart","z":"921ffb91cd8aaac1","name":"","group":"61285987.c20328","order":0,"width":0,"height":0,"label":"Temperature","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":461,"y":294,"wires":[[]]},{"id":"95b81ba7015ce035","type":"ui_gauge","z":"921ffb91cd8aaac1","name":"","group":"61285987.c20328","order":0,"width":0,"height":0,"gtype":"gage","title":"Humidity","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#00b3d9","#0073e6","#001bd7"],"seg1":"33","seg2":"66","className":"","x":440,"y":178,"wires":[]},{"id":"22e94b8c02e88d42","type":"inject","z":"921ffb91cd8aaac1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"2","crontab":"","once":true,"onceDelay":0.1,"topic":"","payloadType":"date","x":140,"y":40,"wires":[["5fb93f613d646ccc","1b7fb8fa938f3496"]]},{"id":"5fb93f613d646ccc","type":"function","z":"921ffb91cd8aaac1","name":"","func":"var m;\nm = 100*Math.random();\nmsg.payload = Math.round(m);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":20,"wires":[["64b7a1046d679632"]]},{"id":"1b7fb8fa938f3496","type":"function","z":"921ffb91cd8aaac1","name":"","func":"\n//產生min到max之間的亂數\nmin=20;\nmax=50;\n\n//會產生20~50之間的隨機亂數\nmsg.payload =  Math.floor(Math.random()*(max-min+1))+min;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":60,"wires":[["1be8703a0c064300"]]},{"id":"1be8703a0c064300","type":"mqtt out","z":"921ffb91cd8aaac1","name":"","topic":"alex9ufo/esp32/temperature","qos":"1","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"2db287b.addf978","x":520,"y":80,"wires":[]},{"id":"2db287b.addf978","type":"mqtt-broker","name":"","broker":"broker.mqtt-dashboard.com","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"/vm/mqtt/birth","birthQos":"0","birthPayload":"birth","birthMsg":{},"closeTopic":"","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"61285987.c20328","type":"ui_group","name":"測試2","tab":"b0dfa4371f4b1a30","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"b0dfa4371f4b1a30","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

113 學年度第 1 學期 RFID應用課程 Arduino程式

113 學年度第 1 學期 RFID應用課程 Arduino程式 https://www.mediafire.com/file/zr0h0p3iosq12jw/MFRC522+(2).7z/file 內含修改過後的 MFRC522 程式庫 (原程式有錯誤) //定義MFRC522...