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 to MQTT reporting [object object] for postion
#1
Hi,

I am using the SignalK to MQTT gateway and want to expose the position to other systems on the ship over MQTT, however it reports [object object] in the MQTT topic for "vessels/self/navigation/position"

Debug output from local MQTT broker on Openplotter where the payload is [object object]

Code:
vessels/self/navigation/position : msg : Object
object
topic: "vessels/self/navigation/position"
payload: "[object Object]"
qos: 1
retain: false
_topic: "vessels/self/navigation/position"
_msgid: "9896dd41.672da"



There are no "vessels/self/navigation/position/longitude" or "vessels/self/navigation/position/latitude" topics showing the local MQTT server either to individually pull the data from.

I know if I use Node red SignalK subscribe node, I can flatten the object to make some data show and create a node red flow to pull signalk data from the local host, process it and push it into MQTT with the data. However, I have SignalK MQTT publishing all deltas, but the I can only get the subscribe node working with one path at a time into MQTT and there are other paths pushing [object object] into MQTT

I want to expose all SignalK paths and deltas to MQTT to then use them via a home automation system to control some switches.

How can I get SignalK to expose the correct values into MQTT without putting the string [object object] into the MQTT topic?

Any help really appreciated.
  Reply
#2
(11-22-2019, 01:22 PM)craig Wrote: Debug output from local MQTT broker on Openplotter where the payload is [object object]

TL;DR: I just published version 1.3.1 that should fix it.


Code:
$ mosquitto_sub -h localhost -t vessels/self/navigation/position
{"longitude":23.5094,"latitude":60.058233333333334}
{"longitude":23.50935,"latitude":60.0582}


Position in Signal K is an object valued property: since it consists of latitude and longitude that should not be handled separately they are handled as a single object with two properties. 

The conversion to something useful was missing, [object Object] is what you get if you convert an object to text naively.

With the new version all object valued properties are published in JSON format as text when publishing to the local, embedded server.
  Reply
#3
Thank you very much for updating and realising a fix, really appreciated.

I'll install and test.

Many thanks

Have a great weekend
  Reply
#4
(11-22-2019, 03:30 PM)tkurki Wrote:
(11-22-2019, 01:22 PM)craig Wrote: Debug output from local MQTT broker on Openplotter where the payload is [object object]

TL;DR: I just published version 1.3.1 that should fix it.


Code:
$ mosquitto_sub -h localhost -t vessels/self/navigation/position
{"longitude":23.5094,"latitude":60.058233333333334}
{"longitude":23.50935,"latitude":60.0582}


Position in Signal K is an object valued property: since it consists of latitude and longitude that should not be handled separately they are handled as a single object with two properties. 

The conversion to something useful was missing, [object Object] is what you get if you convert an object to text naively.

With the new version all object valued properties are published in JSON format as text when publishing to the local, embedded server.

Just wanted to confirm that worked an absolute treat. Solved a problem I've been facing for months. 

Thank you very much for helping, I just wanted to say thank you very much.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)