• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Openplotter + MQTT + Dashboard
After several days of trial and error I finally found a successful way to publish some data from openplotter with MQTT to an online dashboard:

[Image: dbwgtk2.png]

What is MQTT:
A lightweight messaging protocol for small sensors and mobile devices, optimized for high-latency or unreliable networks. Click here for more on MQTT. In short Openplotter publishes data on different topics to a broker, other devices can subscribe to these topics (the dashboard)
So if you want to use Openplotter as a remote monitoring device on your boat or publish real time saildata when you are on the move and you don’t have (any) linux skills, please read on!

1. Sign up for a free Cloud MQTT Broker
I used CloudMQTT, the free ‘Cute Cat’ plan. You will get a servername, a username and password and a set of ports. Create a name username with read/write permissions on a topic 'Temp' (for example)

2. Configure Openplotter for CloudMQTT
Enter your credentials from you CloudMQTT (control panel -> ‘Details’ button -> Overview), use the first port listed (starting with a 1)

[Image: tDfe6pN.png]

3. Create a topic in Openplotter
Add a topic, the ‘Short’ name you can find in the first column in the Inspector. The topicname you can make up yourself

[Image: WRJocH6.png]

4. Create an Action in Openplotter
Publishing the data from the topics is done by an Action under the Actions-tab. First add a trigger, choose 'None (always true)'

[Image: UqihJj1.png]

Then add an action. In the dropdown list you will find below a ‘Publish on topic X (topic you created in step 3)’, for ‘data’ put the ‘Short’ name (from step 3) between brackets

[Image: EJ24T1i.png]

5. Create a dashboard on Freeboard.io
I got a free account at freeboard.io, you will get a small demo with your smartphone which is really cool. Now it gets a little complex. For Freeboard to use an MQTT broker as a datasource, we have to configure a MQTT plugin. This can be done with the ‘Developer Console’ in the upper left corner. Enter the following plugin script URL’s:
Leave /plugins/all where it is.

[Image: R1gsZmn.png]

For more details on the plugin, I found above information on https://github.com/alsm/freeboard-mqtt/issues/3

6. Add Datasource to Freeboard.io
The ‘Name’ and ‘ClientID’ you can chose yourself. The portnumber is the ‘Websocket Port’ you can find in your CloudMQTT broker dashboard (starting with 3..). 
The ‘Last Updated’ time should be updated within the timeframe you set on the Action tab in Openplotter. If it is not updated reload the freeboard. (took me 2 days to find that out)

[Image: ojBPJJ1.png]

7. Add a Widget with the published data:
Click ‘Add Pane’ and an empty pane is created. Click on the settings icon (wrench) to give it a name and adjust the width (1 to 3 columns) 
Then click the ‘+’. For Temperature choose ‘Text’, ‘Gauge’ or ‘Sparkline’. as Type. Choose a fitting title. For the Value click on ‘+ Datasources’ and click in the dropdown menu on your topicname and then on ‘msg’, see example below. And Voila!! 

[Image: J8iUwMU.png]

In my example above I used also used a 'gauge' with the same datasource and a 'google map' which needs Lat & Lon

[Image: 2a1dxy3.png]

In my dashboard I used also a gauge-widget with the same 'Temp' datasource and a GoogleMap-widget with the datasources Lat & Lon.
Don't forget when you add a topic in Openplotter you have to give your CloudMQTT user read/write permissions!

- There are probably more efficient ways to accomplish the same result, I just want to share my way. Feel free to comment!
- To make it useful I would have to add a 2g/3g dongle 
- I'm thinking about 2 dashboards, one for remote monitoring for temperature, humidity, power, gas and bilgewater, and one for under sail with speed, location etc.
- I didn’t get the humidity sensor to display data, still no clue why....
- For troubleshooting you click the Websocket button in your CloudMQTT console, you should see your topics sent from Openplotter

Happy tinkering!
This is absolutely great, thanks!!!!!! I will paste this to the documentation if you are right with this. We spend our time developing because OP is growing fast and we don't have time to do such wonderful tutorials, thanks again.

