August 09, 2020

SignalK, stream data changes

Are You searching for a solution where You want to create graphs and gauges from SignalK(SK) data ?

Use NodeRed(NR), installed as a SK plugin, with the standard dashboard and it's easy to create info as seen in the picture. And this is without a database as InfluxDB and tools like Grafana.

You use the WebSocket interface and subscribe to any change of data from the SK server. 

As input data I'm using the sample file "aava-n2k.datawhich setup is discussed here.

Install NR via SK GUI "Appstore => Available => @signalk/signalk-node-red" and then start the NR flow GUI via "Webapps" and click on the "@signalk/signalk-node-red" box.

Install the "node-red-dashboard" node and then import the NR flow.
Edit the URL in the "WS out/WEB socket in" nodes so it matches Your host, deploy and check out the Dashboard. 

In the flow I'm using 2 ways to subscribe
Please note that in the inject node, "Initialize" has a delay with 60 seconds so that the server has time to stabilize at startup.

The paths to the data is very easy to get via "Databrowser", select "self" and copy the actual path from the grid.

Another way to retrieve could be using the node "signalk-on-delta" which will send a message for every delta, change, on the server.

4 comments:

  1. Importing your NR flow "SignalK_websocket_stream.json", I have the error "Invalid flow: unexpected token < in JSON at position 5". As I know nothing about programming and I only follow instructions I find on the Internet, I am stuck . . .
    By the way, I find your website very helpful, thank you. PVI.

    ReplyDelete
    Replies
    1. A little strange, just tested the import and it works....There are several ways to import, but one easy way is to click on the JSON file, in Github, click on "Raw" and then "Ctrl + a", "Ctrl + c" and then in NodeRed paste the flow with "Ctrl + v".

      Delete
  2. Thank you. It works fine when I follow your instructions. . . something to do with "Raw" so as not to get a htlm-like file when downloading from GitHub. PVI (Sailabout on forum.openmarine.net)

    ReplyDelete

Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !