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
MQTT and SignalK
#1
Hi,
I've updated to OpenPlotter 1.2.0 alpha... (Haven't tested the bellow in earlier versions so I don't know if version matters)

I'm trying to have the SignalK server subscribe to an MQTT topic (I'm just testing for the moment)
I have an (several in fact but in this case I focus on one only) ESP8266 publishing ambient temperature to the OpenPlotter MQTT server (Mosquitto?) every 2 seconds (remember - just testing functionality) and I would like to have this inserted to the SignalK key environment.outside.temperature (I've selected the Type: "Signal K key input")

I open the MQTT tab in OpenPlotter and try to add an MQTT Topic (the topic my test set-up publish to is boat/temperature) but apparently the "/" is not an allowed character (allowed is 0..9, a..z, A..Z).

(The MQTT server handles all my different multilevel topics fine - it is just the OpenPlotter MQTT <-> SignalK "thing" that I can't get my head around)

Am I understanding this wrongly ? It would be quite clumsy if I have to make my MQTT topic structure absolutely flat (i.e. no "/").....

I know that this is a bad example and I should probably go for a direct UDP message to the SignalK server but I would expect it to work over MQTT as well .

Do I have to go via NodeRed? I can of course use NodeRed could insert data to an SignalK key....

Am I understanding the functionality wrongly or is this a bug (?feature?) ??
/Lars
Reply
#2
(2019-01-18, 02:46 PM)LarsD Wrote: Hi,
I've updated to OpenPlotter 1.2.0 alpha... (Haven't tested the bellow in earlier versions so I don't know if version matters)

I'm trying to have the SignalK server subscribe to an MQTT topic (I'm just testing for the moment)
I have an (several in fact but in this case I focus on one only) ESP8266 publishing ambient temperature to the OpenPlotter MQTT server (Mosquitto?) every 2 seconds (remember - just testing functionality) and I would like to have this inserted to the SignalK key environment.outside.temperature (I've selected the Type: "Signal K key input")

I open the MQTT tab in OpenPlotter and try to add an MQTT Topic (the topic my test set-up publish to is boat/temperature) but apparently the "/" is not an allowed character (allowed is 0..9, a..z, A..Z).

(The MQTT server handles all my different multilevel topics fine - it is just the OpenPlotter MQTT <-> SignalK "thing" that I can't get my head around)

Am I understanding this wrongly ? It would be quite clumsy if I have to make my MQTT topic structure absolutely flat (i.e. no "/").....

I know that this is a bad example and I should probably go for a direct UDP message to the SignalK server but I would expect it to work over MQTT as well .

Do I have to go via NodeRed? I can of course use NodeRed could insert data to an SignalK key....

Am I understanding the functionality wrongly or is this a bug (?feature?) ??
/Lars
I had the same problem. MQTT page will not accept the"/" in the topic name.

Are you using ESPEasy? If so go into the controller page of the ESP8266 and change the "Controller Publish:"  to "%valname%" now your published topic from the ESP will be the value name you give it on the device page.
Reply
#3
(2019-01-29, 03:12 AM)Opie91 Wrote:
(2019-01-18, 02:46 PM)LarsD Wrote: Hi,
I've updated to OpenPlotter 1.2.0 alpha... (Haven't tested the bellow in earlier versions so I don't know if version matters)

I'm trying to have the SignalK server subscribe to an MQTT topic (I'm just testing for the moment)
I have an (several in fact but in this case I focus on one only) ESP8266 publishing ambient temperature to the OpenPlotter MQTT server (Mosquitto?) every 2 seconds (remember - just testing functionality) and I would like to have this inserted to the SignalK key environment.outside.temperature (I've selected the Type: "Signal K key input")

I open the MQTT tab in OpenPlotter and try to add an MQTT Topic (the topic my test set-up publish to is boat/temperature) but apparently the "/" is not an allowed character (allowed is 0..9, a..z, A..Z).

(The MQTT server handles all my different multilevel topics fine - it is just the OpenPlotter MQTT <-> SignalK "thing" that I can't get my head around)

Am I understanding this wrongly ? It would be quite clumsy if I have to make my MQTT topic structure absolutely flat (i.e. no "/").....

I know that this is a bad example and I should probably go for a direct UDP message to the SignalK server but I would expect it to work over MQTT as well .

Do I have to go via NodeRed? I can of course use NodeRed could insert data to an SignalK key....

Am I understanding the functionality wrongly or is this a bug (?feature?) ??
/Lars
I had the same problem. MQTT page will not accept the"/" in the topic name.

Are you using ESPEasy? If so go into the controller page of the ESP8266 and change the "Controller Publish:"  to "%valname%" now your published topic from the ESP will be the value name you give it on the device page.

Hi, no I'm using PubSubClient, don't quite understand what u mean....
Reply
#4
(2019-01-30, 09:46 PM)LarsD Wrote: Hi, no I'm using PubSubClient, don't quite understand what u mean....

Why not send the data as signalk? 

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

 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"] = "ESP11";

   // Send UDP packet
   Udp.beginPacket(remoteIp, remotePort);
   delta.printTo(Udp);
   Udp.println();
   Udp.endPacket();
 }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)