Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [{"id":"2086dbaf.474a54","type":"inject","z":"97740c94.63aad","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"x":190,"y":120,"wires":[["a08076a4.7256b8"]]},{"id":"365e693e.1c3eb6","type":"cloudant out","z":"97740c94.63aad","name":"","cloudant":"","database":"coursera","service":"IOT-Asia-cloudantNoSQLDB","payonly":true,"operation":"insert","x":660,"y":120,"wires":[]},{"id":"a08076a4.7256b8","type":"random","z":"97740c94.63aad","name":"","low":"1","high":"10","inte":"true","x":400,"y":120,"wires":[["365e693e.1c3eb6"]]},{"id":"58945ac6.ea5c74","type":"inject","z":"97740c94.63aad","name":"","topic":"","payload":"Hello Node-Red from Dweetio","payloadType":"str","repeat":"600","crontab":"","once":true,"x":190,"y":260,"wires":[["199c0066.dd0b6"]]},{"id":"199c0066.dd0b6","type":"dweetio out","z":"97740c94.63aad","thing":"thingName","name":"","x":580,"y":260,"wires":[]},{"id":"96fe595b.796c58","type":"dweetio in","z":"97740c94.63aad","thing":"thingName","name":"","x":170,"y":300,"wires":[["b0169846.e75038"]]},{"id":"b0169846.e75038","type":"debug","z":"97740c94.63aad","name":"","active":true,"console":"true","complete":"payload","x":560,"y":300,"wires":[]},{"id":"adcd5920.4859a8","type":"openweathermap in","z":"97740c94.63aad","name":"","lon":"","lat":"","city":"Taipei","country":" TW","language":"en","x":210,"y":420,"wires":[["82627dc2.47fb4","8ec533d3.301bc"]]},{"id":"82627dc2.47fb4","type":"debug","z":"97740c94.63aad","name":"","active":true,"console":"false","complete":"false","x":560,"y":380,"wires":[]},{"id":"8ec533d3.301bc","type":"freeboard","z":"97740c94.63aad","name":"freeboard_weather","x":570,"y":420,"wires":[]},{"id":"9d3e2b45.2e9888","type":"freeboard","z":"97740c94.63aad","name":"Freeboardtest","x":640,"y":560,"wires":[]},{"id":"4b328b0a.437db4","type":"inject","z":"97740c94.63aad","name":"Send Random Value","topic":"","payload":"","payloadType":"date","repeat":"5","crontab":"","once":false,"x":240,"y":560,"wires":[["509d88ca.2c7308"]]},{"id":"509d88ca.2c7308","type":"function","z":"97740c94.63aad","name":"","func":"msg.payload={value:Math.floor(Math.random()*100)};\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":560,"wires":[["9d3e2b45.2e9888"]]},{"id":"bd80dee6.fbc37","type":"inject","z":"97740c94.63aad","name":"程式執行的頻率","topic":"","payload":"","payloadType":"date","repeat":"600","crontab":"","once":true,"x":230,"y":700,"wires":[["61c080f7.901ec"]]},{"id":"61c080f7.901ec","type":"http request","z":"97740c94.63aad","name":"英國電力開放式資料","method":"GET","url":"http://realtimeweb-prod.nationalgrid.com/SystemData.aspx","tls":"","x":340,"y":760,"wires":[["612ec589.bccb1c"]]},{"id":"612ec589.bccb1c","type":"function","z":"97740c94.63aad","name":"英國電力附載顯示","func":"// does a simple text extract parse of the http output to provide an\n// object containing the uk power demand, frequency and time\n\nif (~msg.payload.indexOf('<span')) {\n var dem = msg.payload.split('Demand:')[1].split(\"MW\")[0];\n var fre = msg.payload.split('Frequency:')[1].split(\"Hz\")[0];\n// 電力\n\n\n msg.payload = { demand: parseInt(dem.split(\">\")[1].split(\"<\")[0]) };\n msg.payload.demand = parseInt(dem.split(\">\")[1].split(\"<\")[0]);\n msg.payload.frequency = parseFloat(fre.split(\">\")[1].split(\"<\")[0]);\n \n msg2 = {};\n msg2.payload = (msg.payload.frequency >= 50) ? true : false;\n\n return [msg,msg2];\n}\n\nreturn null;","outputs":"2","noerr":0,"x":450,"y":820,"wires":[["8c0800e6.ede6","877d0eb0.214d4"],["cf2912bd.24528"]]},{"id":"8c0800e6.ede6","type":"debug","z":"97740c94.63aad","name":"顯示供電數據","active":true,"console":"false","complete":"payload","x":700,"y":760,"wires":[]},{"id":"cf2912bd.24528","type":"debug","z":"97740c94.63aad","name":"判斷有無超過負荷","active":true,"console":"false","complete":"payload","x":710,"y":880,"wires":[]},{"id":"877d0eb0.214d4","type":"freeboard","z":"97740c94.63aad","name":"Dashboar_UK_Power","x":720,"y":820,"wires":[]},{"id":"1da50fbf.14783","type":"comment","z":"97740c94.63aad","name":"物聯網 資料傳輸測試","info":"test\n","x":210,"y":220,"wires":[]},{"id":"1e17434c.504dbd","type":"comment","z":"97740c94.63aad","name":"IBM IOT 寫入NoSQL 測試","info":"","x":230,"y":80,"wires":[]},{"id":"9f916932.0cbde8","type":"comment","z":"97740c94.63aad","name":"天氣資料顯示","info":"","x":190,"y":380,"wires":[]},{"id":"2d34bb81.987004","type":"comment","z":"97740c94.63aad","name":"簡易物臉網資料顯示","info":"","x":210,"y":660,"wires":[]},{"id":"835be46b.7abe98","type":"ibmiot in","z":"97740c94.63aad","authentication":"boundService","apiKey":"","inputType":"evt","deviceId":"","applicationId":"","deviceType":"+","eventType":"+","commandType":"","format":"json","name":"IBM IoT","service":"registered","allDevices":true,"allApplications":"","allDeviceTypes":true,"allEvents":true,"allCommands":"","allFormats":"","qos":0,"x":170,"y":940,"wires":[["5b636f88.89537"]]},{"id":"5f09b0bb.5423b","type":"ibmiot out","z":"97740c94.63aad","authentication":"boundService","apiKey":"","outputType":"evt","deviceId":"e3353a0a.8bd388","deviceType":"respberryGW","eventCommandType":"stausindicator","format":"json","data":"{}","qos":0,"name":"IBM IoT","service":"registered","x":800,"y":1040,"wires":[]},{"id":"9a2df77f.470cf8","type":"inject","z":"97740c94.63aad","name":"","topic":"","payload":"normal","payloadType":"str","repeat":"","crontab":"","once":false,"x":190,"y":1000,"wires":[["ac03ade7.ab3e4"]]},{"id":"4c51b49d.5a32dc","type":"inject","z":"97740c94.63aad","name":"","topic":"alert","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":190,"y":1080,"wires":[["ac03ade7.ab3e4"]]},{"id":"ac03ade7.ab3e4","type":"function","z":"97740c94.63aad","name":"format message","func":"msg.payload = {\"a\" : { \"indicator\" : msg.payload }}\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":1040,"wires":[["5e86587a.993fa8"]]},{"id":"5e86587a.993fa8","type":"json","z":"97740c94.63aad","name":"","x":570,"y":1040,"wires":[["5f09b0bb.5423b"]]},{"id":"5b636f88.89537","type":"debug","z":"97740c94.63aad","name":"","active":true,"console":"false","complete":"false","x":510,"y":940,"wires":[]},{"id":"a98457e4.91f9c8","type":"debug","z":"97740c94.63aad","name":"","active":true,"console":"false","complete":"false","x":430,"y":1260,"wires":[]},{"id":"4bc3ab16.742e74","type":"dweetio out","z":"97740c94.63aad","thing":"not-very-random-big-string","name":"","x":460,"y":1200,"wires":[]},{"id":"c15c003c.e05ec","type":"dweetio in","z":"97740c94.63aad","thing":"not-very-random-big-string","name":"","x":230,"y":1220,"wires":[["a98457e4.91f9c8"]]},{"id":"4a1f2b62.a147d4","type":"inject","z":"97740c94.63aad","name":"","topic":"Ticktock","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":229,"y":1165,"wires":[["4bc3ab16.742e74"]]},{"id":"b0f341c3.d2526","type":"comment","z":"97740c94.63aad","name":"M2M 測試 使用IBM","info":"","x":210,"y":900,"wires":[]},{"id":"5714334f.0fef6c","type":"comment","z":"97740c94.63aad","name":"M2M 測試 使用 Dweetion","info":"","x":230,"y":1120,"wires":[]},{"id":"f1d4b467.365108","type":"comment","z":"97740c94.63aad","name":"SenseHAT 測試","info":"","x":180,"y":1340,"wires":[]},{"id":"f631f438.74e448","type":"rpi-sensehatsim in","z":"97740c94.63aad","name":"Environment","motion":false,"env":false,"stick":false,"x":170,"y":1380,"wires":[["19fe9419.55ac5c"]]},{"id":"19fe9419.55ac5c","type":"rpi-sensehatsim out","z":"97740c94.63aad","name":"","x":580,"y":1380,"wires":[]},{"id":"dbd2afa6.9e418","type":"comment","z":"97740c94.63aad","name":"Device Simulator with Node RED","info":"","x":230,"y":1540,"wires":[]},{"id":"c449dde5.d7347","type":"mqtt out","z":"97740c94.63aad","name":"Publish to IoT","topic":"iot-2/evt/scanEvent/fmt/json","qos":"","retain":"","broker":"a92f7320.acd05","x":700,"y":1680,"wires":[]},{"id":"67162072.95b1d","type":"inject","z":"97740c94.63aad","name":"Send Message","topic":"","payload":"","payloadType":"num","repeat":"","crontab":"","once":false,"x":200,"y":1680,"wires":[["fad2f4cc.170e58"]]},{"id":"fad2f4cc.170e58","type":"function","z":"97740c94.63aad","name":"Generate Payload","func":"var lat = [ 29.42, 30.26, 32.77, 36.37, 38.62, 39.09, 41.87, 43.03, 44.97, 41.25];\nvar lon = [-98.49,-97.74,-96.79,-94.20,-90.19,-94.57,-87.62,-87.90,-93.26,-95.99];\nvar tmp = (Math.random() * (30 - (-30)) + (-30)).toFixed(1); //random temp from -30.0 to 30.0 degrees\n\nvar idx = context.get('count') || 0;\n\nif( idx > 9 )\n{\n idx = 0; \n}\ncontext.set('count',idx+1); //store next idx for later\n\nmsg.payload = \n {\n \"packageNum\" : \"ABC123456\",\n \"coord\" : \n {\n \"lat\" : lat[idx],\n \"lon\" : lon[idx]\n },\n \"company\" : \"ACME Corporation\",\n \"avgTemp\" : tmp\n };\n\nmsg.payload = JSON.stringify(msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":1680,"wires":[["e026c784.7b60f8","c449dde5.d7347"]]},{"id":"e026c784.7b60f8","type":"debug","z":"97740c94.63aad","name":"","active":true,"console":"false","complete":"false","x":690,"y":1760,"wires":[]},{"id":"da514093.caf1a","type":"comment","z":"97740c94.63aad","name":"Configure Publish to IoT for your environment","info":"1. Double click the 'Publish to IoT' node.\n2. Click the edit icon next to the Server field.\n3. Update the Server name to correspond to your IoT Platform organization.\n `{{your org id}}.messaging.internetofthings.ibmcloud.com`\n\n4. Update the Client ID with your orgainzaiton ID, device type, and device ID:\n `d:{{your org id}}:device_type:device_ID`\n\n5. Click the Security tab.\n6. Set Username to `use-token-auth`.\n7. Set Password to the Auth Token obtained when you created a device in the Watson IoT Platfom.\n8. Click Update and then OK.\n9. In the upper right corner of the Node-RED flow editor, click Deploy. ","x":690,"y":1620,"wires":[]},{"id":"63dd3cc3.21ba94","type":"comment","z":"97740c94.63aad","name":"Inject Node","info":"The Inject node allows you to inject messages into a flow, either by clicking the button on the node, or setting a time interval between injects.","x":170,"y":1580,"wires":[]},{"id":"f3c6f28.57a7c1","type":"comment","z":"97740c94.63aad","name":"傳送脽機變數","info":"","x":200,"y":520,"wires":[]},{"id":"625bc622.0cc078","type":"inject","z":"97740c94.63aad","name":"","topic":"","payload":"Hello There","payloadType":"string","repeat":"","crontab":"","once":false,"x":241,"y":2001,"wires":[["36a55245.91f8ae"]]},{"id":"36a55245.91f8ae","type":"websocket out","z":"97740c94.63aad","name":"","server":"","client":"48e0b65f.e8f958","x":463.99998474121094,"y":2031,"wires":[]},{"id":"d9570200.efcc2","type":"websocket in","z":"97740c94.63aad","name":"","server":"","client":"48e0b65f.e8f958","x":277.40057373046875,"y":2080,"wires":[["6d69ebd9.991454"]]},{"id":"6d69ebd9.991454","type":"debug","z":"97740c94.63aad","name":"","active":true,"console":"false","complete":"false","x":493.99998474121094,"y":2116,"wires":[]},{"id":"a92f7320.acd05","type":"mqtt-broker","z":"97740c94.63aad","broker":"{{orgid}}.messaging.internetofthings.ibmcloud.com","port":"1883","clientid":"d:{{orgid}}:myScanners:scanner001","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":""},{"id":"48e0b65f.e8f958","type":"websocket-client","path":"wss://echo.websocket.org","wholemsg":"false"}]
Advertisement
Add Comment
Please, Sign In to add comment