Advertisement
Guttz

Rasp Nodered v1

Nov 14th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.37 KB | None | 0 0
  1. [{"id":"8c6ac3dd.ed208","type":"tab","label":"Flow 1"},{"id":"85f4feea.5ed1f","type":"tab","label":"Flow 2"},{"id":"370b18fe.766788","type":"wiotp-credentials","z":"","name":"mvp1","org":"fgorux","devType":"rasspberrypi_fiducua","devId":"raspberry_1"},{"id":"a01faff8.67bf9","type":"wiotp-credentials","z":"","name":"mvp1","org":"fgorux","devType":"rasspberrypi_fiducua","devId":"raspberry_1"},{"id":"9abbb7ca.778e28","type":"wiotp-credentials","z":"","name":"Raspberry_1","org":"uia37g","devType":"Raspberry","devId":"Raspberry_1"},{"id":"fb53e55d.8343e8","type":"wiotp-credentials","z":"","name":"","org":"lpol26","devType":"Raspberry","devId":"348267e0.e0e8f8"},{"id":"c253c6c8.f859c8","type":"websocket-listener","z":"85f4feea.5ed1f","path":"/ws/simple","wholemsg":"false"},{"id":"82102093.8ebae","type":"debug","z":"8c6ac3dd.ed208","name":"","active":true,"console":"false","complete":"payload","x":1107,"y":390,"wires":[]},{"id":"158f15ff.9a115a","type":"function","z":"8c6ac3dd.ed208","name":"pls work","func":"return {payload:msg.payload.Message};","outputs":1,"noerr":0,"x":797,"y":286,"wires":[["82102093.8ebae"]]},{"id":"43492107.92ccd","type":"wiotp in","z":"8c6ac3dd.ed208","authType":"d","deviceKey":"9abbb7ca.778e28","deviceType":"","deviceId":"","command":"+","commandType":"g","name":" Raspberry_1","x":231,"y":527,"wires":[["4b2aa9d3.67fff8"]]},{"id":"348267e0.e0e8f8","type":"wiotp out","z":"8c6ac3dd.ed208","authType":"d","qs":"true","qsDeviceId":"348267e0.e0e8f8","deviceKey":"","deviceType":"","deviceId":"","event":"display","format":"json","name":"","x":466,"y":613,"wires":[]},{"id":"4b2aa9d3.67fff8","type":"debug","z":"8c6ac3dd.ed208","name":"","active":true,"console":"false","complete":"true","x":458,"y":532,"wires":[]},{"id":"71610f0c.57c7","type":"exec","z":"8c6ac3dd.ed208","command":"echo \"hellohellohellohellohellohellohellohellohellohellohellohellohello\"","addpay":false,"append":"","useSpawn":"","timer":"","name":"","x":414.5,"y":419.5,"wires":[[],[],[]]},{"id":"55859271.19187c","type":"debug","z":"8c6ac3dd.ed208","name":"HEEllz","active":true,"console":"true","complete":"true","x":838,"y":435,"wires":[]},{"id":"86e8966c.ea6df8","type":"inject","z":"8c6ac3dd.ed208","name":"","topic":"","payload":"","payloadType":"date","repeat":"3","crontab":"","once":true,"x":132,"y":334,"wires":[["71610f0c.57c7"]]},{"id":"610fdbaf.3ce5c4","type":"comment","z":"8c6ac3dd.ed208","name":"Link here","info":"","x":760.5,"y":389,"wires":[]},{"id":"e415a9ef.872b18","type":"template","z":"85f4feea.5ed1f","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"This is the payload: {{payload}} !\n\n<script>\nfunction myFunction() {\n setTimeout(function(){ alert(\"Hello\"); }, 3000);\n}\n</script>","x":468,"y":228,"wires":[["fb312806.4dd888"]]},{"id":"fb312806.4dd888","type":"http response","z":"85f4feea.5ed1f","name":"","x":629,"y":166,"wires":[]},{"id":"eda87c34.381cf","type":"http in","z":"85f4feea.5ed1f","name":"get_RaspDisplay","url":"/display","method":"get","swaggerDoc":"","x":269,"y":169,"wires":[["e415a9ef.872b18"]]},{"id":"1e049fa0.5f92c","type":"trigger","z":"85f4feea.5ed1f","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"250","extend":false,"units":"ms","reset":"","name":"","x":978,"y":161,"wires":[[]]},{"id":"3dcc4a5b.16f7e6","type":"template","z":"85f4feea.5ed1f","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"This is the payload: {{payload}} !","x":200,"y":531,"wires":[["e6f03e69.80236"]]},{"id":"e6f03e69.80236","type":"http response","z":"85f4feea.5ed1f","name":"","x":360,"y":460,"wires":[]},{"id":"18d3d274.1bf1de","type":"inject","z":"85f4feea.5ed1f","name":"Tick every 5 secs","topic":"test","payload":"","payloadType":"date","repeat":"2","crontab":"","once":false,"x":722,"y":412,"wires":[[]]},{"id":"753fe9c8.bb8608","type":"websocket out","z":"85f4feea.5ed1f","name":"","server":"c253c6c8.f859c8","client":"","x":1253,"y":415,"wires":[]},{"id":"ff7fd53e.c01718","type":"http response","z":"85f4feea.5ed1f","name":"","x":1173,"y":351,"wires":[]},{"id":"8bd587fe.7db358","type":"http in","z":"85f4feea.5ed1f","name":"","url":"/simple","method":"get","swaggerDoc":"","x":702,"y":345,"wires":[["a674708.6b1dc9"]]},{"id":"a674708.6b1dc9","type":"template","z":"85f4feea.5ed1f","name":"Vending Machine","field":"payload","fieldType":"msg","format":"html","syntax":"mustache","template":"<!DOCTYPE HTML>\n<html>\n <head>\n \n <title>Simple Live Display</title>\n\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/simple\n wsUri += \"//\" + loc.host + loc.pathname.replace(\"simple\",\"ws/simple\");\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 \" + (JSON.parse(data)).d.message );\n // build the output from the topic and payload parts of the object\n line += \"<span class='user-phrase' >\"+ (JSON.parse(data)).d.message +\"</span>\";\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 style=\"margin: 0px; padding: 0px;\" onload=\"wsConnect();\" onunload=\"ws.disconnect();\">\n \n\t\t<div class=\"outer-div\">\n\t\t\t<div class=\"form-div\">\n\t\t\t\t<div class=\"sucess-msg\">\n\n\t\t\t <div id=\"messages\"></div>\n\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n \n <!--\n <button type=\"button\" onclick='doit(\"click\");'>Click to send message</button>\n \n\n <div id=\"status\">\n unknown</div>\n -->\n \n <style>\n .outer-div{\n width: 100vw;\n height: 100vh;\n background: #F8F8F8;\n position: relative;\n }\n\n .sucess-msg{\n text-align: center;\n padding-top: 14.3%;\n\n }\n\n .form-div{\n border-width: 4px;\n border-style: solid;\n border-color: #ff6600;\n border-radius: 9px;\n text-align: center;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n width: 60%;\n height: 60%;\n margin: auto;\n }\n\n .body{\n margin: 0px;\n }\n\n .user-phrase{\n padding-top: 7.1%;\n display: block;\n font: serif;\n font-size: 32px;\n font-weight: 800;\n color: #0066b3;\n }\n\n .user-options{\n padding-top: 4%;\n }\n\n .button::-moz-focus-inner{\n border: 0;\n padding: 0;\n }\n\n .button{\n display: inline-block;\n *display: inline;\n zoom: 1;\n padding: 6px 20px;\n margin: 0;\n cursor: pointer;\n border: 1px solid #bbb;\n overflow: visible;\n font: bold 13px arial, helvetica, sans-serif;\n text-decoration: none;\n white-space: nowrap;\n color: #555;\n </style>\n \n </body>\n\n</html>","x":1000,"y":349,"wires":[["ff7fd53e.c01718"]]},{"id":"fde91aec.b1a588","type":"function","z":"85f4feea.5ed1f","name":"format time nicely","func":"//msg.payload = Date(msg.payload).toString();\nreturn msg;","outputs":1,"noerr":0,"x":990,"y":411,"wires":[["753fe9c8.bb8608"]]},{"id":"bd924449.34cfd8","type":"websocket in","z":"85f4feea.5ed1f","name":"","server":"c253c6c8.f859c8","client":"","x":973,"y":481,"wires":[["f8d27668.54f8b8"]]},{"id":"f8d27668.54f8b8","type":"debug","z":"85f4feea.5ed1f","name":"","active":true,"console":"false","complete":"payload","x":1231,"y":486,"wires":[]},{"id":"ba826c5d.93e72","type":"wiotp in","z":"85f4feea.5ed1f","authType":"d","deviceKey":"9abbb7ca.778e28","deviceType":"","deviceId":"","command":"+","commandType":"g","name":" Raspberry_1","x":766,"y":500,"wires":[["fde91aec.b1a588"]]}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement