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
#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


Messages In This Thread
SignalK publish in MQTT Server - by hectorl2k - 2019-06-30, 10:45 PM
RE: SignalK publish in MQTT Server - by Opie91 - 2019-07-01, 01:27 AM
RE: SignalK publish in MQTT Server - by hectorl2k - 2019-07-01, 01:39 PM
RE: SignalK publish in MQTT Server - by PaddyB - 2019-07-01, 02:04 PM
RE: SignalK publish in MQTT Server - by hectorl2k - 2019-07-01, 03:23 PM
RE: SignalK publish in MQTT Server - by PaddyB - 2019-07-01, 03:25 PM
RE: SignalK publish in MQTT Server - by hectorl2k - 2019-07-01, 03:50 PM
SignalK publish in MQTT Server - by PaddyB - 2019-07-01, 07:12 PM
RE: SignalK publish in MQTT Server - by hectorl2k - 2019-07-01, 08:12 PM
SignalK publish in MQTT Server - by tkurki - 2019-07-01, 10:01 PM
RE: SignalK publish in MQTT Server - by hectorl2k - 2019-07-01, 10:28 PM
RE: SignalK publish in MQTT Server - by hectorl2k - 2019-07-02, 12:04 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)