OP v0.9.0 will change a lot but the MQTT part won't. If you have any suggestion or improvement I will be glad to hear.

Great contribution.
I have seen that you could set status widgets on freeboard to show door switches, float switches, motion sensors... Do you know if it would be possible to set switches on freeboard panels to send MQTT to OpenPlotter and trigger actions?
wow, wow, wait...

OpenPlotter can connect with remote brokers but it has also a local broker built-in to connect directly when you don't have internet. The freeboard client software is open source and that means that we could install freeboard on OpenPlotter in order to interact with the local broker and be able to access to sexy panels from your phone without internet.
Freeboard allows export panels and configurations so you would have just to crate a panel in freeboard online and export/import locally or vice-versa.

(07-12-2016, 06:57 AM)Sailoog Wrote: I have seen that you could set status widgets on freeboard to show door switches, float switches, motion sensors... Do you know if it would be possible to set switches on freeboard panels to send MQTT to OpenPlotter and trigger actions?

I couldn't find that functionality. However there is another dashboard which is available online and on github which can integrate with MQTT and is able the operate switches. It's called Crouton Smile . In order to get this to work I understand you need a device-id specified in your mosquitto_pub command, which is probably not configured in OP?

Online dashboard: http://crouton.mybluemix.net/crouton/gettingStarted
Github: https://github.com/edfungus/Crouton
(07-12-2016, 02:54 AM)Snijdor Wrote: --> After several days of trial and error I finally found a successful way to publish some data from openplotter with MQTT to an online dashboard:
Great post Snijdor! Thanks for your persistence and a great job writing this doc. I was able to get cloudMQTT and freeboard.io talking with your doc.

Sailoog - you asked about using freeboard.io to send MQTT to OPenplotter and trigger actions. I finally got the android app that you suggetsed - MQTT Dashboard set up, and can send MQTT to Openplotter and initiate actions. I have a PIR set up detect motion and trigger the camera. I setup a Dropbox upload and sending me an email -  but that is a heavy load for the weak/slow wireless service at the boat. So now I have the PIR triggering MQTT to let me know that my boat has visitors. Working good and light weight.  I never could get the messages sent from cloudMQTT to be recognized/received at Openplotter.

If sure would like to find an iphone MQTT client with alerts - anybody know of one?

Finally I managed to install freeboard dashboard in OpenPlotter v0.9.0 and is reading directly from Signal K. So we will be able to create sexy dashboards in our phones and tablets connected to OP without internet and create also dashboards in https://freeboard.io/ for remote monitoring through MQTT.

Thanks to Snijdor for pointing me in the right direction.
This,  yet again,  is exciting.  I got v0. 9 running today for a look but haven't had any time yet to dig deeper,  but it looks like a big leap forward. Great work! 
On amazon this morning I noticed esp8266 12e boards are about a quarter of the price they were just a few months ago, wouldn't  they work well with openplotter? One in the engine with some ds18b thermometers sending engine temps over udp,  one monitoring the batteries... No wires to sort out,  just some power. 
Is there a  limit to how many you could pipe into signalk?
Thanks for testing v0.9.0. It is an early alpha version and is full of incomplete stuff but you will be able to see how things are going.

Yes, we have considered getting signal k data through an UDP reserved port for wifi connections. I don't know if there is a pipe limit, I guess it depend on UDP buffers and raspberry pi performance.
@ Snijdor
Could you please have a look on my freeboard settings?
I could not manage to get it tunning.

The topic is published by OP, i can see it in a MQTT monitor. I tried with an without SSL, no success.

[Image: c693835db99137083db67505c63b2b6c.jpg][Image: 5d4f170547fdeedba5deac2f198978aa.jpg][Image: 54f0d43951c729b698e69058b981fa2c.jpg][Image: c444c96e21bb7d827311de42f470eee2.jpg][Image: 274b0c648e5de7d71e1bfaca7cf17fab.jpg]
[Image: 56b4db8effec6683e899df1e31d63d74.jpg][Image: 0b821fa4b53197c508586b6a286b8306.jpg]

Forum Jump:

Users browsing this thread: 2 Guest(s)