arduino-mqtt | MQTT library for Arduino
kandi X-RAY | arduino-mqtt Summary
kandi X-RAY | arduino-mqtt Summary
MQTT library for Arduino
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of arduino-mqtt
arduino-mqtt Key Features
arduino-mqtt Examples and Code Snippets
Community Discussions
Trending Discussions on arduino-mqtt
QUESTION
I'm trying to test MQTT-SN.
I'm using Mosquitto Broker, Paho MQTT-SN Gateway and this library (https://github.com/S3ler/arduino-mqtt-sn-client) for the clients.
I'm using an esp8266 as a client.
With this client, I can connect, subscribe, receive from subscribed topics but I cant publish into topics
...ANSWER
Answered 2019-Nov-27 at 03:20Thank you for the help Dalton Cézane.
But I found the problem in an open issue in the client's library:
Having trouble with your example WiFiUdpMqttSnClient program in that it does not successfully publish the test messages. I'm using paho-mqtt-sn gateway.
I'm bashing around in the dark a bit but I think this is because it publishes the messages with the flag TopicIdType set to 2. I think it should be zero (normal) because it's not pre-registered nor is it a short topic.
In file MqttSnClient.h line 216 the call to send_publish has short_topic set to true. But that's not all; in file mqttsn_messages.h around line 215 if short_topic flag is false it sets the flag to predefined. I've removed the latter 'else' clause so the flag is set to zero and I can now publish successfully.
I suspect my hack is not a complete solution but I hope it helps you resolve this issue.
This comment was made by @nottledim, big thanks!
Now i can publish without a problem using my esp8266.
Just leaving here if anyone has this problem.
link to the issue: https://github.com/S3ler/arduino-mqtt-sn-client/issues/3
QUESTION
I am using a NodeMCU (ESP8266) as a WiFi client to connect to an MQTT broker run on my computer. Using this setup in Windows using WSL (Ubuntu), the MQTT broker seems to work perfectly fine. The ESP8266, however, throws an error in the Serial console immediately when it attempts connect to the MQTT server. WiFi connects without incident.
Please find below a working example of my code:
...ANSWER
Answered 2019-Mar-15 at 17:37You're missing some setup on the MQTT client. Unfortunately, this MQTT library isn't clever enough to notice you didn't set a server name and crashes when you call connect()
without it being fully set up.
You need a call to the begin()
method before you call connect()
.
Try rewriting your connect()
function like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install arduino-mqtt
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page