OpenMarine

Full Version: MQTT and SignalK
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
(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.
(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....
(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();
 }
}