2020年11月22日 星期日

如何取得空氣品質指標(AQI)的 資料-2

 如何取得空氣品質指標(AQI)的 資料-2


1.把網址複製下來
http://opendata.epa.gov.tw/webapi/Data/REWIQA/?$orderby=SiteName&$skip=0&$top=1000&format=json










[{"id":"dc90cfbe.e2b6","type":"inject","z":"43607cdf.baa3c4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"20","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":140,"y":100,"wires":[["dad3bb72.537b98"]]},{"id":"dad3bb72.537b98","type":"http request","z":"43607cdf.baa3c4","name":"PM2.5網頁","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://opendata.epa.gov.tw/webapi/Data/REWIQA/?$orderby=SiteName&$skip=0&$top=1000&format=json","tls":"","persist":false,"proxy":"","authType":"","x":310,"y":100,"wires":[["d12c35f2.583118","4f03b293.3286dc"]]},{"id":"4f03b293.3286dc","type":"function","z":"43607cdf.baa3c4","name":"設定地區","func":"//var a = msg.payload;\n\n//Array.from(a).forEach (function(e,i){\n //   if(e.SiteName=='大里'){\n   //     msg.PM251 =  Number(e['PM2.5']) ;\n   //     msg.AQI1 =  e['AQI'] ;\n//        msg.Status1 = e['Status'] ;\n  //      msg.PublishTime1 = e['PublishTime'] ;\n //  }\n//} );\n//return msg;\n\nvar a = msg.payload;\n a.forEach(function(e,i){\n    if(e.SiteName=='大里'){\n        msg.PM25 = e['PM2.5'];\n        msg.AQI =  e['AQI'] ;\n        msg.Status = e['Status'] ;\n        msg.PublishTime = e['PublishTime'] ;\n    } \n});\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":490,"y":260,"wires":[["8e42bc6a.2a973","966d2b54.0d01a8","c1b4d57c.161ad8","ce923dca.5b23","3a6efb72.b33a94"]]},{"id":"4b6bd135.05a34","type":"comment","z":"43607cdf.baa3c4","name":"台灣空氣品質狀況","info":"","x":140,"y":60,"wires":[]},{"id":"b60b259.2ab8cd8","type":"ui_gauge","z":"43607cdf.baa3c4","name":"","group":"5b49355a.5225bc","order":0,"width":"6","height":"3","gtype":"gage","title":"PM2.5 [0..35] 良好","label":"units","format":"{{value}}","min":0,"max":"80","colors":["#00b500","#e6e600","#ca3838"],"seg1":"35","seg2":"53","x":910,"y":240,"wires":[],"inputLabels":["msg.PM25"]},{"id":"b1fe3fad.6b864","type":"ui_text","z":"43607cdf.baa3c4","group":"5b49355a.5225bc","order":0,"width":"6","height":"2","name":"","label":"空氣品質","format":"{{msg.payload}}","layout":"row-spread","x":880,"y":360,"wires":[],"inputLabels":["msg.payload"]},{"id":"8e42bc6a.2a973","type":"function","z":"43607cdf.baa3c4","name":"PM2.5 [0..80]","func":"msg.payload=msg.PM25;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":700,"y":240,"wires":[["b60b259.2ab8cd8","fb753537.724298"]]},{"id":"966d2b54.0d01a8","type":"function","z":"43607cdf.baa3c4","name":"AQI [0..400]","func":"msg.payload= msg.AQI;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":690,"y":300,"wires":[["ea3227e4.5147a8"]]},{"id":"ea3227e4.5147a8","type":"ui_gauge","z":"43607cdf.baa3c4","name":"","group":"5b49355a.5225bc","order":0,"width":"6","height":"3","gtype":"gage","title":"AQI [0..50] 良好","label":"units","format":"{{value}}","min":0,"max":"400","colors":["#00b500","#e6e600","#ca3838"],"seg1":"50","seg2":"100","x":900,"y":300,"wires":[],"inputLabels":["msg.PM25"]},{"id":"c1b4d57c.161ad8","type":"function","z":"43607cdf.baa3c4","name":"Status","func":"msg.payload=msg.Status;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":670,"y":360,"wires":[["b1fe3fad.6b864"]]},{"id":"ce923dca.5b23","type":"function","z":"43607cdf.baa3c4","name":"PublishTime","func":"msg.payload=msg.PublishTime;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":690,"y":420,"wires":[["c17d919c.f57f8"]]},{"id":"c17d919c.f57f8","type":"ui_text","z":"43607cdf.baa3c4","group":"5b49355a.5225bc","order":0,"width":"6","height":"3","name":"","label":"發表時間","format":"{{msg.payload}}","layout":"row-spread","x":880,"y":420,"wires":[],"inputLabels":["msg.payload"]},{"id":"d12c35f2.583118","type":"debug","z":"43607cdf.baa3c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":510,"y":80,"wires":[]},{"id":"fb753537.724298","type":"debug","z":"43607cdf.baa3c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":900,"y":180,"wires":[]},{"id":"3a6efb72.b33a94","type":"debug","z":"43607cdf.baa3c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":180,"wires":[]},{"id":"5b49355a.5225bc","type":"ui_group","z":"","name":"空氣品質狀況","tab":"bf5462b1.4d02a","order":1,"disp":true,"width":"6","collapse":false},{"id":"bf5462b1.4d02a","type":"ui_tab","z":"","name":"Weather","icon":"dashboard","order":1}]




沒有留言:

張貼留言

2024_09 作業3 以Node-Red 為主

 2024_09 作業3  (以Node-Red 為主  Arduino 可能需要配合修改 ) Arduino 可能需要修改的部分 1)mqtt broker  2) 主題Topic (發行 接收) 3) WIFI ssid , password const char br...