Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [{"id":"5eb364fd.329a7c","type":"inject","z":"c44afe1f.e0e35","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":100,"y":80,"wires":[["2bf10541.00a29a"]]},{"id":"2b8e2019.70747","type":"debug","z":"c44afe1f.e0e35","name":"","active":true,"console":"false","complete":"false","x":198.9999771118164,"y":201.9999771118164,"wires":[]},{"id":"2bf10541.00a29a","type":"function","z":"c44afe1f.e0e35","name":"","func":"var sensor = global.get('sensor');\n\nsensor.initialize(11, 4);\nvar readout = sensor.read();\nmsg.topic=\"temp\";\nmsg.payload = { 溫度:readout.temperature.toFixed(2) + \" 度C\" , 濕度:readout.humidity.toFixed(2) + \" %\" };\nconsole.log(msg);\nreturn msg;\n","outputs":1,"noerr":0,"x":159.99998474121094,"y":132.99998092651367,"wires":[["2b8e2019.70747"]]},{"id":"2fcd531d.91fffc","type":"inject","z":"c44afe1f.e0e35","name":"","topic":"","payload":"Hello Node-Red from Dweetio","payloadType":"str","repeat":"600","crontab":"","once":true,"x":370,"y":100,"wires":[["1e1abdea.73d812"]]},{"id":"1e1abdea.73d812","type":"dweetio out","z":"c44afe1f.e0e35","thing":"thingName","name":"","x":760,"y":100,"wires":[]},{"id":"fa0c186d.e81e48","type":"dweetio in","z":"c44afe1f.e0e35","thing":"thingName","name":"","x":370,"y":160,"wires":[["8888a094.dcd41"]]},{"id":"8888a094.dcd41","type":"debug","z":"c44afe1f.e0e35","name":"","active":true,"console":"true","complete":"payload","x":780,"y":160,"wires":[]},{"id":"773637ca.f2b848","type":"comment","z":"c44afe1f.e0e35","name":"物聯網 資料傳輸測試","info":"test\n沒有傳回來\n","x":370,"y":40,"wires":[]},{"id":"f037affa.076b3","type":"mqtt in","z":"c44afe1f.e0e35","name":"","topic":"noderedlecture/sensor","qos":"0","broker":"decfd5f6.07ccf8","x":100,"y":360,"wires":[["13694149.2e7c9f"]]},{"id":"13694149.2e7c9f","type":"json","z":"c44afe1f.e0e35","name":"","x":110,"y":420,"wires":[["d599badb.39eb18"]]},{"id":"d599badb.39eb18","type":"debug","z":"c44afe1f.e0e35","name":"","active":true,"console":"false","complete":"false","x":150,"y":480,"wires":[]},{"id":"a5653a42.ad6058","type":"inject","z":"c44afe1f.e0e35","name":"程式執行的頻率","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":360,"y":360,"wires":[["bb505fb5.ae5fb"]]},{"id":"bb505fb5.ae5fb","type":"http request","z":"c44afe1f.e0e35","name":"英國電力開放式資料","method":"GET","url":"http://realtimeweb-prod.nationalgrid.com/SystemData.aspx","tls":"","x":450,"y":440,"wires":[["15322404.63af4c"]]},{"id":"15322404.63af4c","type":"function","z":"c44afe1f.e0e35","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 = {};\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":545.0000152587891,"y":496,"wires":[["46add411.6f6e0c"],["ea729d73.809c9"]]},{"id":"46add411.6f6e0c","type":"debug","z":"c44afe1f.e0e35","name":"顯示供電數據","active":true,"console":"false","complete":"payload","x":634.9999847412109,"y":354.9999713897705,"wires":[]},{"id":"ea729d73.809c9","type":"debug","z":"c44afe1f.e0e35","name":"判斷有無超過負荷","active":true,"console":"false","complete":"payload","x":810,"y":500,"wires":[]},{"id":"9bd5dbfa.4258c8","type":"comment","z":"c44afe1f.e0e35","name":"從Web的OpenData抓數值下來","info":"","x":400,"y":320,"wires":[]},{"id":"932385c7.944838","type":"inject","z":"c44afe1f.e0e35","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":120,"y":620,"wires":[["845030e4.a9e79"]]},{"id":"87660ea9.2f922","type":"debug","z":"c44afe1f.e0e35","name":"","active":true,"console":"false","complete":"false","x":486.9999771118164,"y":627.9999122619629,"wires":[]},{"id":"845030e4.a9e79","type":"function","z":"c44afe1f.e0e35","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"x":308.00002670288086,"y":623.9998016357422,"wires":[["87660ea9.2f922"]]},{"id":"ecc6ea21.62dc98","type":"comment","z":"c44afe1f.e0e35","name":"LED 閃爍測試","info":"","x":110,"y":740,"wires":[]},{"id":"ab3e4487.d15128","type":"trigger","z":"c44afe1f.e0e35","op1":"1","op2":"0","op1type":"val","op2type":"val","duration":"250","extend":"false","units":"ms","name":"","x":400,"y":880,"wires":[["9fc090d6.e5332","7e3e9479.ff392c"]]},{"id":"9fc090d6.e5332","type":"function","z":"c44afe1f.e0e35","name":"","func":"if (msg.payload == \"off\")\n\tcontext.state = 0;\nif (msg.payload == \"on\")\n\tcontext.state = 1;\n\nif (context.state == 1)\n{\n\tif (msg.payload == 0)\n\t\treturn msg;\n\telse\n\t\treturn;\n}\nelse\n\treturn;","outputs":1,"x":490,"y":980,"wires":[[]]},{"id":"dd916aa9.3bd3d8","type":"switch","z":"c44afe1f.e0e35","name":"","property":"payload","rules":[{"t":"eq","v":"on"},{"t":"eq","v":"off"}],"checkall":"true","outputs":2,"x":181,"y":946,"wires":[["9fc090d6.e5332","ab3e4487.d15128"],["9fc090d6.e5332"]]},{"id":"7e3e9479.ff392c","type":"rpi-gpio out","z":"c44afe1f.e0e35","name":"LED","pin":"12","set":"","level":"0","out":"out","x":643,"y":849,"wires":[]},{"id":"f7fd728.99f939","type":"inject","z":"c44afe1f.e0e35","name":"On","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"x":121,"y":832,"wires":[["dd916aa9.3bd3d8","c080266a.20d938"]]},{"id":"c080266a.20d938","type":"delay","z":"c44afe1f.e0e35","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":275,"y":779,"wires":[["70bf0d7c.a56844"]]},{"id":"70bf0d7c.a56844","type":"change","z":"c44afe1f.e0e35","name":"Switch off","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"x":442,"y":775,"wires":[["dd916aa9.3bd3d8"]]},{"id":"6fd36f79.9b75d","type":"inject","z":"c44afe1f.e0e35","name":"Tick every 5 secs","topic":"test","payload":"","payloadType":"date","repeat":"5","crontab":"","once":true,"x":170,"y":1240,"wires":[["3bfe606c.860f4"]]},{"id":"74fd26cf.b83cc8","type":"websocket out","z":"c44afe1f.e0e35","name":"led","server":"6c64d3ab.053c2c","client":"","x":570,"y":1240,"wires":[]},{"id":"3ceb8678.12330a","type":"http response","z":"c44afe1f.e0e35","name":"","x":550,"y":1180,"wires":[]},{"id":"6070ccd8.23fd84","type":"http in","z":"c44afe1f.e0e35","name":"","url":"/simpleled","method":"get","swaggerDoc":"","x":120,"y":1180,"wires":[["f0341266.9cbd"]]},{"id":"f0341266.9cbd","type":"template","z":"c44afe1f.e0e35","name":"Simple Web Page","field":"payload","fieldType":"msg","format":"html","syntax":"mustache","template":"<!DOCTYPE HTML>\n<html>\n <head>\n <title>simpleled Live Display</title>\n <script type=\"text/javascript\">\n var ws;\n var wsUri = \"ws:\";\n var loc = window.location;\n console.log(loc);\n if (loc.protocol === \"https:\") { wsUri = \"wss:\"; }\n // This needs to point to the web socket in the Node-RED flow\n // ... in this case it's ws/simpleled\n wsUri += \"//\" + loc.host + loc.pathname.replace(\"simpleled\",\"ws/simpleled\");\n\n function wsConnect() {\n console.log(\"connect\",wsUri);\n ws = new WebSocket(wsUri);\n //var line = \"\"; // either uncomment this for a building list of messages\n ws.onmessage = function(msg) {\n var line = \"\"; // or uncomment this to overwrite the existing message\n // parse the incoming message as a JSON object\n var data = msg.data;\n //console.log(data);\n // build the output from the topic and payload parts of the object\n line += \"<p>\"+data+\"</p>\";\n // replace the messages div with the new \"line\"\n document.getElementById('messages').innerHTML = line;\n //ws.send(JSON.stringify({data:data}));\n }\n ws.onopen = function() {\n // update the status div with the connection status\n document.getElementById('status').innerHTML = \"connected\";\n //ws.send(\"Open for data\");\n console.log(\"connected\");\n }\n ws.onclose = function() {\n // update the status div with the connection status\n document.getElementById('status').innerHTML = \"not connected\";\n // in case of lost connection tries to reconnect every 3 secs\n setTimeout(wsConnect,3000);\n }\n }\n \n function doit(m) {\n if (ws) { ws.send(m); }\n }\n </script>\n </head>\n <body onload=\"wsConnect();\" onunload=\"ws.disconnect();\">\n <font face=\"Arial\">\n <h1>simpleled Live Display</h1>\n <div id=\"messages\"></div>\n <button type=\"button\" onclick='doit(\"on\");'>Click to send message</button>\n <hr/>\n <div id=\"status\">unknown</div>\n </font>\n </body>\n</html>\n","x":350,"y":1180,"wires":[["3ceb8678.12330a"]]},{"id":"3bfe606c.860f4","type":"function","z":"c44afe1f.e0e35","name":"format time nicely","func":"msg.payload = Date(msg.payload).toString();\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":1240,"wires":[["74fd26cf.b83cc8"]]},{"id":"c8e00b14.7fa388","type":"websocket in","z":"c44afe1f.e0e35","name":"","server":"6c64d3ab.053c2c","client":"","x":390,"y":1300,"wires":[["f97098d7.db89f8","82092555.c3ef68","f2706bcb.634708"]]},{"id":"f97098d7.db89f8","type":"debug","z":"c44afe1f.e0e35","name":"","active":true,"console":"false","complete":"false","x":610,"y":1300,"wires":[]},{"id":"c1dbf511.dec778","type":"trigger","z":"c44afe1f.e0e35","op1":"1","op2":"0","op1type":"val","op2type":"val","duration":"250","extend":"false","units":"ms","name":"","x":760,"y":1460,"wires":[["57645ae0.4f4db4","e6122776.4dc1d8"]]},{"id":"57645ae0.4f4db4","type":"function","z":"c44afe1f.e0e35","name":"","func":"if (msg.payload == \"off\")\n\tcontext.state = 0;\nif (msg.payload == \"on\")\n\tcontext.state = 1;\n\nif (context.state == 1)\n{\n\tif (msg.payload == 0)\n\t\treturn msg;\n\telse\n\t\treturn;\n}\nelse\n\treturn;","outputs":1,"x":876,"y":1610,"wires":[["509aeb7c.2ca004"]]},{"id":"509aeb7c.2ca004","type":"delay","z":"c44afe1f.e0e35","name":"","pauseType":"delay","timeout":"250","timeoutUnits":"milliseconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1104,"y":1611,"wires":[["c1dbf511.dec778"]]},{"id":"f2706bcb.634708","type":"switch","z":"c44afe1f.e0e35","name":"","property":"payload","rules":[{"t":"eq","v":"on"},{"t":"eq","v":"off"}],"checkall":"true","outputs":2,"x":541,"y":1526,"wires":[["57645ae0.4f4db4","c1dbf511.dec778"],["57645ae0.4f4db4"]]},{"id":"e6122776.4dc1d8","type":"rpi-gpio out","z":"c44afe1f.e0e35","name":"LED","pin":"12","set":"","level":"0","out":"out","x":1003,"y":1429,"wires":[]},{"id":"82092555.c3ef68","type":"delay","z":"c44afe1f.e0e35","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":635,"y":1359,"wires":[["331f16da.c943fa"]]},{"id":"331f16da.c943fa","type":"change","z":"c44afe1f.e0e35","name":"Switch off","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"x":780,"y":1320,"wires":[["f2706bcb.634708"]]},{"id":"1e928f6a.85a0f1","type":"http in","z":"c44afe1f.e0e35","name":"","url":"/chat","method":"post","x":90,"y":1760,"wires":[["92805c58.f3186"]]},{"id":"e819d5f4.6ecff8","type":"http response","z":"c44afe1f.e0e35","name":"","x":611,"y":1759,"wires":[]},{"id":"246728ab.67cb48","type":"template","z":"c44afe1f.e0e35","name":"","field":"payload","fieldType":"msg","syntax":"mustache","template":"\n <iframe src=\"http://iot.local:1885/dialog\" name=\"iframe_a\" height=\"70%\"></iframe>\n <form name=\"frm\" action=\"http://iot.local:1885/chat\" method=\"post\">\n <b>Message from {{payload}}</b><br>\n <input type=\"text\" name=\"message\" size=\"90%\"/>\n <input type=\"hidden\" name=\"user\" value=\"{{payload}}\"><br>\n <button type=\"submit\">Submit</button>\n </form>\n \n <SCRIPT language=\"JavaScript\">\n window.setInterval(\"reloadIFrame();\", 10000);\n function reloadIFrame() { window.frames[\"iframe_a\"].location.reload(); }\n </SCRIPT>\n","x":437,"y":1759,"wires":[["e819d5f4.6ecff8"]]},{"id":"6d3b845c.78a97c","type":"http in","z":"c44afe1f.e0e35","name":"","url":"/dialog","method":"get","x":93,"y":1820,"wires":[["3a1c0e07.e605f2"]]},{"id":"673c3b37.d59124","type":"http response","z":"c44afe1f.e0e35","name":"","x":611,"y":1820,"wires":[]},{"id":"57f6c6bf.7ac938","type":"template","z":"c44afe1f.e0e35","name":"","field":"payload","fieldType":"msg","syntax":"mustache","template":"{{{payload}}}","x":439,"y":1820,"wires":[["673c3b37.d59124"]]},{"id":"92805c58.f3186","type":"function","z":"c44afe1f.e0e35","name":"","func":" if (msg.req.body[\"user\"] != \"\") {\n msg.payload = msg.req.body[\"user\"]\n }\n if (msg.req.body[\"message\"] != undefined) {\n context.global.dialog += \n msg.req.body[\"user\"]+': '+msg.req.body[\"message\"]+\"<BR>\";\n }\ncontext.global.dialog = context.global.dialog || \"\";\nreturn msg;","outputs":1,"x":260,"y":1759,"wires":[["246728ab.67cb48"]]},{"id":"3a1c0e07.e605f2","type":"function","z":"c44afe1f.e0e35","name":"","func":"msg.payload = context.global.dialog;\nreturn msg;","outputs":1,"x":262,"y":1819,"wires":[["57f6c6bf.7ac938"]]},{"id":"74b8d05f.77d3e","type":"http in","z":"c44afe1f.e0e35","name":"","url":"/login","method":"get","x":91,"y":1664,"wires":[["a9f44920.0e62d8"]]},{"id":"a9f44920.0e62d8","type":"template","z":"c44afe1f.e0e35","name":"","field":"payload","fieldType":"msg","syntax":"mustache","template":"\n <form action=\"http://iot.local:1885/chat\" method=\"post\">\n <b>User</b><br> <input type=\"text\" name=\"user\"/><br>\n <button type=\"submit\">Submit</button>\n </form>","x":251,"y":1664,"wires":[["1a3e5a8.62545a6"]]},{"id":"1a3e5a8.62545a6","type":"http response","z":"c44afe1f.e0e35","name":"","x":409,"y":1664,"wires":[]},{"id":"9c344d6f.356e5","type":"http in","z":"c44afe1f.e0e35","name":"","url":"/mypage","method":"get","x":678,"y":1397,"wires":[["e177286f.2d45c8"]]},{"id":"774833cb.cd1edc","type":"http response","z":"c44afe1f.e0e35","name":"","x":1235,"y":1397,"wires":[]},{"id":"afa4f46e.696338","type":"template","z":"c44afe1f.e0e35","name":"template","field":"payload","template":"This is the <b>message</b>: {{payload}}","x":1087,"y":1397,"wires":[["774833cb.cd1edc"]]},{"id":"e177286f.2d45c8","type":"function","z":"c44afe1f.e0e35","name":"where things happen","func":"if (msg.topic === \"new message\") {\n context.value = msg.payload;\n return null;\n} else {\n msg.payload = context.value || \"never got anything\";\n return msg;\n}","outputs":1,"x":889,"y":1397,"wires":[["afa4f46e.696338"]]},{"id":"8313c666.057488","type":"inject","z":"c44afe1f.e0e35","name":"","topic":"new message","payload":"Have a nice day","payloadType":"string","repeat":"","crontab":"","once":false,"x":850,"y":1220,"wires":[["e177286f.2d45c8"]]},{"id":"fd2ba743.63baa8","type":"comment","z":"c44afe1f.e0e35","name":"觀看溫溼度","info":"","x":90,"y":40,"wires":[]},{"id":"b9dd0d7e.ff9d1","type":"comment","z":"c44afe1f.e0e35","name":"HTTP 聊天室","info":"","x":110,"y":1620,"wires":[]},{"id":"1336fec6.795f51","type":"comment","z":"c44afe1f.e0e35","name":"FreeBoard 使用教學","info":"範例建置\n1. 擷取開發放資料溫濕度 並呈現圖表化","x":110,"y":1920,"wires":[]},{"id":"ebef6a40.9c3518","type":"openweathermap in","z":"c44afe1f.e0e35","name":"台灣 台中的天氣","lon":"","lat":"","city":"Taichung","country":"TW","language":"en","x":99.99430084228516,"y":1967.7893562316895,"wires":[["edc01e30.45385","7b19af0c.3f8b8"]]},{"id":"edc01e30.45385","type":"debug","z":"c44afe1f.e0e35","name":"","active":true,"console":"false","complete":"false","x":110,"y":2040,"wires":[]},{"id":"7b19af0c.3f8b8","type":"freeboard","z":"c44afe1f.e0e35","name":"freeboard","x":140,"y":2120,"wires":[]},{"id":"5f408454.47e13c","type":"inject","z":"c44afe1f.e0e35","name":"","topic":"","payload":"","payloadType":"date","repeat":"7200","crontab":"","once":false,"x":330,"y":1960,"wires":[["98dbcd02.26254"]]},{"id":"98dbcd02.26254","type":"function","z":"c44afe1f.e0e35","name":"資料處理呈現","func":"var sensor = global.get('sensor');\n\nsensor.initialize(11, 4);\nvar readout = sensor.read();\nmsg.topic=\"temp\";\nmsg.payload = { \n 溫度:readout.temperature.toFixed(2) , \n 濕度:readout.humidity.toFixed(2)\n \n};\nconsole.log(msg);\nreturn msg;\n","outputs":1,"noerr":0,"x":420.9999771118164,"y":2025.9999980926514,"wires":[["2daa93e7.1375ec"]]},{"id":"2daa93e7.1375ec","type":"freeboard","z":"c44afe1f.e0e35","name":"freeboard1","x":535.502815246582,"y":2089.8349118232727,"wires":[]},{"id":"1d725aea.132615","type":"comment","z":"c44afe1f.e0e35","name":"Freeboard室內溫溼度感測器資料呈現","info":"","x":374.4942932128906,"y":1920.0141830444336,"wires":[]},{"id":"c3462a4f.1abd38","type":"comment","z":"c44afe1f.e0e35","name":"MQTT 測試-沒成功","info":"","x":120.51705932617188,"y":300.29275131225586,"wires":[]},{"id":"309c48e2.7bc7d8","type":"comment","z":"c44afe1f.e0e35","name":"節點測試","info":"","x":104.51705169677734,"y":560.6563606262207,"wires":[]},{"id":"f5f1f717.528cc8","type":"comment","z":"c44afe1f.e0e35","name":"網頁觸發LED燈測試","info":"","x":152.51988220214844,"y":1127.3777542114258,"wires":[]},{"id":"fa759972.8c9fe8","type":"comment","z":"c44afe1f.e0e35","name":"lecture 1 Node-red","info":"","x":110,"y":2260,"wires":[]},{"id":"73a4e0e2.d0a1f","type":"openweathermap in","z":"c44afe1f.e0e35","name":"台灣 台中的天氣","lon":"","lat":"","city":"Taichung","country":"TW","language":"en","x":100,"y":2420,"wires":[["c559df48.cad4b"]]},{"id":"cd7a05a4.bd76c8","type":"comment","z":"c44afe1f.e0e35","name":"空氣警示使用twitter","info":"","x":100,"y":2360,"wires":[]},{"id":"c559df48.cad4b","type":"function","z":"c44afe1f.e0e35","name":"","func":"if (msg.payload.weather === \"Clouds\"){\n msg.payload = \"今天台中天氣多雲 !\"\n return msg;\n}\nreturn null;","outputs":1,"noerr":0,"x":270,"y":2480,"wires":[["9913e7.fcd8bc18"]]},{"id":"9913e7.fcd8bc18","type":"twitter out","z":"c44afe1f.e0e35","twitter":"","name":"Tweet","x":450,"y":2540,"wires":[]},{"id":"afc53f1d.9e31b","type":"rpi-gpio out","z":"c44afe1f.e0e35","name":"","pin":"12","set":"","level":"0","out":"out","x":280,"y":2720,"wires":[]},{"id":"17c682ba.67674d","type":"trigger","z":"c44afe1f.e0e35","op1":"open1111","op2":"0","op1type":"str","op2type":"str","duration":"1","extend":false,"units":"s","reset":"","name":"","x":163,"y":2638,"wires":[["afc53f1d.9e31b","fff2996d.351718"]]},{"id":"af69f5a4.81b358","type":"debug","z":"c44afe1f.e0e35","name":"","active":true,"console":"false","complete":"false","x":440,"y":2620,"wires":[]},{"id":"fff2996d.351718","type":"debug","z":"c44afe1f.e0e35","name":"","active":true,"console":"false","complete":"false","x":440,"y":2680,"wires":[]},{"id":"537b1faf.2850b","type":"debug","z":"c44afe1f.e0e35","name":"","active":true,"console":"false","complete":"true","x":410,"y":3160,"wires":[]},{"id":"684c286f.70fbb8","type":"catch","z":"c44afe1f.e0e35","name":"","x":264,"y":3160,"wires":[["537b1faf.2850b"]]},{"id":"37735646.5a3a7a","type":"debug","z":"c44afe1f.e0e35","name":"","active":true,"console":"false","complete":"payload","x":603,"y":3000,"wires":[]},{"id":"913eb577.65ed08","type":"comment","z":"c44afe1f.e0e35","name":"firebase.once() example flow","info":"This flow is the same as the\nfirebase.on() example flow, \nexcept that it uses \nfirebase.once(\"value\") to query Firebase\nin the middle of a flow and return a \nresponse synchronously (as opposed to \nstarting a flow whenever the firebase.on()\nevent is triggered).\n\n\nThe inject node begins the flow\nevery 5 seconds and the debug node logs \nthe weather in San Francisco, CA.","x":153.5,"y":2964,"wires":[]},{"id":"8536e55d.abf438","type":"firebase.once","z":"c44afe1f.e0e35","name":"抓取舊金山氣象資料","firebaseconfig":"","childpath":"myHomeTown","repeatifnull":false,"eventType":"value","queries":[],"x":358,"y":3000,"wires":[["37735646.5a3a7a"]]},{"id":"d3317245.cacc7","type":"inject","z":"c44afe1f.e0e35","name":"","topic":"","payload":"","payloadType":"date","repeat":"18000","crontab":"","once":false,"x":160,"y":3000,"wires":[["8536e55d.abf438"]]},{"id":"7c338c66.a757c4","type":"inject","z":"c44afe1f.e0e35","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"x":158,"y":3106,"wires":[["62836c98.ef5b34"]]},{"id":"62836c98.ef5b34","type":"change","z":"c44afe1f.e0e35","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"sdsssss","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":337,"y":3106,"wires":[["bb9912d2.cbb04"]]},{"id":"ba3d7853.cd9288","type":"comment","z":"c44afe1f.e0e35","name":"firebase modify example flow 寫入失敗","info":"This flow attempts to set data at the \nfirebase location. \n\nUnfortunately, the open data set firebase\nwe are using has security rules in place\nand we are unauthorized! \n\nThe set node will fail and generate a \nNode-Red error. The catch node will \nreceive the message that caused this \nerror and log it to the debug tab.\n\nThis flow is fired once at Deploy time\nand when Node-Red is first started up.\nYou can also click the button on the \ninject node to fire it whenever you like.","x":183.5,"y":3069,"wires":[]},{"id":"b7e4ccc3.049dd","type":"firebase.on","z":"c44afe1f.e0e35","name":"test","firebaseconfig":"","childpath":"/test","atStart":true,"eventType":"value","queries":[],"x":139,"y":2889,"wires":[["acc35f50.bd195"]]},{"id":"acc35f50.bd195","type":"debug","z":"c44afe1f.e0e35","name":"","active":true,"console":"false","complete":"payload","x":490,"y":2920,"wires":[]},{"id":"19f2f248.373e1e","type":"comment","z":"c44afe1f.e0e35","name":"firebase.on() example flow","info":"This flow provides a simple example which\nconnects to the firebase \n[weather](https://publicdata-weather.firebaseio.com/)\n[open data set](https://www.firebase.com/docs/open-data/).\n\nFirebase.on(\"value\") events are fired\nwhenever the weather changes in \nNashville, TN and sent to the debug node.\n抓取資料\n\n\nYou can view the data in the debug tab\nto the right.","x":146,"y":2851,"wires":[]},{"id":"69c16fe6.92d4a","type":"comment","z":"c44afe1f.e0e35","name":"-------------------CLICK ME AND READ THE INFO PANE-------------------","info":"Before clicking the Deploy button,\nYou need to configure login credentials \nfor each node with a Red Triangle (all of \nthe Firebase nodes)\n\nYou can add new credentials by double \nclicking on any firebase node and \nclicking on the pencil icon in the top \nright corner of the edit dialog box. \nOnce you have created a set of credentials\nthey will be available in the drop down\nbox.\n\nFor this example, you will want to set\nFirebase to \"publicdata-weather\" \n(without the quotes) and Auth Type to \nNone.","x":278.5,"y":2791,"wires":[]},{"id":"bb9912d2.cbb04","type":"firebase ondisconnect","z":"c44afe1f.e0e35","name":"","firebaseconfig":"","childpath":"/msgchildpath","method":"set","value":"msg.payload","priority":"msg.priority","x":800,"y":3120,"wires":[]},{"id":"3f0ae468.8a833c","type":"twitter in","z":"c44afe1f.e0e35","twitter":"","tags":"","user":"false","name":"","topic":"tweets","inputs":1,"x":230,"y":2540,"wires":[["17c682ba.67674d","af69f5a4.81b358"]]},{"id":"5a017ebc.47ddf","type":"twitter in","z":"c44afe1f.e0e35","twitter":"","tags":"#led_on","user":"false","name":"Turn on LED","topic":"tweets","inputs":1,"x":330,"y":2220,"wires":[["1b2725a8.8a098a","1764eb8c.984024"]]},{"id":"1b2725a8.8a098a","type":"debug","z":"c44afe1f.e0e35","name":"","active":true,"console":"false","complete":"payload","x":550,"y":2180,"wires":[]},{"id":"64cf970e.48b1d8","type":"rpi-gpio out","z":"c44afe1f.e0e35","name":"GPIO_24","pin":"18","set":"","level":"0","out":"out","x":740,"y":2220,"wires":[]},{"id":"1764eb8c.984024","type":"trigger","z":"c44afe1f.e0e35","op1":"1","op2":"","op1type":"str","op2type":"nul","duration":"250","extend":false,"units":"ms","reset":"","name":"","x":560,"y":2220,"wires":[["64cf970e.48b1d8"]]},{"id":"47d58134.5908e","type":"twitter in","z":"c44afe1f.e0e35","twitter":"","tags":"#led_off","user":"false","name":"Turn off LED","topic":"tweets","inputs":1,"x":330,"y":2340,"wires":[["350ffc14.a2f3b4","fdebffcd.21081"]]},{"id":"350ffc14.a2f3b4","type":"debug","z":"c44afe1f.e0e35","name":"","active":true,"console":"false","complete":"payload","x":750,"y":2280,"wires":[]},{"id":"614f2f1f.8f5ce","type":"rpi-gpio out","z":"c44afe1f.e0e35","name":"GPIO_24","pin":"18","set":"","level":"0","out":"out","x":740,"y":2340,"wires":[]},{"id":"fdebffcd.21081","type":"trigger","z":"c44afe1f.e0e35","op1":"0","op2":"","op1type":"str","op2type":"nul","duration":"250","extend":false,"units":"ms","reset":"","name":"","x":560,"y":2340,"wires":[["614f2f1f.8f5ce"]]},{"id":"1eff6edb.5df751","type":"inject","z":"c44afe1f.e0e35","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":360,"y":2280,"wires":[["1764eb8c.984024"]]},{"id":"decfd5f6.07ccf8","type":"mqtt-broker","z":"","broker":"broker.mqttdashboard.com","port":"8000","clientid":"clientId-U8NJaXTU2Q","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"6c64d3ab.053c2c","type":"websocket-listener","z":"c44afe1f.e0e35","path":"/ws/simpleled","wholemsg":"false"}]
Advertisement
Add Comment
Please, Sign In to add comment