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
SignalK publish in MQTT Server
#1
Hi,

I am using Arduino to get humidity and temperature for a trial…. Angel

I am sending it to and raspberry pi 3 b+ through a MQTT server every 2 seconds

I installed OS Open plotter Noobs.

I subscribed to the topic that received the information from the Arduino and we can see the value on the signal k server.

When i subscribe to more than 2 topics it stopped reading the value and signal k start to publish very very fast i think the last value.

If  I disconnect the Arduino it continu to publish,
 and if I publish manually a value it show it just one time, and don't repeat it but repeat an other value. 

If I delete topics and come back to only one, it is becoming ok again quite and soft.every 2 seconds

How can we say to the signalK to don't publish in the topic of the value ?  

Thanks in advance


Hector
Reply
#2
Are you using the MQTT tab to subscribe and convert to signal K? If so I had the same exact problem, once you subscribe to more than two items the MQTT server goes crazy.

You can accomplish the same thing in node red without all the problems.

   
Reply
#3
(2019-07-01, 01:27 AM)Opie91 Wrote: Are you using the MQTT tab to subscribe and convert to signal K? If so I had the same exact problem, once you subscribe to more than two items the MQTT server goes crazy.

You can accomplish the same thing in node red without all the problems.

I want to use the signal k for WilhelmSK application in my iPad 
But again it sending  the value with inverted commas !
See below :Connection Log:
   Config: Host: 192.168.0.124 Port: 3000 REST: http http://192.168.0.124:3000/signalk/v1/api/ WS: ws://192.168.0.124:3000/signalk/v1/stream SSL: NO
   Connecting to websockets with ws://192.168.0.124:3000/signalk/v1/stream?stream=delta&subscribe=all
   Sent GET http://192.168.0.124:3000/signalk 200
   Received json: {
    endpoints =     {
        v1 =         {
            "signalk-http" = "http://192.168.0.124:3000/signalk/v1/api/";
            "signalk-tcp" = "tcp://192.168.0.124:8375";
            "signalk-ws" = "ws://192.168.0.124:3000/signalk/v1/stream";
            version = "1.16.0";
        };
    };
    server =     {
        id = "signalk-server-node";
        version = "1.16.0";
    };
}

Vessel Data:
{
  "environment" : {
    "outside" : {
      "humidity" : {
        "meta" : {
          "units" : "ratio",
          "description" : "Current outside air relative humidity"
        },
        "value" : "0.332000",
        "$source" : "OPnotifications.MQTT.humidite",
        "timestamp" : "2019-06-30T21:14:54.102Z",
        "values" : {
          "OPnotifications.MQTT.humidite" : {
            "value" : "0.332000",
            "timestamp" : "2019-06-30T21:14:54.102Z"
          }



Any idea to release the inverted commas in the stream ?
Thanks
Reply
#4
I found it was easier to send the data straight to signalk, this sends it over wifi and serial, from memory arduinojson library needs to be before 6.0.0



Code:
/                     send signalk data over UDP
//      *******************************************************
void sendSigK(String sigKey, float data)
{

 if (sendSig_Flag == 1)
 {
   DynamicJsonBuffer jsonBuffer;
   String deltaText;

   //  build delta message
   JsonObject &delta = jsonBuffer.createObject();

   //updated array
   JsonArray &updatesArr = delta.createNestedArray("updates");
   JsonObject &thisUpdate = updatesArr.createNestedObject();   //Json Object nested inside delta [...
   JsonArray &values = thisUpdate.createNestedArray("values"); // Values array nested in delta[ values....
   JsonObject &thisValue = values.createNestedObject();
   thisValue["path"] = sigKey;
   thisValue["value"] = data;

   thisUpdate["Source"] = "ESP32";

   // Send UDP packet
   Udp.beginPacket(remoteIp, remotePort);
   delta.printTo(Udp);
   Udp.println();
   Udp.endPacket();
   delta.printTo(Serial);
   Serial.println();
 }
} //___________________________________________________________
Reply
#5
PaddyB,

Why the version of arduinojson need to be before 6.0.0 ?
Hector
Reply
#6
(2019-07-01, 03:23 PM)hectorl2k Wrote: PaddyB,

Why the version of arduinojson need to be before 6.0.0 ?
Hector
Can't remember exactly, but something changed after 6.0.0 and it wouldn't work. But solved the problem of mqtt sending everything as text.

Sent from my SM-T813 using Tapatalk
Reply
#7
At the finals I am looking to install 4-5 arduinos (Wemos D1 R2) who send different captor's value.

Do the arduino should send in signalK format (vessels name, ....) or just the name of the captor an the value and then, SignalK server on the openplotter will translate and combine all infos

Also how to see the logs of the signals K server, on openplotter. I have tried to see them in Web interface in the tab "LOGS" but they are nothing is showing.

thanks in advance,

Hector
Reply
#8
Each message gets sent with its own SignalK key like electrical.batteries.MainBank, that's all signalk needs. The log files are just text files, so you can just double click to open them. Can't remember where they live though Smile
To look at data the influxdb database works really well, there's a sigK app to write the data and another prog called chronograf which makes viewing easy.

[Image: WeC3tSj_d.jpg?maxwidth=640&shape=thumb&fidelity=medium]

Sent from my SM-T813 using Tapatalk
Reply
#9
thanks !!!!

I think i succeed to send the info to the serveur udp. Can you confirm me I must send the value to the port 3000. (my signal K web interface is port 3000).


 Because I see nothing enter 

Thanks,

Hector
Reply
#10
If you are using UDP you must add a UDP incoming connection to your server: Signal K server Admin -> Server -> Connections -> Add -> Signalk K, UDP, then the port you are using when sending. Save and Restart.

UDP port is independent from the server’s http port that you see in a browser - they are different things.

You can test that your RPi is receiving the UDP messages with

nc -l -u <yourport>


Sent from my iPhone using Tapatalk
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)