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.

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SignalK diagnostic, path duplicate ?!
#1
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
  Reply
#2
Could you check and compare the SK output in your browser?

localhost:3000/signalk/v1/api/vessels/self
  Reply
#3
(09-09-2019, 07:12 AM)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
  Reply
#4
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
  Reply
#5
(09-09-2019, 12: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.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)