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"}]

沒有留言:

張貼留言

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

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