A basic tutorial on MQTT please - Printable Version +- OpenMarine (https://forum.openmarine.net) +-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1) +--- Forum: How do I...? (https://forum.openmarine.net/forumdisplay.php?fid=3) +--- Thread: A basic tutorial on MQTT please (/showthread.php?tid=978) |
A basic tutorial on MQTT please - affinite - 2018-01-25 Because I cant edit the SPI settings in OP0.17, I'm trying to get my head around MQTT and the OP implementation. Id like to publish some sensor data generated by an ESP2866 over WiFi but currently have no idea how to populate the OP and ESP2866 MQTT fields. I know I could spend a while googling MQTT but Id appreciate some guidance to get me started. Anyone ? Thanks Steve RE: A basic tutorial on MQTT please - jim321 - 2018-01-25 its just publish & subscribe.. there is a example of a nodemcu with a 4way relay and temperature sensor arduino ide.code at bottom of post.. subscribe topic A,B,C,D, outTopictemp .. it would probably be easier to use espeasy and set that up, here is an example of a node subscribing to a esp32 with a bmp280..you can use the same message topic to subscribe in open plotter /controller name/device/data then choose an appropriate sk key to use it in the sys. i have it working on op 0.17 no problem reading temperature from the arduino code below and from a esp32 with espeasy. .. either way you are going to have to learn how it works to use it that means google... almost forgot you need to set it up in op.." broker localhost, port 1883, name, password " input nodes for node-red Code: [ arduino code for mqtt Code: #include <ESP8266WiFi.h> RE: A basic tutorial on MQTT please - JeroenAdam - 2018-03-29 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. 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 RE: A basic tutorial on MQTT please - Smormardko - 2022-10-06 Hope you managed to find all the information you needed back then. But if anyone else who needs to get started with MQTT comes across this topic, I can suggest this mqtt connection guide. It’s the most comprehensive MQTT fundamentals I have found so far. It includes information on how the MQTT connection works. It also thoroughly explains the roles MQTT broker and client play in this process and what parameters the MQTT CONNECT and CONNACK packets include. It’s written in simple words, and even a nonprofessional would be able to understand it easily." |