2021年8月30日 星期一

臺中市空氣品質監測站即時監測資料

 臺中市空氣品質監測站即時監測資料








[{"id":"b8768c18.91a6e","type":"inject","z":"ea2109a2.67d518","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"3600","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":80,"wires":[["b368b4ab.25cc88"]]},{"id":"b368b4ab.25cc88","type":"http request","z":"ea2109a2.67d518","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://datacenter.taichung.gov.tw/swagger/OpenData/1a129ee9-b4ce-491a-b7ed-a1f5e5ff19c1","tls":"","persist":false,"proxy":"","authType":"","x":300,"y":80,"wires":[["5bfec88.bc8b538"]]},{"id":"ee863bcb.418778","type":"debug","z":"ea2109a2.67d518","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":80,"wires":[]},{"id":"a8d8d1ea.c407b","type":"function","z":"ea2109a2.67d518","name":"","func":"\nvar a = context.global.AQItemp;\nvar b= msg.payload;\nlet arr = [];\nlet obj;\n\na.forEach(function(e,i){\n    if(e.測站名稱==b)\n    {\n        obj = {}\n        obj.SiteName = e.測站名稱;\n        obj.PublishTime = e.測值時間;\n        obj.Iteam = e.監測項目;\n        obj.Value = e.測值;        \n        obj.Status = e.狀態;\n        arr.push(obj)         \n    }\n    msg.payload = arr;\n});\ncontext.global.AQIlength=msg.payload.length-1;\ncontext.global.AQIlengthtmp=msg.payload.length-1;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":610,"y":140,"wires":[["e2e60cd1.4c7e8","40ddccaa.ed42a4"]]},{"id":"5bfec88.bc8b538","type":"json","z":"ea2109a2.67d518","name":"","property":"payload","action":"","pretty":false,"x":470,"y":80,"wires":[["378ea73.d64be58"]]},{"id":"780198f3.ae3b28","type":"function","z":"ea2109a2.67d518","name":"Format timestamp","func":"var date = new Date();\n//var h = date.getHours()+8;\nvar h = date.getHours();\nvar m = date.getMinutes();\nvar s = date.getSeconds();\nif(h<10){\n    h = '0'+h;\n}\nif(m<10){\n    m = '0' + m;\n}\nif(s<10){\n    s = '0' + s;\n}\n\nif (msg.payload==null)\n{\n   msg.payload==null \n}\nelse\n{\n    msg.payload = msg.payload + ' --> Time:(' + h + ':' + m + ':' + s + ')' ;\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":190,"y":560,"wires":[["75f55534.a31afc"]]},{"id":"75f55534.a31afc","type":"function","z":"ea2109a2.67d518","name":"Set Line API ","func":"var a=msg.payload;\n\nif (a==null)\n{\n    msg.payload=null;\n}\nelse\n{\n    msg.headers = {'content-type':'application/x-www-form-urlencoded','Authorization':'Bearer UsNew4h6FTBsUP1QRg40XBN3vJ1JaA2FLS3stW3QCpLKFS'};\n    msg.payload = {\"message\":msg.payload};\n}\nreturn msg;\n\n//oR7KdXvK1eobRr2sRRgsl4PMq23DjDlhfUs96SyUBZu","outputs":1,"noerr":0,"initialize":"","finalize":"","x":370,"y":560,"wires":[["ec733fc3.23768"]]},{"id":"ec733fc3.23768","type":"http request","z":"ea2109a2.67d518","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"https://notify-api.line.me/api/notify","tls":"","persist":false,"proxy":"","authType":"","x":520,"y":560,"wires":[["e64dbeff.b0e42"]]},{"id":"e64dbeff.b0e42","type":"debug","z":"ea2109a2.67d518","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":560,"wires":[]},{"id":"2562f9fc.1e91d6","type":"debug","z":"ea2109a2.67d518","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"options","x":430,"y":200,"wires":[]},{"id":"378ea73.d64be58","type":"function","z":"ea2109a2.67d518","name":"set global temp","func":"context.global.AQItemp=msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":640,"y":80,"wires":[["ee863bcb.418778"]]},{"id":"4ec00674.81d2b8","type":"change","z":"ea2109a2.67d518","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"[\"文山站\",\"大甲站\",\"太平站\",\"霧峰站\",\"烏日站\",\"后里站\",\"大里交通站\"]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":140,"wires":[["4c607704.881368","2562f9fc.1e91d6"]]},{"id":"4c607704.881368","type":"ui_dropdown","z":"ea2109a2.67d518","name":"","label":"","tooltip":"","place":"請選擇地點","group":"f4ddc713.cb9a58","order":0,"width":"3","height":"1","passthru":true,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":440,"y":140,"wires":[["a8d8d1ea.c407b"]]},{"id":"e2e60cd1.4c7e8","type":"debug","z":"ea2109a2.67d518","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.length","targetType":"msg","statusVal":"","statusType":"auto","x":850,"y":140,"wires":[]},{"id":"eb2dc0d1.77f58","type":"function","z":"ea2109a2.67d518","name":"msg1","func":"msg.payload = \"測站名稱 : \"+msg.msg1;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":320,"wires":[["473a8308.65bd1c"]]},{"id":"f21c920b.de3e","type":"function","z":"ea2109a2.67d518","name":"msg2","func":"var s = msg.msg2;\nvar num1 = s.substr(0, 4);\nvar num2 = s.substr(4, 4);\nvar num3 = s.substr(8);\n\nmsg.payload = \"測值時間 : \"+ num1 + ':' +num2 + ':' +num3  ;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":360,"wires":[["142a4f26.3ef0f1"]]},{"id":"526940c8.0ceff","type":"function","z":"ea2109a2.67d518","name":"msg3","func":"msg.payload = \"監測項目 : \"+msg.msg3;\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":400,"wires":[["77fcb744.452f68"]]},{"id":"e1010628.109408","type":"function","z":"ea2109a2.67d518","name":"msg4","func":"msg.payload =\"測  值 : \"+ msg.msg4;\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":440,"wires":[["bd9427a7.350b08"]]},{"id":"126348f2.2584b7","type":"function","z":"ea2109a2.67d518","name":"msg5","func":"msg.payload = \"狀  態 : \"+ msg.msg5;\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":480,"wires":[["b7bd38e1.fa92c8","55bd8d35.7b35e4"]]},{"id":"b22f973a.a9b0b8","type":"function","z":"ea2109a2.67d518","name":"","func":"var a = context.global.TAICHUNGAQItemp;\nvar len = context.global.TAICHUNGAQItemp.length;\nvar x = context.global.lengtTMP;\n\nmsg.msg1=a[x].SiteName;\nmsg.msg2=a[x].PublishTime;\nmsg.msg3=a[x].Iteam;\nmsg.msg4=a[x].Value;\nmsg.msg5=a[x].Status;\nmsg.msg6=x;\n\nx=x+1;\ncontext.global.lengtTMP=x;\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":450,"y":280,"wires":[["eb2dc0d1.77f58","f21c920b.de3e","526940c8.0ceff","e1010628.109408","126348f2.2584b7","7dcbb035.98b43","bd927a.444a7d88"]]},{"id":"df9b4b1d.e2ea58","type":"debug","z":"ea2109a2.67d518","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":850,"y":200,"wires":[]},{"id":"41edffd8.b956d","type":"function","z":"ea2109a2.67d518","name":"","func":"\nvar len = context.global.TAICHUNGAQItemp.length;\nvar x =context.global.lengtTMP;\n\nif (len==x)\n{\n    context.global.lengtTMP=0;\n    context.global.lengtTMP2=1;\n    \n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":810,"y":520,"wires":[["2e270489.cceb3c"]]},{"id":"473a8308.65bd1c","type":"ui_text","z":"ea2109a2.67d518","group":"f4ddc713.cb9a58","order":6,"width":"3","height":"1","name":"","label":"","format":"{{msg.payload}}","layout":"row-left","x":810,"y":320,"wires":[]},{"id":"142a4f26.3ef0f1","type":"ui_text","z":"ea2109a2.67d518","group":"f4ddc713.cb9a58","order":6,"width":"3","height":"1","name":"","label":"","format":"{{msg.payload}}","layout":"row-left","x":810,"y":360,"wires":[]},{"id":"77fcb744.452f68","type":"ui_text","z":"ea2109a2.67d518","group":"f4ddc713.cb9a58","order":6,"width":"3","height":"1","name":"","label":"","format":"{{msg.payload}}","layout":"row-left","x":810,"y":400,"wires":[]},{"id":"bd9427a7.350b08","type":"ui_text","z":"ea2109a2.67d518","group":"f4ddc713.cb9a58","order":6,"width":"3","height":"1","name":"","label":"","format":"{{msg.payload}}","layout":"row-left","x":810,"y":440,"wires":[]},{"id":"89b71301.f3414","type":"link in","z":"ea2109a2.67d518","name":"","links":["2e270489.cceb3c"],"x":335,"y":340,"wires":[["b22f973a.a9b0b8"]]},{"id":"2e270489.cceb3c","type":"link out","z":"ea2109a2.67d518","name":"","links":["89b71301.f3414"],"x":895,"y":520,"wires":[]},{"id":"b7bd38e1.fa92c8","type":"ui_text","z":"ea2109a2.67d518","group":"f4ddc713.cb9a58","order":6,"width":"3","height":"1","name":"","label":"","format":"{{msg.payload}}","layout":"row-left","x":810,"y":480,"wires":[]},{"id":"565a6489.a7c8ac","type":"inject","z":"ea2109a2.67d518","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"2","topic":"","payload":"","payloadType":"date","x":90,"y":140,"wires":[["4ec00674.81d2b8"]]},{"id":"55bd8d35.7b35e4","type":"delay","z":"ea2109a2.67d518","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":660,"y":520,"wires":[["41edffd8.b956d"]]},{"id":"2ec01a5d.98a326","type":"debug","z":"ea2109a2.67d518","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"msg1","targetType":"msg","statusVal":"","statusType":"auto","x":930,"y":240,"wires":[]},{"id":"40ddccaa.ed42a4","type":"function","z":"ea2109a2.67d518","name":"","func":"context.global.TAICHUNGAQItemp=msg.payload;\ncontext.global.TAICHUNGAQIleng=msg.payload.length;\ncontext.global.lengtTMP=0;\ncontext.global.lengtTMP2=0;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":200,"wires":[["df9b4b1d.e2ea58","c6fbb425.6e1e38","b22f973a.a9b0b8"]]},{"id":"c6fbb425.6e1e38","type":"function","z":"ea2109a2.67d518","name":"","func":"var a = context.global.TAICHUNGAQItemp;\nmsg.msg1 = a[0].SiteName;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":790,"y":240,"wires":[["2ec01a5d.98a326"]]},{"id":"7dcbb035.98b43","type":"function","z":"ea2109a2.67d518","name":"msg6","func":"msg.payload = msg.msg6 ;\nvar date = new Date();\n//var h = date.getHours()+8;\nvar h = date.getHours();\nvar m = date.getMinutes();\nvar s = date.getSeconds();\nif(h<10){\n    h = '0'+h;\n}\nif(m<10){\n    m = '0' + m;\n}\nif(s<10){\n    s = '0' + s;\n}\nmsg.payload = msg.payload + '--> 現在:(' + h + ':' + m + ':' + s + ')' ;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":280,"wires":[["5c133a9a.9e4b34"]]},{"id":"5c133a9a.9e4b34","type":"ui_text","z":"ea2109a2.67d518","group":"f4ddc713.cb9a58","order":6,"width":"3","height":"1","name":"","label":"","format":"{{msg.payload}}","layout":"row-left","x":810,"y":280,"wires":[]},{"id":"bd927a.444a7d88","type":"function","z":"ea2109a2.67d518","name":"","func":"\nif (context.global.lengtTMP2 !=1)\n{\n    msg.payload=msg.msg1+msg.msg2+\", \" +msg.msg3+msg.msg4+msg.msg5;\n}\nelse\n{\n    msg.payload=null;\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":170,"y":480,"wires":[["763f0525.74cabc","780198f3.ae3b28"]]},{"id":"763f0525.74cabc","type":"debug","z":"ea2109a2.67d518","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":350,"y":480,"wires":[]},{"id":"f4ddc713.cb9a58","type":"ui_group","name":"AQI","tab":"763667c5.ae1af8","order":1,"disp":true,"width":"6","collapse":false},{"id":"763667c5.ae1af8","type":"ui_tab","name":"LAB","icon":"dashboard"}]

2021年8月29日 星期日

台中市7站即時監測資料

台中市7站即時監測資料 

將臺中市自設空氣品質監測站(后里站、太平站、大甲站、霧峰站、烏日站、文山站、大里交通監測站等˙7站)即時監測資料,帶入項目有測站名稱、測值時間、監測項目、測值、狀態等五項OPENDATA 利用Node-Red 擷取處理後選擇其中一站並將資料展示於UI介面與LineNotify上(每一站的array[]數量不定 但是每筆記錄有5個欄位)










[{"id":"b8768c18.91a6e","type":"inject","z":"ea2109a2.67d518","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"3600","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":80,"wires":[["b368b4ab.25cc88"]]},{"id":"b368b4ab.25cc88","type":"http request","z":"ea2109a2.67d518","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://datacenter.taichung.gov.tw/swagger/OpenData/1a129ee9-b4ce-491a-b7ed-a1f5e5ff19c1","tls":"","persist":false,"proxy":"","authType":"","x":300,"y":80,"wires":[["5bfec88.bc8b538"]]},{"id":"ee863bcb.418778","type":"debug","z":"ea2109a2.67d518","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":80,"wires":[]},{"id":"a8d8d1ea.c407b","type":"function","z":"ea2109a2.67d518","name":"","func":"\nvar a = context.global.AQItemp;\nvar b= msg.payload;\nlet arr = [];\nlet obj;\n\na.forEach(function(e,i){\n    if(e.測站名稱==b)\n    {\n        obj = {}\n        obj.SiteName = e.測站名稱;\n        obj.PublishTime = e.測值時間;\n        obj.Iteam = e.監測項目;\n        obj.Value = e.測值;        \n        obj.Status = e.狀態;\n        arr.push(obj)         \n    }\n    msg.payload = arr;\n});\ncontext.global.AQIlength=msg.payload.length-1;\ncontext.global.AQIlengthtmp=msg.payload.length-1;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":610,"y":140,"wires":[["e2e60cd1.4c7e8","40ddccaa.ed42a4"]]},{"id":"5bfec88.bc8b538","type":"json","z":"ea2109a2.67d518","name":"","property":"payload","action":"","pretty":false,"x":470,"y":80,"wires":[["378ea73.d64be58"]]},{"id":"780198f3.ae3b28","type":"function","z":"ea2109a2.67d518","name":"Format timestamp","func":"var date = new Date();\n//var h = date.getHours()+8;\nvar h = date.getHours();\nvar m = date.getMinutes();\nvar s = date.getSeconds();\nif(h<10){\n    h = '0'+h;\n}\nif(m<10){\n    m = '0' + m;\n}\nif(s<10){\n    s = '0' + s;\n}\n\nif (msg.payload==null)\n{\n   msg.payload==null \n}\nelse\n{\n    msg.payload = msg.payload + ' --> Time:(' + h + ':' + m + ':' + s + ')' ;\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":190,"y":560,"wires":[["75f55534.a31afc"]]},{"id":"75f55534.a31afc","type":"function","z":"ea2109a2.67d518","name":"Set Line API ","func":"var a=msg.payload;\n\nif (a==null)\n{\n    msg.payload=null;\n}\nelse\n{\n    msg.headers = {'content-type':'application/x-www-form-urlencoded','Authorization':'Bearer UsNew4h61FT1BsUPQRg40XB1N3vJ1JaAF1LSstW3QCpL1KFS'};\n    msg.payload = {\"message\":msg.payload};\n}\nreturn msg;\n\n//oR7KdXvK1eobRr2sRRgsl4PMq23DjDlhfUs96SyUBZu","outputs":1,"noerr":0,"initialize":"","finalize":"","x":370,"y":560,"wires":[["ec733fc3.23768"]]},{"id":"ec733fc3.23768","type":"http request","z":"ea2109a2.67d518","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"https://notify-api.line.me/api/notify","tls":"","persist":false,"proxy":"","authType":"","x":520,"y":560,"wires":[["e64dbeff.b0e42"]]},{"id":"e64dbeff.b0e42","type":"debug","z":"ea2109a2.67d518","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":560,"wires":[]},{"id":"2562f9fc.1e91d6","type":"debug","z":"ea2109a2.67d518","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"options","x":430,"y":200,"wires":[]},{"id":"378ea73.d64be58","type":"function","z":"ea2109a2.67d518","name":"set global temp","func":"context.global.AQItemp=msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":640,"y":80,"wires":[["ee863bcb.418778"]]},{"id":"4ec00674.81d2b8","type":"change","z":"ea2109a2.67d518","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"[\"文山站\",\"大甲站\",\"太平站\",\"霧峰站\",\"烏日站\",\"后里站\",\"大里交通站\"]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":140,"wires":[["4c607704.881368","2562f9fc.1e91d6"]]},{"id":"4c607704.881368","type":"ui_dropdown","z":"ea2109a2.67d518","name":"","label":"","tooltip":"","place":"請選擇地點","group":"f4ddc713.cb9a58","order":0,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":440,"y":140,"wires":[["a8d8d1ea.c407b"]]},{"id":"e2e60cd1.4c7e8","type":"debug","z":"ea2109a2.67d518","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.length","targetType":"msg","statusVal":"","statusType":"auto","x":850,"y":140,"wires":[]},{"id":"eb2dc0d1.77f58","type":"function","z":"ea2109a2.67d518","name":"msg1","func":"msg.payload = \"測站名稱 : \"+msg.msg1;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":320,"wires":[["473a8308.65bd1c"]]},{"id":"f21c920b.de3e","type":"function","z":"ea2109a2.67d518","name":"msg2","func":"var s = msg.msg2;\nvar num1 = s.substr(0, 4);\nvar num2 = s.substr(4, 4);\nvar num3 = s.substr(8);\n\nmsg.payload = \"測值時間 : \"+ num1 + ':' +num2 + ':' +num3  ;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":360,"wires":[["142a4f26.3ef0f1"]]},{"id":"526940c8.0ceff","type":"function","z":"ea2109a2.67d518","name":"msg3","func":"msg.payload = \"監測項目 : \"+msg.msg3;\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":400,"wires":[["77fcb744.452f68"]]},{"id":"e1010628.109408","type":"function","z":"ea2109a2.67d518","name":"msg4","func":"msg.payload =\"測  值 : \"+ msg.msg4;\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":440,"wires":[["bd9427a7.350b08"]]},{"id":"126348f2.2584b7","type":"function","z":"ea2109a2.67d518","name":"msg5","func":"msg.payload = \"狀  態 : \"+ msg.msg5;\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":480,"wires":[["b7bd38e1.fa92c8","55bd8d35.7b35e4"]]},{"id":"b22f973a.a9b0b8","type":"function","z":"ea2109a2.67d518","name":"","func":"var a = context.global.TAICHUNGAQItemp;\nvar len = context.global.TAICHUNGAQItemp.length;\nvar x =context.global.lengtTMP;\n\nmsg.msg1=a[x].SiteName;\nmsg.msg2=a[x].PublishTime;\nmsg.msg3=a[x].Iteam;\nmsg.msg4=a[x].Value;\nmsg.msg5=a[x].Status;\nmsg.msg6=x;\n\nx=x+1;\ncontext.global.lengtTMP=x;\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":450,"y":280,"wires":[["eb2dc0d1.77f58","f21c920b.de3e","526940c8.0ceff","e1010628.109408","126348f2.2584b7","7dcbb035.98b43","bd927a.444a7d88"]]},{"id":"df9b4b1d.e2ea58","type":"debug","z":"ea2109a2.67d518","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":850,"y":200,"wires":[]},{"id":"41edffd8.b956d","type":"function","z":"ea2109a2.67d518","name":"","func":"\nvar len = context.global.TAICHUNGAQItemp.length;\nvar x =context.global.lengtTMP;\n\nif (len==x)\n{\n    context.global.lengtTMP=0;\n    context.global.lengtTMP2=1;\n    \n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":810,"y":520,"wires":[["2e270489.cceb3c"]]},{"id":"473a8308.65bd1c","type":"ui_text","z":"ea2109a2.67d518","group":"f4ddc713.cb9a58","order":6,"width":"3","height":"1","name":"","label":"","format":"{{msg.payload}}","layout":"row-left","x":810,"y":320,"wires":[]},{"id":"142a4f26.3ef0f1","type":"ui_text","z":"ea2109a2.67d518","group":"f4ddc713.cb9a58","order":6,"width":"3","height":"1","name":"","label":"","format":"{{msg.payload}}","layout":"row-left","x":810,"y":360,"wires":[]},{"id":"77fcb744.452f68","type":"ui_text","z":"ea2109a2.67d518","group":"f4ddc713.cb9a58","order":6,"width":"3","height":"1","name":"","label":"","format":"{{msg.payload}}","layout":"row-left","x":810,"y":400,"wires":[]},{"id":"bd9427a7.350b08","type":"ui_text","z":"ea2109a2.67d518","group":"f4ddc713.cb9a58","order":6,"width":"3","height":"1","name":"","label":"","format":"{{msg.payload}}","layout":"row-left","x":810,"y":440,"wires":[]},{"id":"89b71301.f3414","type":"link in","z":"ea2109a2.67d518","name":"","links":["2e270489.cceb3c"],"x":335,"y":340,"wires":[["b22f973a.a9b0b8"]]},{"id":"2e270489.cceb3c","type":"link out","z":"ea2109a2.67d518","name":"","links":["89b71301.f3414"],"x":895,"y":520,"wires":[]},{"id":"b7bd38e1.fa92c8","type":"ui_text","z":"ea2109a2.67d518","group":"f4ddc713.cb9a58","order":6,"width":"3","height":"1","name":"","label":"","format":"{{msg.payload}}","layout":"row-left","x":810,"y":480,"wires":[]},{"id":"565a6489.a7c8ac","type":"inject","z":"ea2109a2.67d518","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"2","topic":"","payload":"","payloadType":"date","x":90,"y":140,"wires":[["4ec00674.81d2b8"]]},{"id":"55bd8d35.7b35e4","type":"delay","z":"ea2109a2.67d518","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":660,"y":520,"wires":[["41edffd8.b956d"]]},{"id":"2ec01a5d.98a326","type":"debug","z":"ea2109a2.67d518","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"msg1","targetType":"msg","statusVal":"","statusType":"auto","x":930,"y":240,"wires":[]},{"id":"40ddccaa.ed42a4","type":"function","z":"ea2109a2.67d518","name":"","func":"context.global.TAICHUNGAQItemp=msg.payload;\ncontext.global.TAICHUNGAQIleng=msg.payload.length;\ncontext.global.lengtTMP=0;\ncontext.global.lengtTMP2=0;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":200,"wires":[["df9b4b1d.e2ea58","c6fbb425.6e1e38"]]},{"id":"c6fbb425.6e1e38","type":"function","z":"ea2109a2.67d518","name":"","func":"var a = context.global.TAICHUNGAQItemp;\nvar len = context.global.TAICHUNGAQItemp.length;\nmsg.msg1 = a[0].SiteName;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":790,"y":240,"wires":[["2ec01a5d.98a326"]]},{"id":"7dcbb035.98b43","type":"function","z":"ea2109a2.67d518","name":"msg6","func":"msg.payload = msg.msg6 ;\nvar date = new Date();\n//var h = date.getHours()+8;\nvar h = date.getHours();\nvar m = date.getMinutes();\nvar s = date.getSeconds();\nif(h<10){\n    h = '0'+h;\n}\nif(m<10){\n    m = '0' + m;\n}\nif(s<10){\n    s = '0' + s;\n}\nmsg.payload = msg.payload + '--> 現在:(' + h + ':' + m + ':' + s + ')' ;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":280,"wires":[["5c133a9a.9e4b34"]]},{"id":"5c133a9a.9e4b34","type":"ui_text","z":"ea2109a2.67d518","group":"f4ddc713.cb9a58","order":6,"width":"3","height":"1","name":"","label":"","format":"{{msg.payload}}","layout":"row-left","x":810,"y":280,"wires":[]},{"id":"bd927a.444a7d88","type":"function","z":"ea2109a2.67d518","name":"","func":"\nif (context.global.lengtTMP2 !=1)\n{\n    msg.payload=msg.msg1+msg.msg2+\", \" +msg.msg3+msg.msg4+msg.msg5;\n}\nelse\n{\n    msg.payload=null;\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":170,"y":480,"wires":[["763f0525.74cabc","780198f3.ae3b28"]]},{"id":"763f0525.74cabc","type":"debug","z":"ea2109a2.67d518","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":350,"y":480,"wires":[]},{"id":"f4ddc713.cb9a58","type":"ui_group","name":"AQI","tab":"763667c5.ae1af8","order":1,"disp":true,"width":"6","collapse":false},{"id":"763667c5.ae1af8","type":"ui_tab","name":"LAB","icon":"dashboard"}]

2021年8月25日 星期三

Node-Red 擷取空氣品質指標(AQI)的opendata 中的83個陣列資料中的台中市的5個Sitename中相關的7個欄位資料擷取,並定期2小時送至Line Notify

 Node-Red 擷取空氣品質指標(AQI)的opendata 中的83個陣列資料中的台中市的5個Sitename中相關的7個欄位資料擷取,再選擇5站其中一站 展示於 UI 上 並定期2小時送至Line Notify







[{"id":"75e765f7.d089fc","type":"inject","z":"63963f52.edd65","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"7200","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":140,"wires":[["c4293ab0.cc70b8"]]},{"id":"c4293ab0.cc70b8","type":"http request","z":"63963f52.edd65","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://data.epa.gov.tw/api/v1/aqx_p_432?limit=1000&api_key=9be7b239-557b-4c10-9775-78cadfc555e9&sort=ImportDate%20desc&format=json","tls":"","persist":false,"proxy":"","authType":"","x":300,"y":140,"wires":[["b60a9bf1.ff0798"]]},{"id":"f3985ede.7f10a","type":"debug","z":"63963f52.edd65","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":180,"wires":[]},{"id":"2ec34186.229bde","type":"function","z":"63963f52.edd65","name":"","func":"var a = msg.payload;\nlet arr = [];\nlet obj;\n\na.forEach(function(e,i){\n    if(e.County=='臺中市')\n    {\n        obj = {}\n        obj.SiteName = e.SiteName;\n        obj.AQI = e.AQI;\n        obj.Status = e.Status;\n        obj.SO2 = e.SO2;        \n        obj.PM10 = e.PM10;\n        obj.PM25 = e['PM2.5'];\n        obj.PublishTime=e.PublishTime;\n        \n        arr.push(obj)         \n        \n        //msg.PM25 = e['PM2.5'];\n        //msg.PublishTime = e['PublishTime'];\n    }\n    msg.payload = arr;\n});\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":570,"y":200,"wires":[["f3985ede.7f10a","267727c0.7adae8"]]},{"id":"b60a9bf1.ff0798","type":"json","z":"63963f52.edd65","name":"","property":"payload","action":"","pretty":false,"x":430,"y":140,"wires":[["bfacf93c.4e70f8"]]},{"id":"a5172131.f1236","type":"debug","z":"63963f52.edd65","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":140,"wires":[]},{"id":"bfacf93c.4e70f8","type":"function","z":"63963f52.edd65","name":"","func":"msg.payload=msg.payload.records;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":550,"y":140,"wires":[["2ec34186.229bde","a5172131.f1236"]]},{"id":"4a2bf719.a08ff8","type":"function","z":"63963f52.edd65","name":"Format timestamp","func":"var date = new Date();\n//var h = date.getHours()+8;\nvar h = date.getHours();\nvar m = date.getMinutes();\nvar s = date.getSeconds();\nif(h<10){\n    h = '0'+h;\n}\nif(m<10){\n    m = '0' + m;\n}\nif(s<10){\n    s = '0' + s;\n}\nmsg.payload = msg.payload + msg.PM25 + ' --> Time:(' + h + ':' + m + ':' + s + ')' ;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":330,"y":340,"wires":[["b197a382.36a5b"]]},{"id":"b197a382.36a5b","type":"function","z":"63963f52.edd65","name":"Set Line API ","func":"msg.headers = {'content-type':'application/x-www-form-urlencoded','Authorization':'Bearer UsNew4h6FT1BsUPQRg402XBN3vJ1JaAFLSst2W3QCpLKFS'};\nmsg.payload = {\"message\":msg.payload};\nreturn msg;\n\n//oR7KdXvK1eobRr2sRRgsl4PMq23DjDlhfUs96SyUBZu","outputs":1,"noerr":0,"initialize":"","finalize":"","x":510,"y":340,"wires":[["b2e90492.f772e8"]]},{"id":"b2e90492.f772e8","type":"http request","z":"63963f52.edd65","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"https://notify-api.line.me/api/notify","tls":"","persist":false,"proxy":"","authType":"","x":660,"y":340,"wires":[["b40b956f.365c38"]]},{"id":"b40b956f.365c38","type":"debug","z":"63963f52.edd65","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":810,"y":340,"wires":[]},{"id":"a822b090.7f475","type":"ui_dropdown","z":"63963f52.edd65","name":"","label":"","tooltip":"","place":"請選擇地點","group":"f4ddc713.cb9a58","order":0,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":520,"y":440,"wires":[["7007b385.1cbd8c"]]},{"id":"ec8188d8.2b6768","type":"inject","z":"63963f52.edd65","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"0.5","topic":"","payload":"","payloadType":"date","x":130,"y":440,"wires":[["377262e8.6b7f1e"]]},{"id":"377262e8.6b7f1e","type":"change","z":"63963f52.edd65","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"[\"豐原\", \"沙鹿\",\"大里\",\"忠明\",\"西屯\"]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":440,"wires":[["a822b090.7f475","3a9d35c3.a2c6da"]]},{"id":"3a9d35c3.a2c6da","type":"debug","z":"63963f52.edd65","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"options","x":530,"y":500,"wires":[]},{"id":"267727c0.7adae8","type":"function","z":"63963f52.edd65","name":"set global temp","func":"context.global.AQItemp=msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":760,"y":220,"wires":[[]]},{"id":"7007b385.1cbd8c","type":"function","z":"63963f52.edd65","name":"","func":"var a = context.global.AQItemp;\nvar b = msg.payload;\na.forEach(function(e,i){\n    if(e.SiteName==b)\n    {\n        msg.SiteName = e.SiteName;\n        msg.AQI = e.AQI;\n        msg.Status = e.Status;\n        msg.SO2 = e.SO2;        \n        msg.PM10 = e.PM10;\n        msg.PM25 = e['PM25'];\n        msg.PublishTime=e.PublishTime;\n\n    }\n\n});\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":440,"wires":[["d3ebfff9.6ba2e","87a47a7e.ea75c8","e72dfe7b.0c662"]]},{"id":"d3ebfff9.6ba2e","type":"debug","z":"63963f52.edd65","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":850,"y":500,"wires":[]},{"id":"7474bb85.19b474","type":"json","z":"63963f52.edd65","name":"","property":"payload","action":"str","pretty":false,"x":150,"y":340,"wires":[["4a2bf719.a08ff8","47567f25.9d4fa"]]},{"id":"47567f25.9d4fa","type":"ui_text","z":"63963f52.edd65","group":"f4ddc713.cb9a58","order":4,"width":0,"height":0,"name":"","label":"台中5站之","format":"{{msg.payload}}","layout":"row-spread","x":290,"y":280,"wires":[]},{"id":"87a47a7e.ea75c8","type":"function","z":"63963f52.edd65","name":"","func":"var PM25;\nPM25 = msg.PM25;                    \nmsg.payload=PM25;\nreturn  msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":810,"y":440,"wires":[["60c9ebf0.384664","6bfb87d4.6df4c8"]]},{"id":"60c9ebf0.384664","type":"ui_gauge","z":"63963f52.edd65","name":"","group":"f4ddc713.cb9a58","order":5,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"units","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":950,"y":440,"wires":[]},{"id":"6bfb87d4.6df4c8","type":"debug","z":"63963f52.edd65","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":970,"y":400,"wires":[]},{"id":"e72dfe7b.0c662","type":"function","z":"63963f52.edd65","name":"","func":"msg.payload=[ \"站名 :\" +msg.SiteName , \"空氣品質指數 : \" + msg.AQI ,\"空氣品質 : \" + msg.Status , \"SO2 : \" + msg.SO2 , \"PM10 : \"+ msg.PM10 , \"PM2.5 : \" + msg.PM25 , \"發行時間 \" + msg.PublishTime   ] ;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":150,"y":380,"wires":[["7474bb85.19b474"]]},{"id":"f4ddc713.cb9a58","type":"ui_group","name":"AQI","tab":"763667c5.ae1af8","order":1,"disp":true,"width":"6","collapse":false},{"id":"763667c5.ae1af8","type":"ui_tab","name":"LAB","icon":"dashboard"}]

Node-Red 擷取空氣品質指標(AQI)的opendata 中的83個陣列資料中的台中市的5個Sitename中相關的7個欄位資料擷取,並定期2小時送至Line Notify

 

Node-Red 擷取空氣品質指標(AQI)opendata 中的83個陣列資料中的台中市的5Sitename中相關的7個欄位資料擷取,並定期2小時送至Line Notify

 



空氣品質指標(AQI)

每小時提供各測站之空氣品質指標(AQI),原始資料版本公告於空氣品質監測網https://airtw.epa.gov.tw

https://data.epa.gov.tw/api/v1/aqx_p_432?limit=1000&api_key=9be7b239-557b-4c10-9775-78cadfc555e9&sort=ImportDate%20desc&format=json

 

原有的資料



第一次擷取資料



Node名稱

設定

 備註

http請求

GET

https://data.epa.gov.tw/api/v1/aqx_p_432?limit=1000&api_key=9be7b239-557b-4c10-9775-78cadfc555e9&sort=ImportDate%20desc&format=json

UTF-8字串

 

Json

JSON字串與物件object互轉

 

函數

msg.payload=msg.payload.records;

return msg;

擷取msg.payload.records的欄位其他的捨去

第一次擷取後資料

array[83]

[0 … 9]

0: object

SiteName: "基隆"

County: "基隆市"

AQI: "45"

Pollutant: ""

Status: "良好"

SO2: "3.2"

CO: "0.17"

CO_8hr: "0.2"

O3: "47.6"

O3_8hr: "33"

PM10: "48"

PM2.5: "21"

NO2: "5.8"

NOx: "7"

NO: "1.2"

WindSpeed: "1.2"

WindDirec: "5"

PublishTime: "2021/08/25 14:00:00"

PM2.5_AVG: "13"

PM10_AVG: "24"

SO2_AVG: "1"

Longitude: "121.760056"

Latitude: "25.129167"

SiteId: "1"

ImportDate: "2021-08-25 14:53:02.253000"

 



Node名稱

設定

 備註

函數

var a = msg.payload;

let arr = [];

let obj;

 

a.forEach(function(e,i){

    if(e.County=='臺中市')

    {

        obj = {}

        obj.SiteName = e.SiteName;

        obj.AQI = e.AQI;

        obj.Status = e.Status;

        obj.SO2 = e.SO2;       

        obj.PM10 = e.PM10;

        obj.PM25 = e['PM2.5'];

        obj.PublishTime=e.PublishTime;

       

        arr.push(obj)         

       

    }

    msg.payload = arr;

});

return msg;

 

 

 

 

第二次擷取後資料 (剩下台中市的5筆資料 每一筆共7個欄位)

SiteName: "豐原"   AQI: "49"    Status: "良好"    SO2: "2.5"   PM10: "38"   PM25: "21" PublishTime: "2021/08/25 14:00:00"

 

array[5]

0: object

SiteName: "豐原"

AQI: "49"

Status: "良好"

SO2: "2.5"

PM10: "38"

PM25: "21"

PublishTime: "2021/08/25 14:00:00"

1: object

2: object

3: object

4: object


[{"id":"75e765f7.d089fc","type":"inject","z":"63963f52.edd65","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"7200","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":140,"wires":[["c4293ab0.cc70b8"]]},{"id":"c4293ab0.cc70b8","type":"http request","z":"63963f52.edd65","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://data.epa.gov.tw/api/v1/aqx_p_432?limit=1000&api_key=9be7b239-557b-4c10-9775-78cadfc555e9&sort=ImportDate%20desc&format=json","tls":"","persist":false,"proxy":"","authType":"","x":300,"y":140,"wires":[["b60a9bf1.ff0798"]]},{"id":"b60a9bf1.ff0798","type":"json","z":"63963f52.edd65","name":"","property":"payload","action":"","pretty":false,"x":430,"y":140,"wires":[["bfacf93c.4e70f8"]]},{"id":"bfacf93c.4e70f8","type":"function","z":"63963f52.edd65","name":"","func":"msg.payload=msg.payload.records;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":550,"y":140,"wires":[["2ec34186.229bde","a5172131.f1236"]]},{"id":"2ec34186.229bde","type":"function","z":"63963f52.edd65","name":"","func":"var a = msg.payload;\nlet arr = [];\nlet obj;\n\na.forEach(function(e,i){\n    if(e.County=='臺中市')\n    {\n        obj = {}\n        obj.SiteName = e.SiteName;\n        obj.AQI = e.AQI;\n        obj.Status = e.Status;\n        obj.SO2 = e.SO2;        \n        obj.PM10 = e.PM10;\n        obj.PM25 = e['PM2.5'];\n        obj.PublishTime=e.PublishTime;\n        \n        arr.push(obj)         \n        \n        //msg.PM25 = e['PM2.5'];\n        //msg.PublishTime = e['PublishTime'];\n    }\n    msg.payload = arr;\n});\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":570,"y":220,"wires":[["f3985ede.7f10a","ee13afc2.04bce"]]},{"id":"a5172131.f1236","type":"debug","z":"63963f52.edd65","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":140,"wires":[]},{"id":"f3985ede.7f10a","type":"debug","z":"63963f52.edd65","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":220,"wires":[]}]

2021年8月24日 星期二

Node-Red UI 控制LED 5項功能並發行到MQTT ,再由UI訂閱MQTT 發行的訊息 並將收到結果送到UI SQLite Line Notify 上

 Node-Red UI 控制LED 5項功能並發行到MQTT ,再由UI訂閱MQTT 發行的訊息

並將收到結果送到UI SQLite Line Notify 上









[{"id":"81fcc172.b649c","type":"mqtt in","z":"b54306a0.2dba08","name":"","topic":"alex9ufo/inTopic/led/led_event","qos":"1","datatype":"auto","broker":"841df58d.ee5e98","x":140,"y":140,"wires":[["6bd2f63e.91f458","5be77bc1.5e5f04","8fb7612a.9e94e"]]},{"id":"44f43ce1.52cea4","type":"ui_text","z":"b54306a0.2dba08","group":"ac0f1141.eb50e","order":0,"width":0,"height":0,"name":"","label":"ESP32發行到MQTT的資料","format":"{{msg.payload}}","layout":"col-center","x":560,"y":100,"wires":[]},{"id":"6ad0db60.45b7d4","type":"ui_button","z":"b54306a0.2dba08","name":"","group":"ac0f1141.eb50e","order":0,"width":"4","height":"1","passthru":false,"label":"LED 開","tooltip":"","color":"white","bgcolor":"","icon":"fa-circle","payload":"ON","payloadType":"str","topic":"","x":80,"y":340,"wires":[["dd3a0c40.1bf03","b8f50787.64dcd8","d6da87f2.7031e8"]]},{"id":"a816230c.bd915","type":"ui_button","z":"b54306a0.2dba08","name":"","group":"ac0f1141.eb50e","order":0,"width":"4","height":"1","passthru":false,"label":"LED 關","tooltip":"","color":"black","bgcolor":"","icon":"fa-circle-o","payload":"OFF","payloadType":"str","topic":"","x":80,"y":380,"wires":[["dd3a0c40.1bf03","b8f50787.64dcd8","d6da87f2.7031e8"]]},{"id":"dd3a0c40.1bf03","type":"mqtt out","z":"b54306a0.2dba08","name":"","topic":"alex9ufo/inTopic/led/led_event","qos":"1","retain":"true","broker":"841df58d.ee5e98","x":390,"y":420,"wires":[]},{"id":"6bd2f63e.91f458","type":"function","z":"b54306a0.2dba08","name":"Format timestamp","func":"var date = new Date();\n//var h = date.getHours()+8;\nvar h = date.getHours();\nvar m = date.getMinutes();\nvar s = date.getSeconds();\nif(h<10){\n    h = '0'+h;\n}\nif(m<10){\n    m = '0' + m;\n}\nif(s<10){\n    s = '0' + s;\n}\nmsg.payload = msg.payload + ' --> Time:(' + h + ':' + m + ':' + s + ')' ;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":270,"y":240,"wires":[["b25bd209.b48af"]]},{"id":"b25bd209.b48af","type":"function","z":"b54306a0.2dba08","name":"Set Line API ","func":"msg.headers = {'content-type':'application/x-www-form-urlencoded','Authorization':'Bearer A4wwPNh2WqB7dlfeQ1yyIAwtggn1kf1ZSI5LkkCdia1gB'};\nmsg.payload = {\"message\":msg.payload};\nreturn msg;\n\n//oR7KdXvK1eobRr2sRRgsl4PMq23DjDlhfUs96SyUBZu","outputs":1,"noerr":0,"x":470,"y":240,"wires":[["670d157d.a1ae2c"]]},{"id":"670d157d.a1ae2c","type":"http request","z":"b54306a0.2dba08","name":"","method":"POST","ret":"txt","paytoqs":false,"url":"https://notify-api.line.me/api/notify","tls":"","persist":false,"proxy":"","authType":"","x":620,"y":240,"wires":[["dcb71013.e6c49"]]},{"id":"dcb71013.e6c49","type":"debug","z":"b54306a0.2dba08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":790,"y":240,"wires":[]},{"id":"5be77bc1.5e5f04","type":"debug","z":"b54306a0.2dba08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":310,"y":200,"wires":[]},{"id":"f7af02e2.06a61","type":"ui_audio","z":"b54306a0.2dba08","name":"","group":"ac0f1141.eb50e","voice":"Google 國語(臺灣)","always":true,"x":500,"y":140,"wires":[]},{"id":"ed0f4882.a1c028","type":"ui_button","z":"b54306a0.2dba08","name":"","group":"ac0f1141.eb50e","order":0,"width":"4","height":"1","passthru":false,"label":"LED 開關反向","tooltip":"","color":"blue","bgcolor":"","icon":"fa-circle-o","payload":"TOGGLE","payloadType":"str","topic":"","x":100,"y":420,"wires":[["dd3a0c40.1bf03","b8f50787.64dcd8","d6da87f2.7031e8"]]},{"id":"8fb7612a.9e94e","type":"function","z":"b54306a0.2dba08","name":"","func":"var st1;\nif (msg.payload === \"ON\") {\n   st1=\"LED開\"; \n} \nelse if (msg.payload === \"OFF\") {\n  st1=\"LED關\";\n}\nelse if (msg.payload === \"FLASH\") {\n  st1=\"LED閃爍\";\n}\nelse if (msg.payload === \"TIMER\") {\n  st1=\"LED開五秒鐘\";\n}\nelse if (msg.payload === \"TOGGLE\") {\n  st1=\"LED ON OFF 交換\";\n}\n\nmsg.payload=st1;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":350,"y":140,"wires":[["f7af02e2.06a61","44f43ce1.52cea4","5e8beddd.ea9cb4"]]},{"id":"3f9840bb.01189","type":"ui_button","z":"b54306a0.2dba08","name":"","group":"ac0f1141.eb50e","order":0,"width":"4","height":"1","passthru":false,"label":"LED 開5秒鐘","tooltip":"","color":"purple","bgcolor":"","icon":"fa-circle-o","payload":"TIMER","payloadType":"str","topic":"","x":90,"y":500,"wires":[["dd3a0c40.1bf03","b8f50787.64dcd8","d6da87f2.7031e8"]]},{"id":"5e8beddd.ea9cb4","type":"function","z":"b54306a0.2dba08","name":"INSERT","func":"msg.topic = \"INSERT INTO LED (time_led, led_status) VALUES (?,?)\";\n//msg.topic = \"INSERT INTO LED (id, time_led, led_status) VALUES (?,?,?)\";\n\n\nvar Today = new Date();\nvar yyyy = Today.getFullYear(); //年\nvar MM = Today.getMonth()+1;    //月\nvar dd = Today.getDate();       //日\nvar h = Today.getHours();       //時\nvar m = Today.getMinutes();     //分\nvar s = Today.getSeconds();     //秒\n\nif(MM<10)\n{\n   MM = '0'+MM;\n}\n\nif(dd<10)\n{\n   dd = '0'+dd;\n}\n\nif(h<10)\n{\n   h = '0'+h;\n}\n\nif(m<10)\n{\n  m = '0' + m;\n}\n\nif(s<10)\n{\n  s = '0' + s;\n}\n\nvar hms= yyyy + '/'+ MM + '/'+ dd + ' ' + h + ':' + m + ':' + s ;\n//var id= Date.now() ;\n//msg.payload = [id ,hms, msg.payload];\nmsg.payload = [hms, msg.payload];\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":480,"y":180,"wires":[["70f85224.66a75c"]]},{"id":"70f85224.66a75c","type":"sqlite","z":"b54306a0.2dba08","mydb":"f5a33dc2.f6f08","sqlquery":"msg.topic","sql":"","name":"LED Status","x":630,"y":180,"wires":[["c88acfce.2a435"]]},{"id":"c88acfce.2a435","type":"debug","z":"b54306a0.2dba08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":790,"y":180,"wires":[]},{"id":"7ce64989.ac2a88","type":"comment","z":"b54306a0.2dba08","name":"Node-Red publish 到 HiveMQ Broker  ","info":"將 alex9ufo/inTopic 到(publish)HiveMQ Broker \n給 Arduino 訂閱(Subscribe)","x":160,"y":300,"wires":[]},{"id":"16d32146.69272f","type":"comment","z":"b54306a0.2dba08","name":"Node-Red向 HiveMQ Broker訂閱subscribe","info":"將  Arduino 發行到(publish)HiveMQ Broker alex9ufo/led/led_status \n給 Node-red 或 MQTTB-Box 訂閱(Subscribe)","x":180,"y":100,"wires":[]},{"id":"5c03786d.1047f8","type":"ui_button","z":"b54306a0.2dba08","name":"","group":"ac0f1141.eb50e","order":0,"width":"4","height":"1","passthru":false,"label":"LED 閃爍","tooltip":"","color":"yellow","bgcolor":"","icon":"fa-circle-o","payload":"FLASH","payloadType":"str","topic":"","x":80,"y":460,"wires":[["dd3a0c40.1bf03","b8f50787.64dcd8","d6da87f2.7031e8"]]},{"id":"b8f50787.64dcd8","type":"ui_audio","z":"b54306a0.2dba08","name":"","group":"ac0f1141.eb50e","voice":"Google 國語(臺灣)","always":true,"x":320,"y":500,"wires":[]},{"id":"d6da87f2.7031e8","type":"ui_text","z":"b54306a0.2dba08","group":"ac0f1141.eb50e","order":0,"width":0,"height":0,"name":"","label":"Node-RED發行到MQTT的資料","format":"{{msg.payload}}","layout":"row-left","x":390,"y":340,"wires":[]},{"id":"38c59cae.9b9254","type":"function","z":"b54306a0.2dba08","name":"產生資料庫TABLE","func":"msg.topic = ' CREATE TABLE \"LED\" (\t\"id\"\tINTEGER,\t\"time_led\"\tTEXT,\"led_status\"\tTEXT,PRIMARY KEY(\"id\" AUTOINCREMENT))';\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":390,"y":560,"wires":[["4f135015.99984"]]},{"id":"29fbe590.9f17ba","type":"inject","z":"b54306a0.2dba08","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":620,"wires":[["38c59cae.9b9254"]]},{"id":"6c9cc2fb.d8c9cc","type":"ui_button","z":"b54306a0.2dba08","name":"建立LED資料庫(只能執行一次)","group":"ac0f1141.eb50e","order":66,"width":"4","height":"2","passthru":false,"label":"建立LED資料庫(只能執行一次)","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":150,"y":560,"wires":[["38c59cae.9b9254"]]},{"id":"4f135015.99984","type":"sqlite","z":"b54306a0.2dba08","mydb":"f5a33dc2.f6f08","sqlquery":"msg.topic","sql":"","name":"LED Status","x":570,"y":560,"wires":[["886a4158.431a9","de8e9a34.114338"]]},{"id":"886a4158.431a9","type":"debug","z":"b54306a0.2dba08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":560,"wires":[]},{"id":"de8e9a34.114338","type":"ui_template","z":"b54306a0.2dba08","group":"ac0f1141.eb50e","name":"","order":0,"width":"12","height":"4","format":"<table style=\"width:100%\">\n  <tr>\n    <th>Index</th> \n    <th>Time</th> \n    <th>Status</th>\n  </tr>\n  <tr ng-repeat=\"x in msg.payload | limitTo:20\">\n    <td>{{$index}}</td>\n    <td>{{msg.payload[$index].time_led }}</td>\n    <td>{{msg.payload[$index].led_status}}</td> \n  </tr>\n</table>\n","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":true,"templateScope":"local","x":760,"y":600,"wires":[[]]},{"id":"9bdf819a.db03f","type":"ui_button","z":"b54306a0.2dba08","name":"","group":"ac0f1141.eb50e","order":10,"width":"4","height":"2","passthru":false,"label":"檢視LED資料庫","tooltip":"","color":"","bgcolor":"","icon":"","payload":"檢視LED資料庫","payloadType":"str","topic":"SELECT * FROM LED ORDER BY  id  DESC LIMIT 100;","x":400,"y":620,"wires":[["4f135015.99984"]]},{"id":"c110dfd9.a5329","type":"comment","z":"b54306a0.2dba08","name":"送出訊息 到 Line Notify","info":"","x":480,"y":280,"wires":[]},{"id":"841df58d.ee5e98","type":"mqtt-broker","name":"","broker":"broker.mqtt-dashboard.com","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"ac0f1141.eb50e","type":"ui_group","name":"LED","tab":"834e019a.2dfbb","order":1,"disp":true,"width":"8","collapse":true},{"id":"f5a33dc2.f6f08","type":"sqlitedb","db":"c:\\users\\alex\\.node-red\\LED_MQTT_LINE.db","mode":"RWC"},{"id":"834e019a.2dfbb","type":"ui_tab","name":"MongoDB","icon":"dashboard","disabled":false,"hidden":false}]

2021年8月21日 星期六

台中市11站監控PM2.5 資料的擷取

 台中市11站監控PM2.5 資料的擷取










[{"id":"65f89fd1.062d1","type":"inject","z":"641a7946.ecd3e8","name":"Click","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"7200","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":80,"wires":[["4bafaf29.b7449"]]},{"id":"f20f4fe7.e943e","type":"ui_switch","z":"641a7946.ecd3e8","name":"","label":"啟動讀取opendata","tooltip":"","group":"9d7c6798.9fc5e8","order":61,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":110,"y":120,"wires":[["4bafaf29.b7449"]]},{"id":"2d21f576.7fbb0a","type":"ui_gauge","z":"641a7946.ecd3e8","name":"PM2.5","group":"9d7c6798.9fc5e8","order":62,"width":0,"height":0,"gtype":"gage","title":"細懸浮微粒(PM2.5)指標","label":"(μg/m3)","format":"{{value}}","min":0,"max":"71","colors":["#00b500","#e6e600","#ca3838"],"seg1":"35","seg2":"59","x":710,"y":280,"wires":[]},{"id":"4bafaf29.b7449","type":"http request","z":"641a7946.ecd3e8","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://www.airq.org.tw/Home/realtime10m","tls":"","persist":false,"proxy":"","authType":"","x":300,"y":80,"wires":[["6f8f0a12.933724","d47c6d00.88d39"]]},{"id":"6f8f0a12.933724","type":"debug","z":"641a7946.ecd3e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":490,"y":80,"wires":[]},{"id":"94438361.32252","type":"function","z":"641a7946.ecd3e8","name":"找出  PM2.5  , PublishTime","func":"\nvar a = context.global.temp;\nvar b = msg.payload;\na.forEach(function(e,i){\n    if(e.Name==b)\n    {\n        msg.PM25 = e['Value'];\n        msg.PublishTime = e['StartTime'];\n    }\n});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":210,"y":260,"wires":[["553bffe.3942d","783cb9d2.e15ec8","87486346.86b4b","a895a40c.f09148","bc465b0c.194938"]]},{"id":"553bffe.3942d","type":"debug","z":"641a7946.ecd3e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"PM25","targetType":"msg","statusVal":"","statusType":"auto","x":550,"y":200,"wires":[]},{"id":"783cb9d2.e15ec8","type":"function","z":"641a7946.ecd3e8","name":"PM2.5資料","func":"msg.payload=msg.PM25;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":550,"y":280,"wires":[["2d21f576.7fbb0a","3893088c.bfcd08"]]},{"id":"3893088c.bfcd08","type":"debug","z":"641a7946.ecd3e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":320,"wires":[]},{"id":"a4600dc9.fad98","type":"comment","z":"641a7946.ecd3e8","name":"PM2.5開放資料網址","info":"南投地區PM2.5開放資料網址如下:\n\nhttp://www.airq.org.tw/Home/AboutData_ZH\n\nJSON 格式 API(更新頻率:每 10分鐘)\n\nhttp://www.airq.org.tw/Home/realtime10m\n","x":110,"y":40,"wires":[]},{"id":"f032e2d9.9320b","type":"DataIn","z":"641a7946.ecd3e8","collection":"7a14aca8.b15994","name":"PM2.5","update":false,"path":"/","x":790,"y":180,"wires":[]},{"id":"d47c6d00.88d39","type":"function","z":"641a7946.ecd3e8","name":"set global temp","func":"context.global.temp=msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":480,"y":40,"wires":[[]]},{"id":"87486346.86b4b","type":"debug","z":"641a7946.ecd3e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"PublishTime","targetType":"msg","statusVal":"","statusType":"auto","x":570,"y":240,"wires":[]},{"id":"6fe3827a.3f677c","type":"ui_text","z":"641a7946.ecd3e8","group":"9d7c6798.9fc5e8","order":63,"width":0,"height":0,"name":"發行時間","label":"發行時間","format":"{{msg.payload}}","layout":"row-center","x":720,"y":360,"wires":[]},{"id":"c13ae253.61b36","type":"debug","z":"641a7946.ecd3e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":400,"wires":[]},{"id":"a895a40c.f09148","type":"function","z":"641a7946.ecd3e8","name":"發行時間","func":"msg.payload=msg.PublishTime;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":560,"y":360,"wires":[["6fe3827a.3f677c","c13ae253.61b36"]]},{"id":"10b2caf3.2abdd5","type":"comment","z":"641a7946.ecd3e8","name":"","info":"https://www.ntepb.gov.tw/sub/content/index.aspx?Parser=1,17,511,494,496\n\n0-11\t12-23\t24-35\t\n低\t    低\t    低\n36-41\t42-47\t48-53\n中\t    中\t    中\n54-58   59-64\t65-70\t\n高\t    高\t    高\n>71\n非常高","x":530,"y":320,"wires":[]},{"id":"d413fad8.957c68","type":"change","z":"641a7946.ecd3e8","name":"","rules":[{"t":"set","p":"datapath","pt":"msg","to":"/myRootTest","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":160,"wires":[["f032e2d9.9320b","ed0f091c.c7a088"]]},{"id":"818e0e8a.dd2b7","type":"change","z":"641a7946.ecd3e8","name":"","rules":[{"t":"set","p":"datapath","pt":"msg","to":"/myRootTest","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":540,"wires":[["e74a4b8.c47f6b8"]]},{"id":"e74a4b8.c47f6b8","type":"DataOut","z":"641a7946.ecd3e8","collection":"7a14aca8.b15994","name":"PM2.5","path":"/","error":false,"x":530,"y":540,"wires":[["2ea0ef43.85641","d4a3893a.bf7d58"]]},{"id":"2ea0ef43.85641","type":"debug","z":"641a7946.ecd3e8","name":"","active":true,"console":"false","complete":"false","x":690,"y":480,"wires":[]},{"id":"c7b3dbcf.074cd8","type":"json","z":"641a7946.ecd3e8","name":"","property":"payload","action":"str","pretty":false,"x":450,"y":160,"wires":[["d413fad8.957c68","a4e6b49c.470298"]]},{"id":"a4e6b49c.470298","type":"debug","z":"641a7946.ecd3e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":610,"y":120,"wires":[]},{"id":"ed0f091c.c7a088","type":"debug","z":"641a7946.ecd3e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":810,"y":140,"wires":[]},{"id":"d4a3893a.bf7d58","type":"ui_text","z":"641a7946.ecd3e8","group":"9d7c6798.9fc5e8","order":6,"width":"0","height":"0","name":"","label":"PM2.5訊息","format":"{{msg.payload}}","layout":"row-center","x":710,"y":540,"wires":[]},{"id":"bc465b0c.194938","type":"function","z":"641a7946.ecd3e8","name":"PM2.5資料","func":"var s= context.global.school ;\n\nmsg.payload=[s,msg.PM25,msg.PublishTime];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":310,"y":160,"wires":[["c7b3dbcf.074cd8"]]},{"id":"a403219a.298cc","type":"inject","z":"641a7946.ecd3e8","name":"Click","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"7200","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":540,"wires":[["818e0e8a.dd2b7"]]},{"id":"648674fa.217e4c","type":"ui_switch","z":"641a7946.ecd3e8","name":"","label":"啟動資料庫開關","tooltip":"","group":"9d7c6798.9fc5e8","order":61,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":100,"y":500,"wires":[["818e0e8a.dd2b7"]]},{"id":"57148a2e.67da14","type":"ui_dropdown","z":"641a7946.ecd3e8","name":"","label":"學校","tooltip":"","place":"請選擇","group":"9d7c6798.9fc5e8","order":0,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"雙十國中","value":"0","type":"str"},{"label":"東山高中","value":"1","type":"str"},{"label":"立新國中","value":"2","type":"str"},{"label":"大里高中","value":"3","type":"str"},{"label":"光德國中","value":"4","type":"str"},{"label":"和平國中","value":"5","type":"str"},{"label":"新社高中","value":"6","type":"str"},{"label":"神圳國中","value":"7","type":"str"},{"label":"大道國中","value":"8","type":"str"},{"label":"公明國中","value":"9","type":"str"},{"label":"清水高中","value":"10","type":"str"}],"payload":"","topic":"","x":350,"y":460,"wires":[["74fb744e.cdd70c"]]},{"id":"16389b5e.20d185","type":"inject","z":"641a7946.ecd3e8","name":"inject school  options","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"7200","crontab":"","once":false,"onceDelay":"","topic":"","payload":"","payloadType":"date","x":140,"y":460,"wires":[["57148a2e.67da14","818e0e8a.dd2b7"]]},{"id":"9f3f3518.97af48","type":"debug","z":"641a7946.ecd3e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":350,"y":360,"wires":[]},{"id":"74fb744e.cdd70c","type":"function","z":"641a7946.ecd3e8","name":" number to name","func":"\nvar name=msg.payload;\nvar school=' ';\n\ntry {\n    \n   if(name== '0' )\n    {\n        school= '雙十國中';\n    }\n    \n    else if(name== '1' )\n    {\n        school= '東山高中';\n    }\n    \n     else if(name== '2' )\n    {\n        school= '立新國中';\n    }\n    else if(name== '3' )\n    {\n        school= '大里高中';\n    }\n    \n     else if(name== '4' )\n    {\n        school= '光德國中';\n    }\n    else if(name== '5' )\n    {\n        school= '和平國中';\n    }\n    \n     else if(name== '6' )\n    {\n        school= '新社高中';\n    }\n    else if(name== '7' )\n    {\n        school= '神圳國中';\n    }\n    \n     else if(name== '8' )\n    {\n        school= '大道國中';\n    }\n    else if(name== '9' )\n    {\n        school= '公明國中';\n    }\n    \n     else if(name== '10' )\n    {\n        school= '清水高中';\n    }\n\nelse  \n{\n     school= '大里高中';\n   \n}\n   \n   \n}\n\ncatch(err) {\n    school=\"大里高中\";\n}\n\n\n msg.payload= school;\n context.global.school=msg.payload;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":180,"y":320,"wires":[["9f3f3518.97af48","94438361.32252"]]},{"id":"9d7c6798.9fc5e8","type":"ui_group","name":"台中PM2.5","tab":"89e51ea1.a64af","order":1,"disp":true,"width":"6","collapse":false},{"id":"7a14aca8.b15994","type":"json-db-collection","name":"DATA_PM25","collection":"DATA","save":false},{"id":"89e51ea1.a64af","type":"ui_tab","name":"Dashboard","icon":"dashboard"}]

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

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