今天天氣預報 === Node-Red 擷取 open data 即時天氣狀況暨溫濕度 政府開放平台 https://data.gov.tw/dataset/6069 天氣資料網址 : https://opendata.cwb.gov.tw/api/v1/rest/datastore/F-C0032-001?Authorization=rdec-key-123-45678-011121314 ![](https://i.imgur.com/iH6Udw7.png) ## Node-RED 節點設計 ![](https://i.imgur.com/z4LsLCR.png) ### http request 節點內容 > 輸入網址 ![](https://i.imgur.com/mlbXlLz.png) ### json 節點內容 > 格式化json 字串 ![](https://i.imgur.com/VaKeJc4.png) ### Node-RED 備份 ``` [ { "id": "21449beae6ab5af5", "type": "inject", "z": "ffd0fdd72ef3108d", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "Hello World !!", "payloadType": "str", "x": 250, "y": 120, "wires": [ [ "1606f4e1adc2cf94", "e28acfd8eb2d4424" ] ] }, { "id": "1606f4e1adc2cf94", "type": "debug", "z": "ffd0fdd72ef3108d", "name": "debug 1", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 640, "y": 120, "wires": [] }, { "id": "e28acfd8eb2d4424", "type": "http request", "z": "ffd0fdd72ef3108d", "name": "", "method": "GET", "ret": "txt", "paytoqs": "ignore", "url": "https://opendata.cwb.gov.tw/api/v1/rest/datastore/F-C0032-001?Authorization=rdec-key-123-45678-011121314", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 480, "y": 180, "wires": [ [ "c59e6ff35ed7703e", "ef178ad760cffe97" ] ] }, { "id": "c59e6ff35ed7703e", "type": "debug", "z": "ffd0fdd72ef3108d", "name": "debug 2", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 660, "y": 180, "wires": [] }, { "id": "ef178ad760cffe97", "type": "json", "z": "ffd0fdd72ef3108d", "name": "", "property": "payload", "action": "", "pretty": true, "x": 670, "y": 240, "wires": [ [ "7809576cf639e51f", "c1ba744e4c7c2ddd" ] ] }, { "id": "7809576cf639e51f", "type": "debug", "z": "ffd0fdd72ef3108d", "name": "debug 3", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 820, "y": 240, "wires": [] }, { "id": "505cb437f01f069a", "type": "debug", "z": "ffd0fdd72ef3108d", "name": "debug 4", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 980, "y": 300, "wires": [] }, { "id": "c1ba744e4c7c2ddd", "type": "function", "z": "ffd0fdd72ef3108d", "name": "function 1", "func": "obj = JSON.parse(msg.payload);\nreturn obj;", "outputs": 1, "noerr": 1, "initialize": "", "finalize": "", "libs": [], "x": 800, "y": 300, "wires": [ [ "505cb437f01f069a" ] ] } ] ```