Advertisement
Guttz

Node Rasp v3

Nov 15th, 2018
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.20 KB | None | 0 0
  1. [
  2. {
  3. "id": "85f4feea.5ed1f",
  4. "type": "tab",
  5. "label": "Display Raspberry"
  6. },
  7. {
  8. "id": "370b18fe.766788",
  9. "type": "wiotp-credentials",
  10. "z": "",
  11. "name": "mvp1",
  12. "org": "fgorux",
  13. "devType": "rasspberrypi_fiducua",
  14. "devId": "raspberry_1"
  15. },
  16. {
  17. "id": "a01faff8.67bf9",
  18. "type": "wiotp-credentials",
  19. "z": "",
  20. "name": "mvp1",
  21. "org": "fgorux",
  22. "devType": "rasspberrypi_fiducua",
  23. "devId": "raspberry_1"
  24. },
  25. {
  26. "id": "9abbb7ca.778e28",
  27. "type": "wiotp-credentials",
  28. "z": "",
  29. "name": "Raspberry_1",
  30. "org": "kwbv6q",
  31. "devType": "Raspberry",
  32. "devId": "Raspberry_1"
  33. },
  34. {
  35. "id": "fb53e55d.8343e8",
  36. "type": "wiotp-credentials",
  37. "z": "",
  38. "name": "",
  39. "org": "lpol26",
  40. "devType": "Raspberry",
  41. "devId": "348267e0.e0e8f8"
  42. },
  43. {
  44. "id": "c253c6c8.f859c8",
  45. "type": "websocket-listener",
  46. "z": "85f4feea.5ed1f",
  47. "path": "/ws/simple",
  48. "wholemsg": "false"
  49. },
  50. {
  51. "id": "753fe9c8.bb8608",
  52. "type": "websocket out",
  53. "z": "85f4feea.5ed1f",
  54. "name": "",
  55. "server": "c253c6c8.f859c8",
  56. "client": "",
  57. "x": 989,
  58. "y": 522,
  59. "wires": []
  60. },
  61. {
  62. "id": "ff7fd53e.c01718",
  63. "type": "http response",
  64. "z": "85f4feea.5ed1f",
  65. "name": "",
  66. "x": 909,
  67. "y": 458,
  68. "wires": []
  69. },
  70. {
  71. "id": "8bd587fe.7db358",
  72. "type": "http in",
  73. "z": "85f4feea.5ed1f",
  74. "name": "",
  75. "url": "/simple",
  76. "method": "get",
  77. "swaggerDoc": "",
  78. "x": 463,
  79. "y": 460,
  80. "wires": [
  81. [
  82. "a674708.6b1dc9"
  83. ]
  84. ]
  85. },
  86. {
  87. "id": "a674708.6b1dc9",
  88. "type": "template",
  89. "z": "85f4feea.5ed1f",
  90. "name": "Vending Machine",
  91. "field": "payload",
  92. "fieldType": "msg",
  93. "format": "html",
  94. "syntax": "mustache",
  95. "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' >\"+ \"Thanks \"+ (JSON.parse(data)).d.name + \"! Collect your \" + (JSON.parse(data)).d.product +\".</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>",
  96. "x": 736,
  97. "y": 456,
  98. "wires": [
  99. [
  100. "ff7fd53e.c01718"
  101. ]
  102. ]
  103. },
  104. {
  105. "id": "fde91aec.b1a588",
  106. "type": "function",
  107. "z": "85f4feea.5ed1f",
  108. "name": "format time nicely",
  109. "func": "//msg.payload = Date(msg.payload).toString();\nreturn msg;",
  110. "outputs": 1,
  111. "noerr": 0,
  112. "x": 726,
  113. "y": 518,
  114. "wires": [
  115. [
  116. "753fe9c8.bb8608"
  117. ]
  118. ]
  119. },
  120. {
  121. "id": "bd924449.34cfd8",
  122. "type": "websocket in",
  123. "z": "85f4feea.5ed1f",
  124. "name": "",
  125. "server": "c253c6c8.f859c8",
  126. "client": "",
  127. "x": 732,
  128. "y": 593,
  129. "wires": [
  130. [
  131. "f8d27668.54f8b8"
  132. ]
  133. ]
  134. },
  135. {
  136. "id": "f8d27668.54f8b8",
  137. "type": "debug",
  138. "z": "85f4feea.5ed1f",
  139. "name": "",
  140. "active": true,
  141. "console": "false",
  142. "complete": "payload",
  143. "x": 967,
  144. "y": 593,
  145. "wires": []
  146. },
  147. {
  148. "id": "ba826c5d.93e72",
  149. "type": "wiotp in",
  150. "z": "85f4feea.5ed1f",
  151. "authType": "d",
  152. "deviceKey": "9abbb7ca.778e28",
  153. "deviceType": "",
  154. "deviceId": "",
  155. "command": "+",
  156. "commandType": "g",
  157. "name": " Raspberry_1",
  158. "x": 477,
  159. "y": 517,
  160. "wires": [
  161. [
  162. "fde91aec.b1a588"
  163. ]
  164. ]
  165. },
  166. {
  167. "id": "fec09ca.3e8656",
  168. "type": "wiotp in",
  169. "z": "85f4feea.5ed1f",
  170. "authType": "d",
  171. "deviceKey": "9abbb7ca.778e28",
  172. "deviceType": "",
  173. "deviceId": "",
  174. "command": "+",
  175. "commandType": "g",
  176. "name": " Raspberry_1",
  177. "x": 552,
  178. "y": 182,
  179. "wires": [
  180. [
  181. "c3273fa2.88613"
  182. ]
  183. ]
  184. },
  185. {
  186. "id": "c3273fa2.88613",
  187. "type": "debug",
  188. "z": "85f4feea.5ed1f",
  189. "name": "",
  190. "active": true,
  191. "console": "false",
  192. "complete": "true",
  193. "x": 821,
  194. "y": 180,
  195. "wires": []
  196. },
  197. {
  198. "id": "fd794c65.a1014",
  199. "type": "comment",
  200. "z": "85f4feea.5ed1f",
  201. "name": "Live display - Raspberry",
  202. "info": "",
  203. "x": 735.5,
  204. "y": 374,
  205. "wires": []
  206. },
  207. {
  208. "id": "7810e391.f37a4c",
  209. "type": "comment",
  210. "z": "85f4feea.5ed1f",
  211. "name": "Debug window Report",
  212. "info": "",
  213. "x": 677,
  214. "y": 112,
  215. "wires": []
  216. }
  217. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement