sailoog / openplotter

Obsolete project. New one and active: https://github.com/openplotter
http://www.sailoog.com/openplotter
GNU General Public License v2.0
153 stars 53 forks source link

Requesting deltas from OP SignalK server via MQTT for display. #170

Closed toqduj closed 5 years ago

toqduj commented 7 years ago

Hello Sailoog,

With the WiFi sensors now working satisfactorily, the next project involves making a WiFi display unit. I intend to use similar components again: an MKR1000, a 2.9 inch (wide) e-paper display, and a Skywriter for input/selection. This match would enable me to put everything in a waterproof box with a minimum of holes for external connections (only one for power).

The question is, how can I request values from the Openplotter server? The MQTT tab only offers options for Signal K input, but not output. Also, if the display is only displaying speed (for example), maybe it doesn't make sense to send the entire SK schema all the time, so the display should be able to: 1) find out the available values in the SK structure that are being updated (full SK schema download, but only with actively updated values). This would work for low update frequencies. 2) maybe subscribe to a SK (sub) topic to receive the deltas (for everything or only a particular (sub) structure)

I tried to find out if something like this is already available, but couldn't see any. Is such a mechanism already in existence? If not, do you have a suggestion on what would be the easiest to implement for you?

Cheers,

B.

richardmbell commented 7 years ago

Perhaps I am missing something, but if you are publishing to an mqtt server why can't you subscribe two whichever topic you want? I have never done that on an Arduino. Is that possible?

toqduj commented 7 years ago

That would only work for data coming in from the MQTT-enabled sensors, and only if you know which topics are available and what is being published to a particular topic. It would not work for server-generated derivatives or non-MQTT sensors. I'm therefore wondering whether there is a general method in place to find and read values in the SK tree via MQTT.

Subscribing and ingesting JSON on the Arduino is not a problem, but you'd need an arduino with sufficient memory to store the JSON messages. I'm currently playing with the ARM Cortex-M0 based boards for that.

toqduj commented 7 years ago

@tkurki mentioned there are MQTT topics for each parameter, so I'll be looking into that..

toqduj commented 7 years ago

Don't seem to be working on OP. @sailoog any chance that we'd be able to create output topics in the interface in the same way that we can create input topics? I.e. in the "Add MQTT topic" dialog, to have under "Type" the option to say "Signal K key output", "Signal K delta output", and "Signal K full output"?

tkurki commented 7 years ago

I would like to have a standardised mapping between SK and MQTT, like

What did you mean with "Signal K key output" and "Signal K full output"?

toqduj commented 7 years ago

OP has a user interface to set up the MQTT topics. The topic can be set freely, the content (input only at this point), can be selected to be: "Signal K key input": a topic whose input is supposed to be just single values. These get mapped to a particular SK key. "Signal K delta input": A topic whose input can be Signal K deltas. This is what I use.

I was hoping to be able to get:

tkurki commented 7 years ago

mqtt-gw plugin provides what you're after I think. Take it for a ride. There isn't much code, easy to see what it is doing.

toqduj commented 7 years ago

Ok, I'll have to try and install it on top of an OP install. Any tips for that?

tkurki commented 7 years ago

How fresh is the OP Signal K server and how do you update it? Other than that the mqtt gw is available in the SK Node server app store.

But if I were you I would install a local version of SK server on whatever desktop machine I use and play around with that.

toqduj commented 7 years ago

The OP server is the very latest beta, updated via the OP interface. Isn't that a SK-node install anyway? It's tempting to try to install anew with https://github.com/SignalK/signalk-server-node , but I suspect I'll be losing functionality I'd otherwise have automatically, requiring some manual labour to get this back up again.

Then again, the node "shop" is nice...

toqduj commented 7 years ago

I have managed to install the mqtt-gw plugin from the SK node server app store on top of the openplotter install. It wasn't completely hassle-free, I had to install the following packages before the gw install worked:

(error, missing zmq.h)

sudo apt-get install libzmq3-dbg libzmq3-dev libzmq3

(next error, missing dns-sd.h)

sudo apt-get install libavahi-compat-libdnssd-dev

After this, it installed. I haven't looked at whether it outputs data yet.

toqduj commented 7 years ago

Bonus: after installing libnss-mdns and avahi-utils, it now advertises the SK services over Bonjour. Useful for e.g. WilhelmSK to autodiscover the "boat"

tocan commented 7 years ago

I am trying at the moment to conect my EPEVER Tracer with signal k. Can someone help me in this topic? I like to use influx db, and pymodbus library. I do not use cable I do complete all with an ESP8266 as a virtual hub with so cat.

tkurki commented 7 years ago

@tocan I use ESP8266 with my SK server for temperature monitoring by sending Signal K deltas to SK server over UDP. The server then stores all SK data in InfluxDb, with Grafana for graphs.

However this is not the correct issue for getting support for this. Please join signalk-dev.slack.com or use OpenPlotter forum at http://forum.openmarine.net/forumdisplay.php?fid=1.

tocan commented 7 years ago

for signalk-dev.slack.com i need a invitation and in the forums of open marine there seems not so much interest to develope together a solution but i see in downloads that a lot of people seem to have epever A or B series at their boat. I am not a programmer and englih skills are rare. We do here all things with try and error and for signal k and such things you need advanced knowledge because still the documentation sucks in step by step examples. If i get an intrance i can do like i have done in steps a documentation of signal k in German language and than romanian. but the use of git we do not understand so a translation we can do at sourceforge is more easy to handle for us.

regards Daniela

2017-09-04 7:53 GMT+02:00 Teppo Kurki notifications@github.com:

@tocan https://github.com/tocan I use ESP8266 with my SK server for battery monitoring (voltage & current) by sending Signal K deltas to SK server over UDP. The server then stores all SK data in InfluxDb, with Grafana for graphs.

However this is not the correct issue for getting support for this. Please join signalk-dev.slack.com or use OpenPlotter forum at http://forum.openmarine.net/forumdisplay.php?fid=1.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sailoog/openplotter/issues/170#issuecomment-326872024, or mute the thread https://github.com/notifications/unsubscribe-auth/AdWFN55f6Du_mA84iNRoZNQiE8Svj0XUks5se5BngaJpZM4OgztT .

-- Tocan Medizintechnik

Südstr. 10 44867 Bochum http://www.tocan.de http://tocan.de/shop/

dmdelorme commented 6 years ago

Hi Tocan, did you find my example of sending signalK from a Tracer charge controller. The Git is a mess but i have been running the code continuously for a while now. I run it via a sh script every 5 seconds. I run node-red on on my laptop and point it to the SK server, or access the SK-instruments page. I ordered the Wifi adapter for the tracer but due to a change in the WiFi chip it was useless.

sailoog commented 5 years ago

MQTT has been rebuilt and integrated into actions. closing.