This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A basic tutorial on MQTT please
#3
Adding to this quest to handle MQTT data streams, I (sort of) succeeded using my Android phone as GPS receiver through MQTT, I'm still struggling with converting the data which went from MQTT message to object, to array and to (unwantedly) string, I'm not a dev...

Here below my flow and debug output, it shows my attempt to inject the lat/lon into my dashboard, it works but not as I wish, both strings are still to be stripped/converted.

[Image: owntracks.PNG]

Code:
[{"id":"f01686b2.94c638","type":"mqtt in","z":"217cab7.d842f54","name":"","topic":"owntracks","qos":"2","broker":"47dee4e1.57a214","x":100,"y":600,"wires":[["2069343.0d680cc"]]},{"id":"2069343.0d680cc","type":"function","z":"217cab7.d842f54","name":"splitting","func":"msg.payload = msg.payload.split(\",\");\nreturn msg;","outputs":1,"noerr":0,"x":240,"y":600,"wires":[["c3926ea9.6954d","be4ea282.527cb"]]},{"id":"e8c15157.66d0c","type":"debug","z":"217cab7.d842f54","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":450,"y":680,"wires":[]},{"id":"be4ea282.527cb","type":"function","z":"217cab7.d842f54","name":"routing","func":"var msg8 = msg.payload.map(function (p) {\n    return {payload: p};\n});\nreturn msg8;","outputs":8,"noerr":0,"x":230,"y":680,"wires":[[],[],[],["e8c15157.66d0c","50dd8c03.a0fde8"],["5390235e.c9248c","620f9130.009e9"],[],[],[]]},{"id":"5390235e.c9248c","type":"debug","z":"217cab7.d842f54","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":450,"y":700,"wires":[]},{"id":"c3926ea9.6954d","type":"debug","z":"217cab7.d842f54","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":510,"y":620,"wires":[]},{"id":"47dee4e1.57a214","type":"mqtt-broker","z":"","name":"MQQT","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":""}]

So when OpenPlotter receives GPS coordinates in NMEA0183 through the multiplexer, all works.
This is my attempt with my Android phone as a backup. We're talking about the dashboard, even not SignalK yet, the latter does receive the MQTT message in good order.
On the phone I installed Owntracks and on OpenPlotter I configured MQTT as described elsewhere on this forum.

Jeroen Adam
Reply


Messages In This Thread
A basic tutorial on MQTT please - by affinite - 2018-01-25, 08:28 PM
RE: A basic tutorial on MQTT please - by jim321 - 2018-01-25, 09:41 PM
RE: A basic tutorial on MQTT please - by JeroenAdam - 2018-03-29, 10:19 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)