Smick_001_console_v4

This flow builds a dashboard console to interact with Smick through MQTT feed. You can send commands on Smick input feed and receive answers or events from Smick output feed. It also contains an input node link to allow other flows sending commands and an output node link to direct responses / events received to other flows. Finally sent messages and replies / received events are listed on debug tab using debug nodes.

[{"id":"6ad8b950.8ba808","type":"mqtt out","z":"ca1ab58d.d6bca8","name":"smick command","topic":"borot/feeds/I3300460880","qos":"0","retain":"true","broker":"f1f7b732.115e58","x":920,"y":120,"wires":[]},{"id":"87155fc5.4ab25","type":"debug","z":"ca1ab58d.d6bca8","name":"debug command","active":true,"console":"false","complete":"payload","x":920,"y":60,"wires":[]},{"id":"54cb1573.619bdc","type":"ui_text_input","z":"ca1ab58d.d6bca8","name":"","label":"command","group":"7322b198.8337a","order":1,"width":"0","height":"0","passthru":true,"mode":"text","delay":"0","topic":"","x":540,"y":120,"wires":[["6ad8b950.8ba808","87155fc5.4ab25"]]},{"id":"1ca1ff21.1ae1d1","type":"ui_text","z":"ca1ab58d.d6bca8","group":"7322b198.8337a","order":2,"width":"0","height":"0","name":"","label":"response/event","format":"{{msg.payload}}","layout":"col-center","x":920,"y":400,"wires":[]},{"id":"23c43066.a7d46","type":"mqtt in","z":"ca1ab58d.d6bca8","name":"smick response/event","topic":"borot/feeds/O3300460880","qos":"0","broker":"f1f7b732.115e58","x":160,"y":400,"wires":[["1ca1ff21.1ae1d1","2503e18d.296ece","ea06ee2c.28eb8","600ef4c6.dba21c"]]},{"id":"3fc9a886.164328","type":"link in","z":"ca1ab58d.d6bca8","name":"command","links":["f3a77881.2d28c8","bca4015.3ffd1","9cd69bf1.6d6188","c6e1c9e8.e56df8","e8aaac85.6c74c","9bf344fe.62f8f8","411cecf.b196714"],"x":235,"y":120,"wires":[["54cb1573.619bdc"]]},{"id":"2503e18d.296ece","type":"debug","z":"ca1ab58d.d6bca8","name":"debug event","active":true,"console":"false","complete":"payload","x":910,"y":340,"wires":[]},{"id":"ce6ff681.70b598","type":"ui_toast","z":"ca1ab58d.d6bca8","position":"bottom right","displayTime":"3","name":"conn/disc notification","x":940,"y":500,"wires":[]},{"id":"6c56c8c0.14dc38","type":"ui_text","z":"ca1ab58d.d6bca8","group":"7322b198.8337a","order":3,"width":0,"height":0,"name":"state","label":"Connection status","format":"{{msg.payload}}","layout":"col-center","x":890,"y":560,"wires":[]},{"id":"c70cbb68.c86e18","type":"change","z":"ca1ab58d.d6bca8","name":"event to msg","rules":[{"t":"change","p":"payload","pt":"msg","from":"DISC","fromt":"str","to":"Disconnected","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"CONN","fromt":"str","to":"Connected","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":500,"wires":[["1efd20b7.f7df6f"]]},{"id":"ea06ee2c.28eb8","type":"link out","z":"ca1ab58d.d6bca8","name":"response_event","links":["4a583f44.c823b","70d147bc.975418","f2218eb7.3dc25","18e5fb4d.04bea5"],"x":855,"y":240,"wires":[]},{"id":"600ef4c6.dba21c","type":"switch","z":"ca1ab58d.d6bca8","name":"parse","property":"payload","propertyType":"msg","rules":[{"t":"regex","v":"CONN|DISC","vt":"str","case":true},{"t":"regex","v":"PING","vt":"str","case":false}],"checkall":"false","outputs":2,"x":370,"y":520,"wires":[["c70cbb68.c86e18"],["fc28d828.81fe38"]]},{"id":"1efd20b7.f7df6f","type":"function","z":"ca1ab58d.d6bca8","name":"state msg","func":"function timeDate(tz) {\n    var d = new Date(Date.now()+tz*3600000);\n\n    return  d.getUTCHours() + \":\" +\n            format00(d.getUTCMinutes()) + \":\" +\n            format00(d.getUTCSeconds()) + \" \" +\n            d.getUTCDate()\t+\"/\" +\n            (d.getUTCMonth()+1) + \"/\" +\n            d.getUTCFullYear();\n}\n\nfunction format00(n) {\n    if (n<10) return \"0\"+n; else return n;\n}\n\nmsg.payload+=\" at \"+ timeDate(1);\nreturn msg;","outputs":1,"noerr":0,"x":700,"y":500,"wires":[["6c56c8c0.14dc38","ce6ff681.70b598"]]},{"id":"4696d6ae.825cc8","type":"comment","z":"ca1ab58d.d6bca8","name":"Description","info":"Smick_001_console_v4\n_______________________________________________________________________________\nPackage : Smick v.1\nModule  : console\nAuthor  : Curci\nLicence : (CC) BY-NC-SA\n\nThis work is licensed under a Creative Commons \nAttribution-NonCommercial-ShareAlike \n4.0 International License.\n\nHistory\n\nDate        Author  Description\n2016.12.17  Curci   genesis\n_______________________________________________________________________________\n\nDescription\n\nQuesto flusso costruisce un cruscotto console per interagire con smick tramite feed mqtt.\nSi possono inviare comandi sul feed di input di smick e ricevere risposte o eventi dal feed di output di smick.\nContiene inoltre un nodo link di input per consentire ad altri flussi l'invio di comandi e un nodo link di output per smistare risposte/eventi ricevuti ad altri flussi.\nInfine i messaggi inviati e le risposte / eventi ricevuti sono elencati su debug tab mediante nodi debug.\n\n\nThis flow builds a dashboard console to interact with Smick through MQTT feed.\nYou can send commands on Smick input feed and receive answers or events from Smick output feed.\nIt also contains an input node link to allow other flows sending commands and an output node link to direct responses / events received to other flows.\nFinally sent messages and replies / received events are listed on debug tab using debug nodes.\n\n_______________________________________________________________________________\n\nBill Of Material\n\nHardware:\n\n    1 Human internet terminal (PC, tablet or smartphone) connected to the internet\n    1 Smick Wi-Fi connected to the internet\n\nHW Connections:\n\n    None.\n\nFlow Connections:\n\n    None\n\nAccount:\n\n    Wi-Fi router\n    MQTT broker\n    FRED\n","x":100,"y":40,"wires":[]},{"id":"fc28d828.81fe38","type":"change","z":"ca1ab58d.d6bca8","name":"event to msg","rules":[{"t":"change","p":"payload","pt":"msg","from":"PING","fromt":"str","to":"Always connected","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":540,"wires":[["6c56c8c0.14dc38"]]},{"id":"f1f7b732.115e58","type":"mqtt-broker","z":"","broker":"io.adafruit.com","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"300","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"7322b198.8337a","type":"ui_group","z":"","name":"Console","tab":"f71f09a.c9a74f8","order":1,"disp":true,"width":"6"},{"id":"f71f09a.c9a74f8","type":"ui_tab","z":"","name":"Console","icon":"dashboard","order":1}]

Flow Info

Created 7 years, 10 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x2)
  • comment (x1)
  • debug (x2)
  • function (x1)
  • link in (x1)
  • link out (x1)
  • mqtt in (x1)
  • mqtt out (x1)
  • mqtt-broker (x1)
  • switch (x1)
Other
  • ui_group (x1)
  • ui_tab (x1)
  • ui_text (x2)
  • ui_text_input (x1)
  • ui_toast (x1)

Tags

  • Smick
  • IoT
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option