OpenMarine
SignalK diagnostic, path duplicate ?! - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1)
+--- Forum: How do I...? (https://forum.openmarine.net/forumdisplay.php?fid=3)
+--- Thread: SignalK diagnostic, path duplicate ?! (/showthread.php?tid=1980)



SignalK diagnostic, path duplicate ?! - KKempeneers - 2019-09-09

Hi,

After sailing a season with OP I am back to the desk designing new boat related stuff, one of them is a wifi hub for the engine and the weather instrument up in the mast.

So ... while goofing around with an ESP32 broadcasting SignalK updates to OP i noticed that the updates are mentioned twice in the SignalK diagnostic window. 

   

The one that mentions the SRC is frozen while the one without the SRC keeps up with the updates send by the engine hub (simulated data btw).

This is the software used to send the updates:

Code:
 DynamicJsonDocument doc(512);
 // create an object
 JsonObject delta = doc.to<JsonObject>();
 JsonArray updatesArr = delta.createNestedArray("updates");
 JsonObject thisUpdate = updatesArr.createNestedObject();
 JsonObject source = thisUpdate.createNestedObject("source");
 JsonArray values = thisUpdate.createNestedArray("values");
 source["label"] = "ESP Node32s";

 JsonObject thisValue = values.createNestedObject();
 thisValue["path"] = "propulsion.engine.revolutions";
 thisValue["value"]= random(2000,3500)/60.0;
 
 thisValue = values.createNestedObject();
 thisValue["path"] = "propulsion.engine.alarm.oil";
 thisValue["value"]= digitalRead(LED_BUILTIN);

 thisValue = values.createNestedObject();
 thisValue["path"] = "propulsion.engine.alarm.charging";
 thisValue["value"]= !digitalRead(LED_BUILTIN);

 thisValue = values.createNestedObject();
 thisValue["path"] = "propulsion.engine.alarm.temperature";
 thisValue["value"]= !digitalRead(LED_BUILTIN);
 serializeJson(doc, txt);
 // OPwifi
 udp.broadcastTo(txt,55561);
 // Test
 udp.broadcastTo(txt,123456);
}
Json output:
Code:
{
 "updates": [
   {
     "source": {
       "label": "ESP Node32s"
     },
     "values": [
       {
         "path": "propulsion.engine.revolutions",
         "value": 41.68333
       },
       {
         "path": "propulsion.engine.alarm.oil",
         "value": 1
       },
       {
         "path": "propulsion.engine.alarm.charging",
         "value": false
       },
       {
         "path": "propulsion.engine.alarm.temperature",
         "value": false
       }
     ]
   }
 ]
}

What is the purpose of the double entry? Is there something I am missing? 

Koen


RE: SignalK diagnostic, path duplicate ?! - Sailoog - 2019-09-09

Could you check and compare the SK output in your browser?

localhost:3000/signalk/v1/api/vessels/self


RE: SignalK diagnostic, path duplicate ?! - KKempeneers - 2019-09-09

(2019-09-09, 12:12 PM)Sailoog Wrote: Could you check and compare the SK output in your browser?

localhost:3000/signalk/v1/api/vessels/self

http://localhost:3000/signalk/v1/vessels/self gets a webpage Cannot GET /signalk/v1/vessels/self


SignalK diagnostic, path duplicate ?! - tkurki - 2019-09-09

My guess is that your earlier code has produced json with a different source data. The server can handle same path from multiple sources, but it is keeping track of which data is from which source based on the source data.

If you first use one source data value and then switch to another nothing is updating the data associated with the first value. The server will just hold on to its latest data.

If you restart the sk server you should see only one set of data if my guess is right.

I have some more advice on the source data but too long to type on the phone right now...


Sent from my iPhone using Tapatalk


RE: SignalK diagnostic, path duplicate ?! - KKempeneers - 2019-09-09

(2019-09-09, 05:48 PM)tkurki Wrote: My guess is that your earlier code has produced json with a different source data. The server can handle same path from multiple sources, but it is keeping track of which data is from which source based on the source data.

If you first use one source data value and then switch to another nothing is updating the data associated with the first value. The server will just hold on to its latest data.

If you restart the sk server you should see only one set of data if my guess is right.

I have some more advice on the source data but too long to type on the phone right now...


Sent from my iPhone using Tapatalk

Just restarted the SignalK server ... no luck. Still have the duplicates.

I'm looking forward to your advice.