[SOLVED] MQTT publish - subscribe


#1

Hi all,

I’m building a .Net client and have got MQTT publishing working just fine. But have struck some issues with subscribing to a topic.

With ubidots I subscribe to my own device publication? Does subscribing work in a 30 day trial? Have I messed up my subscribe topic?

For this topic
“/v1.6/devices/loragateway”

I publish this JSON payload
{
“OfficeTemperature”:22.1
}

with Retain = false, QoS = AtLeastOne

The variable get updated in the dashboard and the value added to the history viewer which is good.

I subscribe to this topic
/v1.6/devices/loragateway/OfficeTemperature/lv
with QoS = AtLeastOnce

But don’t get any notifications

As my software is most likely the problem I tried the same setup with MQTTBox but I don’t get any notifications either. (MQTTBox is a windows store app I use for testing etc.)

Any hints/suggestions?

Is it the QoS settings as other platforms like Losant as sensitive about that sort of thing?

Thanks
@KiwiBryn


#2

Greetings, I am performing a small test and at my side the subscription is working properly:

I share with you my mqttbox setup:

My advise is to use always low letters, as any Ubidots variable API label is capital, so your susbcribe topic should be:

/v1.6/devices/loragateway/officetemperature/lv

hope it helps you.


#3

Hi

Thanks for your prompt response.

By comparing your setup and mine plus a lot of “trial and error” I have found that if I turn on TLS the subscriber stops getting notifications.

Does your setup keep working if you

Regards

@KiwiBryn


#4

If you need to use TLS, you must add the TLS certificate in order to authenticate the server’s identity, just as we specify at our docs.

All the best


#5

Hi

Thanks again

In the docs it’s not clear that you have to install the certificate for TLS to work. Would be good to make it more obvious that this is required, or even better not necessary.

@KiwiBryn


#6

Greetings, thanks for your feedback, I will pass it to the DevOps and marketing team to improve our documentation if needed. Said this, please keep in mind that our docs are just for reference, not tutorials, and as TLS is a security protocol used massively in Internet, we assume that if you wish to use it you have some knowledge about the requirements to implement it, a.k.a, TLS certificates, basics about encryption, secure ports, etc. About your inquiry

the certificates are something that you MUST use, not because Ubidots demands it, but because TLS does. When you surf in Internet using a browser, you use them in the background as most of the browser have already them stored.

I am glad to know that your issue has been solved, let us to know if you have any additional doubt.

All the best.


#7

I am familiar with IoT device development, and of the half a dozen integrations (Microsoft Azure IoT Hubs/Central, AdaFruit.IO, Losant, MyDevices Cayenne etc.) I have done recently ubidots was the only one which required me to install a client side certificate for MQTTs pub/sub to work.

The “or even better not necessary” was about having to install a custom client side certificate.

KiwiBryn


#8

Hi @BrynHLewis, thanks for your comments, they are valuable for us to improve. How did your tests with your .NET script go? This was the initial issue so I would like to know if I can assist you with something else to help you to send data to Ubidots.

I will be attentive.


#9

Hi @jotathebest

I have just got a proof of concept Ubidots plugin for my MQTT LoRa gateway working…

I’m uploading data from a number *duino devices across a 433MHz LoRa (also tested with 868MHz & 916MHz) channel to my field gateway.

The field gateway is an RPI running Windows 10 IoT Core with a Dragino 433MHz Lora hat. The LoRa chipset driver (Semtech SX127X) supports a dozen different vendors’ hats and I have a couple of dozen sample clients available.

Still a “work in progress” so more debugging, functionality testing and soak testing for telemetry only version. Then I’ll get my plugin subscribing to topics and sending messages to my devices.

@BrynHLewis



#10

Hey @BrynHLewis, I just gave a look to your blog and I rellay liked it, would you mind if I contact you with our marketing team? I think that we promote in someway your Ubidots content as I believe that it is really valuable.

All the best


#11

Hi

That would be fine I’m in New Zealand which is UTC+12 at the moment so responses might be slightly delayed.

The initial ubidots article where I get MQTTnet client pub/sub working with your platform.

Then in my blog I cover building simple clients (which high school students use)

I’m working on posts about building battery & solar powered clients and server side versions with binary packed payloads for payload size reduction + AEAD for payload privacy and tamper resistance.

Then the initial version of my MQTT Field gateway (with the ubidots plugin) is here

Bryn


#12

Thanks Bryn, I have just shared your contact with our marketing team.

Have a nice rest of your day