一般天氣預報-今明36小時天氣預報
http://opendata.cwb.gov.tw/govdownload?dataid=F-C0032-001&authorizationkey=rdec-key-123-45678-011121314
參考來源
博客來-物聯網實作:Node-RED萬物聯網視覺化
資料集類型 | rawData |
---|
資料集描述 | 臺灣各縣市今明36小時天氣預報預報-今明36小時天氣預報 |
---|
主要欄位說明 | Wx(天氣現象)、MaxT(最高溫度)、MinT(最低溫度)、CI(舒適度)、PoP(降雨機率) |
---|
資料集提供機關 | 中央氣象局 |
---|
更新頻率 | 每6小時 |
---|
授權方式 | 政府資料開放授權條款-第1版 |
---|
授權說明網址 | http://data.gov.tw/license |
---|
[{"id":"75602f71.fa211","type":"http request","z":"37beda4f.c0b9b6","name":"temp request","method":"GET","ret":"txt","url":"http://opendata.cwb.gov.tw/govdownload?dataid=F-C0032-001&authorizationkey=rdec-key-123-45678-011121314","tls":"","x":290,"y":60,"wires":[["b730a4d3.4c40f8","a961f8af.aa1828"]]},{"id":"abd15c05.e4534","type":"inject","z":"37beda4f.c0b9b6","name":"","topic":"","payload":"","payloadType":"date","repeat":"7200","crontab":"","once":false,"x":110,"y":60,"wires":[["75602f71.fa211"]]},{"id":"b730a4d3.4c40f8","type":"debug","z":"37beda4f.c0b9b6","name":"temp request result","active":true,"console":"false","complete":"payload","x":489,"y":42,"wires":[]},{"id":"2312ea80.c326f6","type":"debug","z":"37beda4f.c0b9b6","name":"xml to json","active":true,"console":"false","complete":"payload","x":585,"y":76,"wires":[]},{"id":"dddad094.13cd7","type":"function","z":"37beda4f.c0b9b6","name":"set global temp","func":"\nflow.set(\"tempera\",msg.payload);\nreturn msg;\n\n//flow.set('YourVariable', value); // to store a variable (YourVariable)\n//var x = flow.get('YourVariable'); //to retrieve a variable (YourVariable)","outputs":1,"noerr":0,"x":600,"y":120,"wires":[["c2e73742.4ec328"]]},{"id":"a961f8af.aa1828","type":"xml","z":"37beda4f.c0b9b6","name":"","property":"payload","attr":"","chr":"","x":438,"y":100,"wires":[["dddad094.13cd7","2312ea80.c326f6"]]},{"id":"2ee796b5.8a225a","type":"http in","z":"37beda4f.c0b9b6","name":"city","url":"/city","method":"get","upload":false,"swaggerDoc":"","x":84,"y":347,"wires":[["f7faac86.6969e"]]},{"id":"9a2dd23b.bdd2","type":"http response","z":"37beda4f.c0b9b6","name":"http out","x":606,"y":347,"wires":[]},{"id":"f7faac86.6969e","type":"function","z":"37beda4f.c0b9b6","name":"city name to number","func":"\nvar rawdata = flow.get(\"tempera\");\n\n//context.global.locationnumber=0;\nflow.set(\"locationnumber\",0);\ntry {\n cityname=msg.payload.cityname;\n \n if(cityname.indexOf('台北')!=-1 ||cityname.indexOf('臺北')!=-1 )\n{\n //context.global.locationnumber=0;\n flow.set(\"locationnumber\",0);\n \n}\nelse if(cityname.indexOf('新北')!=-1)\n{\n //context.global.locationnumber=1;\n flow.set(\"locationnumber\",1);\n}\nelse if(cityname.indexOf('桃園')!=-1) //\n{\n //context.global.locationnumber=2;\n flow.set(\"locationnumber\",2);\n}\nelse if(cityname.indexOf('臺中')!=-1 || cityname.indexOf('台中')!=-1) \n{\n //context.global.locationnumber= 3;\n flow.set(\"locationnumber\",3);\n}\nelse if(cityname.indexOf('臺南')!=-1 || cityname.indexOf('台南')!=-1) \n{\n //context.global.locationnumber= 4;\n flow.set(\"locationnumber\",4);\n \n}\nelse if(cityname.indexOf('高雄')!=-1 ) \n{\n //context.global.locationnumber= 5 ;\n flow.set(\"locationnumber\",5);\n \n}\nelse if(cityname.indexOf('基隆')!=-1 ) \n{\n //context.global.locationnumber= 6 ;\n flow.set(\"locationnumber\",6);\n}\nelse if(cityname.indexOf('新竹縣')!=-1 ) \n{\n //context.global.locationnumber= 7 ;\n flow.set(\"locationnumber\",7);\n}\nelse if(cityname.indexOf('新竹')!=-1 ) \n{\n //context.global.locationnumber= 8 ;\n flow.set(\"locationnumber\",8);\n}\nelse if(cityname.indexOf('新竹')!=-1 ) \n{\n //context.global.locationnumber= 8 ;\n flow.set(\"locationnumber\",8);\n}\nelse if(cityname.indexOf('苗栗')!=-1 ) \n{\n //context.global.locationnumber= 9 ;\n flow.set(\"locationnumber\",9);\n}\nelse if(cityname.indexOf('彰化')!=-1 ) \n{\n flow.set(\"locationnumber\",10);\n}\nelse if(cityname.indexOf('南投')!=-1 ) \n{\n flow.set(\"locationnumber\",11);\n}\nelse if(cityname.indexOf('雲林')!=-1 ) \n{\n flow.set(\"locationnumber\",12);\n}\nelse if(cityname.indexOf('嘉義縣')!=-1 ) \n{\n flow.set(\"locationnumber\",13);\n}\nelse if(cityname.indexOf('嘉義市')!=-1 ) \n{\n flow.set(\"locationnumber\",14);\n}\nelse if(cityname.indexOf('屏東')!=-1 ) \n{\n flow.set(\"locationnumber\",15);\n}\nelse if(cityname.indexOf('宜蘭')!=-1 ) \n{\n flow.set(\"locationnumber\",16);\n}\nelse if(cityname.indexOf('宜蘭')!=-1 ) \n{\n flow.set(\"locationnumber\",16);\n}\nelse if(cityname.indexOf('花蓮')!=-1 ) \n{\n flow.set(\"locationnumber\",17);\n}\nelse if(cityname.indexOf('臺東')!=-1 || cityname.indexOf('台東')!=-1)\n{\n flow.set(\"locationnumber\",18);\n}\nelse if(cityname.indexOf('澎湖')!=-1 ) \n{\n flow.set(\"locationnumber\",19);\n}\nelse if(cityname.indexOf('金門')!=-1 ) \n{\n flow.set(\"locationnumber\",20);\n}\nelse if(cityname.indexOf('連江')!=-1 ) \n{\n //context.global.locationnumber= 21 ;\n flow.set(\"locationnumber\",21);\n}\nelse \n{\n // context.global.locationnumber= 0 ;\n flow.set(\"locationnumber\",0);\n}\n \n \n}\ncatch(err) {\n cityname=\"台北\";\n //context.global.locationnumber=0;\n flow.set(\"locationnumber\",0);\n}\n\nmsg.payload= flow.get(\"locationnumber\");\nreturn msg;\n","outputs":1,"noerr":0,"x":264,"y":347,"wires":[["2c8b4a83.8b7a86","4bdb0698.ce5678"]]},{"id":"2c8b4a83.8b7a86","type":"debug","z":"37beda4f.c0b9b6","name":"city name to number result","active":true,"console":"false","complete":"payload","x":520,"y":296,"wires":[]},{"id":"1ee7ff8c.0e007","type":"http in","z":"37beda4f.c0b9b6","name":"tempjson","url":"/tempjson","method":"get","upload":false,"swaggerDoc":"","x":80,"y":160,"wires":[["7c1885a3.c076fc"]]},{"id":"b3616b02.682d08","type":"http response","z":"37beda4f.c0b9b6","name":"http out","x":460,"y":160,"wires":[]},{"id":"7c1885a3.c076fc","type":"function","z":"37beda4f.c0b9b6","name":"show raw data","func":"//flow.set('YourVariable', value); // to store a variable (YourVariable)\n//var x = flow.get('YourVariable'); //to retrieve a variable (YourVariable)\n\n\n\n\n//var loc=msg.payload.loc;\n\nvar rawdata = flow.get(\"tempera\");\nmsg.payload = rawdata;\nreturn msg;\n\n//msg.playload=rawdata;\n//.cwbopendata.dataset[0].location;\n\n\n/*\nvar locationName=rawdata.cwbopendata.dataset[0].location[loc].locationName[0];\nvar period0max=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[0].parameter[0].parameterName[0];\nvar period0min=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[2].time[0].parameter[0].parameterName[0];\nvar period0start=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[0].startTime[0];\nvar period0end=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[0].endTime[0];\n\nvar starthourtemp= period0start.split(\"T\");\nvar starthour=starthourtemp[1].split(\":\")[0];\nvar endhourtemp= period0end.split(\"T\");\nvar endhour=endhourtemp[1].split(\":\")[0];\n\nmsg.payload={\"locationName\":locationName,\"time\":starthour+\"-\"+endhour, \"max\":period0max,\n\"min\":period0min};\nreturn msg;\n*/\n\n/*if(time.getHours()<18)\n{\nmsg.payload={\"locationName\":locationName,\"todaymax\":period1max, \"todaymin\":period1min,\n \"tonightmax\":period2max, \"tonightmin\":period2min,\"tomorrowmax\":period3max, \"tomorrowmin\":period3min};\n}\nelse\nmsg.payload={\"locationName\":locationName,\"tonightmax\":period1max, \"tonightmin\":period1min,\n \"todaymax\":period2max, \"tonightmin\":period2min,\"tomorrowmax\":period3max, \"tomorrowmin\":period3min};\n}\n\n*/\n\n\n\n\n//msg.payload=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[1];\n\n\n\n\n","outputs":1,"noerr":0,"x":260,"y":160,"wires":[["b3616b02.682d08","376599f1.00bc46"]]},{"id":"376599f1.00bc46","type":"debug","z":"37beda4f.c0b9b6","name":"temp data process","active":true,"console":"false","complete":"payload","x":470,"y":200,"wires":[]},{"id":"b7cea5f9.af6988","type":"function","z":"37beda4f.c0b9b6","name":"List locationname","func":"//var rawdata=context.global.temp;\nvar rawdata = flow.get(\"tempera\");\n//flow.set(\"loname\",rawdata.cwbopendata.dataset[0].location.locationName);\nvar location=rawdata.cwbopendata.dataset[0].location;\nvar citynumber=location.length;\nvar cityarray=[];\nvar i;\nfor (i=0; i<citynumber;i++)\n{\ncityarray[i]=location[i].locationName[0];\n}\n\n msg.payload=cityarray;\nflow.set(\"loname\",cityarray);\nreturn msg;\n\n/*\nvar locationName=rawdata.cwbopendata.dataset[0].location[loc].locationName[0];\nvar period0max=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[0].parameter[0].parameterName[0];\nvar period0min=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[2].time[0].parameter[0].parameterName[0];\nvar period0start=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[0].startTime[0];\nvar period0end=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[0].endTime[0];\n\nvar starthourtemp= period0start.split(\"T\");\nvar starthour=starthourtemp[1].split(\":\")[0];\nvar endhourtemp= period0end.split(\"T\");\nvar endhour=endhourtemp[1].split(\":\")[0];\n\nmsg.payload={\"locationName\":locationName,\"time\":starthour+\"-\"+endhour, \"max\":period0max,\n\"min\":period0min};\nreturn msg;\n*/\n\n/*if(time.getHours()<18)\n{\nmsg.payload={\"locationName\":locationName,\"todaymax\":period1max, \"todaymin\":period1min,\n \"tonightmax\":period2max, \"tonightmin\":period2min,\"tomorrowmax\":period3max, \"tomorrowmin\":period3min};\n}\nelse\nmsg.payload={\"locationName\":locationName,\"tonightmax\":period1max, \"tonightmin\":period1min,\n \"todaymax\":period2max, \"tonightmin\":period2min,\"tomorrowmax\":period3max, \"tomorrowmin\":period3min};\n}\n\n*/\n\n\n\n\n//msg.payload=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[1];\n\n\n\n\n","outputs":1,"noerr":0,"x":308,"y":255,"wires":[["b018b861.b76f68"]]},{"id":"b018b861.b76f68","type":"debug","z":"37beda4f.c0b9b6","name":"List all locationnames ","active":true,"console":"false","complete":"payload","x":527,"y":255,"wires":[]},{"id":"4bdb0698.ce5678","type":"function","z":"37beda4f.c0b9b6","name":"max min","func":"var loc=msg.payload;\nvar rawdata = flow.get(\"tempera\");\nvar locationName=rawdata.cwbopendata.dataset[0].location[loc].locationName[0];\nvar period0max=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[0].parameter[0].parameterName[0];\nvar period0min=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[2].time[0].parameter[0].parameterName[0];\nvar period0start=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[0].startTime[0];\nvar period0end=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[0].endTime[0];\n\nvar starthourtemp= period0start.split(\"T\");\nvar starthour=starthourtemp[1].split(\":\")[0];\nvar endhourtemp= period0end.split(\"T\");\nvar endhour=endhourtemp[1].split(\":\")[0];\n\nmsg.payload={\"locationName\":locationName,\"time\":starthour+\"-\"+endhour, \"max\":period0max,\n\"min\":period0min};\nreturn msg;\n\n/*if(time.getHours()<18)\n{\nmsg.payload={\"locationName\":locationName,\"todaymax\":period1max, \"todaymin\":period1min,\n \"tonightmax\":period2max, \"tonightmin\":period2min,\"tomorrowmax\":period3max, \"tomorrowmin\":period3min};\n}\nelse\nmsg.payload={\"locationName\":locationName,\"tonightmax\":period1max, \"tonightmin\":period1min,\n \"todaymax\":period2max, \"tonightmin\":period2min,\"tomorrowmax\":period3max, \"tomorrowmin\":period3min};\n}\n\n*/\n\n\n\n\n//msg.payload=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[1];\n\n\n\n\n","outputs":1,"noerr":0,"x":462,"y":347,"wires":[["9a2dd23b.bdd2"]]},{"id":"319bfd95.7ee132","type":"debug","z":"37beda4f.c0b9b6","name":"report result","active":true,"console":"false","complete":"payload","x":670,"y":460,"wires":[]},{"id":"8a4cd7e0.8dd6a8","type":"inject","z":"37beda4f.c0b9b6","name":"inject city options","topic":"","payload":"","payloadType":"date","repeat":"7200","crontab":"","once":false,"x":130,"y":420,"wires":[["436ad80.bf7ed28"]]},{"id":"436ad80.bf7ed28","type":"function","z":"37beda4f.c0b9b6","name":"set options","func":"var rawdata = flow.get(\"tempera\");\nvar location=rawdata.cwbopendata.dataset[0].location;\nvar citynumber=location.length;\nvar i;\n\nvar cityarray=[];\nfor (i=0; i<citynumber;i++)\n{\ncityarray[i]=location[i].locationName[0];\n\n\n}\nmsg.options=cityarray;\nreturn msg;\n\n/*\nvar locationName=rawdata.cwbopendata.dataset[0].location[loc].locationName[0];\nvar period0max=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[0].parameter[0].parameterName[0];\nvar period0min=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[2].time[0].parameter[0].parameterName[0];\nvar period0start=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[0].startTime[0];\nvar period0end=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[0].endTime[0];\n\nvar starthourtemp= period0start.split(\"T\");\nvar starthour=starthourtemp[1].split(\":\")[0];\nvar endhourtemp= period0end.split(\"T\");\nvar endhour=endhourtemp[1].split(\":\")[0];\n\nmsg.payload={\"locationName\":locationName,\"time\":starthour+\"-\"+endhour, \"max\":period0max,\n\"min\":period0min};\nreturn msg;\n*/\n\n/*if(time.getHours()<18)\n{\nmsg.payload={\"locationName\":locationName,\"todaymax\":period1max, \"todaymin\":period1min,\n \"tonightmax\":period2max, \"tonightmin\":period2min,\"tomorrowmax\":period3max, \"tomorrowmin\":period3min};\n}\nelse\nmsg.payload={\"locationName\":locationName,\"tonightmax\":period1max, \"tonightmin\":period1min,\n \"todaymax\":period2max, \"tonightmin\":period2min,\"tomorrowmax\":period3max, \"tomorrowmin\":period3min};\n}\n\n*/\n\n\n\n\n//msg.payload=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[1];\n\n\n\n\n","outputs":1,"noerr":0,"x":310,"y":420,"wires":[["d70cb19e.ce9ba","974bb21a.bf192"]]},{"id":"70058bfd.8f6724","type":"inject","z":"37beda4f.c0b9b6","name":"inject city","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":108,"y":255,"wires":[["b7cea5f9.af6988"]]},{"id":"106060c9.96982f","type":"function","z":"37beda4f.c0b9b6","name":"city to number","func":"\nvar cityname;\ncontext.global.locationnumber=0;\ntry {\n cityname=msg.payload;\n \n if(cityname.indexOf('台北')!=-1 ||cityname.indexOf('臺北')!=-1 )\n{\n context.global.locationnumber=0;\n \n}\nelse if(cityname.indexOf('新北')!=-1)\n{\n context.global.locationnumber=1;\n \n}\nelse if(cityname.indexOf('桃園')!=-1) //\n{\n context.global.locationnumber=2;\n \n}\nelse if(cityname.indexOf('臺中')!=-1 || cityname.indexOf('台中')!=-1) \n{\n context.global.locationnumber= 3;\n \n}\nelse if(cityname.indexOf('臺南')!=-1 || cityname.indexOf('台南')!=-1) \n{\n context.global.locationnumber= 4;\n \n}\nelse if(cityname.indexOf('高雄')!=-1 ) \n{\n context.global.locationnumber= 5 ;\n \n}\nelse if(cityname.indexOf('基隆')!=-1 ) \n{\n context.global.locationnumber= 6 ;\n \n}\nelse if(cityname.indexOf('新竹縣')!=-1 ) \n{\n context.global.locationnumber= 7 ;\n \n}\nelse if(cityname.indexOf('新竹')!=-1 ) \n{\n context.global.locationnumber= 8 ;\n \n}\nelse if(cityname.indexOf('連江')!=-1 ) \n{\n context.global.locationnumber= 21 ;\n \n}\nelse \n{\n context.global.locationnumber= 0 ;\n \n}\n \n \n}\ncatch(err) {\n cityname=\"台北\";\n context.global.locationnumber=0;\n}\n\n\n msg.payload= context.global.locationnumber;\nreturn msg;\n","outputs":1,"noerr":0,"x":320,"y":560,"wires":[[]]},{"id":"b0a95da1.e863e","type":"function","z":"37beda4f.c0b9b6","name":"report","func":"var loc=msg.payload;\n//var rawdata=context.global.temp;\nvar rawdata = flow.get(\"tempera\");\nvar locationName=rawdata.cwbopendata.dataset[0].location[loc].locationName[0];\nvar period0max=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[0].parameter[0].parameterName[0];\nvar period0min=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[2].time[0].parameter[0].parameterName[0];\nvar period0start=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[0].startTime[0];\nvar period0end=rawdata.cwbopendata.dataset[0].location[loc].weatherElement[1].time[0].endTime[0];\n\nvar starthourtemp= period0start.split(\"T\");\nvar starthour=starthourtemp[1].split(\":\")[0];\nvar endhourtemp= period0end.split(\"T\");\nvar endhour=endhourtemp[1].split(\":\")[0];\n\nmsg.payload=locationName+starthour+\"到\"+endhour+\"點溫度最低\"+period0min+\"度最高\"+period0max+\"度\";\nreturn msg;\n","outputs":1,"noerr":0,"x":510,"y":500,"wires":[["319bfd95.7ee132","ed8f6bef.e99c48"]]},{"id":"a8f73410.d3bb28","type":"debug","z":"37beda4f.c0b9b6","name":"selected city ","active":true,"tosidebar":true,"console":false,"complete":"payload","x":670,"y":420,"wires":[]},{"id":"d70cb19e.ce9ba","type":"ui_dropdown","z":"37beda4f.c0b9b6","name":"","label":"city options","tooltip":"","place":"Select city","group":"11aebcbd.bc7383","order":0,"width":0,"height":0,"passthru":true,"multiple":true,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":490,"y":420,"wires":[["a8f73410.d3bb28","8d19ea05.fe1fd8"]]},{"id":"ed8f6bef.e99c48","type":"ui_text","z":"37beda4f.c0b9b6","group":"11aebcbd.bc7383","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"row-spread","x":650,"y":520,"wires":[]},{"id":"c2e73742.4ec328","type":"debug","z":"37beda4f.c0b9b6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":120,"wires":[]},{"id":"974bb21a.bf192","type":"debug","z":"37beda4f.c0b9b6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"options","targetType":"msg","x":490,"y":380,"wires":[]},{"id":"8d19ea05.fe1fd8","type":"function","z":"37beda4f.c0b9b6","name":"city name to number","func":"\nvar rawdata = flow.get(\"tempera\");\n\n//context.global.locationnumber=0;\nflow.set(\"locationnumber\",0);\ntry {\n cityname=msg.payload;\n \n if(cityname.indexOf('台北市市')!=-1 ||cityname.indexOf('臺北市')!=-1 )\n{\n //context.global.locationnumber=0;\n flow.set(\"locationnumber\",0);\n \n}\nelse if(cityname.indexOf('新北市')!=-1)\n{\n //context.global.locationnumber=1;\n flow.set(\"locationnumber\",1);\n}\nelse if(cityname.indexOf('桃園市')!=-1) //\n{\n //context.global.locationnumber=2;\n flow.set(\"locationnumber\",2);\n}\nelse if(cityname.indexOf('臺中市')!=-1 || cityname.indexOf('台中市')!=-1) \n{\n //context.global.locationnumber= 3;\n flow.set(\"locationnumber\",3);\n}\nelse if(cityname.indexOf('臺南市')!=-1 || cityname.indexOf('台南市')!=-1) \n{\n //context.global.locationnumber= 4;\n flow.set(\"locationnumber\",4);\n \n}\nelse if(cityname.indexOf('高雄市')!=-1 ) \n{\n //context.global.locationnumber= 5 ;\n flow.set(\"locationnumber\",5);\n \n}\nelse if(cityname.indexOf('基隆市')!=-1 ) \n{\n //context.global.locationnumber= 6 ;\n flow.set(\"locationnumber\",6);\n}\nelse if(cityname.indexOf('新竹縣')!=-1 ) \n{\n //context.global.locationnumber= 7 ;\n flow.set(\"locationnumber\",7);\n}\nelse if(cityname.indexOf('新竹市')!=-1 ) \n{\n //context.global.locationnumber= 8 ;\n flow.set(\"locationnumber\",8);\n}\nelse if(cityname.indexOf('苗栗縣')!=-1 ) \n{\n //context.global.locationnumber= 9 ;\n flow.set(\"locationnumber\",9);\n}\nelse if(cityname.indexOf('彰化縣')!=-1 ) \n{\n flow.set(\"locationnumber\",10);\n}\nelse if(cityname.indexOf('南投縣')!=-1 ) \n{\n flow.set(\"locationnumber\",11);\n}\nelse if(cityname.indexOf('雲林縣')!=-1 ) \n{\n flow.set(\"locationnumber\",12);\n}\nelse if(cityname.indexOf('嘉義縣')!=-1 ) \n{\n flow.set(\"locationnumber\",13);\n}\nelse if(cityname.indexOf('嘉義市')!=-1 ) \n{\n flow.set(\"locationnumber\",14);\n}\nelse if(cityname.indexOf('屏東縣')!=-1 ) \n{\n flow.set(\"locationnumber\",15);\n}\nelse if(cityname.indexOf('宜蘭縣')!=-1 ) \n{\n flow.set(\"locationnumber\",16);\n}\nelse if(cityname.indexOf('花蓮縣')!=-1 ) \n{\n flow.set(\"locationnumber\",17);\n}\nelse if(cityname.indexOf('臺東縣')!=-1 || cityname.indexOf('台東縣')!=-1)\n{\n flow.set(\"locationnumber\",18);\n}\nelse if(cityname.indexOf('澎湖縣')!=-1 ) \n{\n flow.set(\"locationnumber\",19);\n}\nelse if(cityname.indexOf('金門縣')!=-1 ) \n{\n flow.set(\"locationnumber\",20);\n}\nelse if(cityname.indexOf('連江')!=-1 ) \n{\n //context.global.locationnumber= 21 ;\n flow.set(\"locationnumber\",21);\n}\nelse \n{\n // context.global.locationnumber= 0 ;\n flow.set(\"locationnumber\",0);\n}\n \n \n}\ncatch(err) {\n cityname=\"台北市\";\n //context.global.locationnumber=0;\n flow.set(\"locationnumber\",0);\n}\n\nmsg.payload= flow.get(\"locationnumber\");\nreturn msg;\n","outputs":1,"noerr":0,"x":320,"y":500,"wires":[["b0a95da1.e863e","20951ce2.e2f074"]]},{"id":"20951ce2.e2f074","type":"debug","z":"37beda4f.c0b9b6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":530,"y":560,"wires":[]},{"id":"11aebcbd.bc7383","type":"ui_group","z":"","name":"City temperature","tab":"dc7935b7.cd8c68","order":1,"disp":true,"width":"6"},{"id":"dc7935b7.cd8c68","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]