As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [mqtt]

MQTT (Message Queuing Telemetry Transport) is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. The MQTT protocol enables a publish/subscribe messaging model in an extremely lightweight way. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium.

Filter by
Sorted by
Tagged with
1 vote
1 answer
508 views

ESP8266 Arduino MQTT callback with dynamic topics

I have a program that depending on user input, it creates one or several objects that will publish data to a MQTT broker, each one with a different topic. This is already done. The ESP8266 also has ...
GonzaloN's user avatar
0 votes
1 answer
626 views

Obtain retained MQTT message

I’m using ESP8266 with Arduino code. Each device posts a ‘state’ and an ‘avail’ messages for a specific topic. I wish to be able to read those retained messages and not only right after connecting ...
guyd's user avatar
  • 917
1 vote
1 answer
2k views

Impossible to connect ESP32 with Mosquitto on Raspberry using certificates

I installed Mosquitto broker in Raspberry in my local network. I generated certificates in Raspberry as follows: sudo openssl genrsa -out ca.key 2048 sudo openssl req -new -x509 -days 3600 -key ca....
Michele's user avatar
  • 29
0 votes
1 answer
607 views

Waking an ESP8266 from Light-Sleep using a signal from MQTT?

I was wondering if it would be possible to wake an ESP8266 from a request over MQTT while it is in Light-Sleep mode? I am planning to implement a smart switch that would receive messages from a ...
mtbot's user avatar
  • 3
0 votes
1 answer
970 views

MQTT PubSubClient connection problem with ESP32

I am experiencing some problems with string in Arduino application with ESP32. I don't understand why this code works: mqtt.setServer ("m20.cloudmqtt.com", port); //is OK and this does not work ...
Michele's user avatar
  • 29
2 votes
2 answers
509 views

Connecting to MQTT causes DHT11 Sensor to stop working?

I have a project I am working on, based on an ESP32 from NodeMCU. I have a bunch of sensors connected to said ESP32 - they all work and the code itself "works" with a minor quirk. The issue in ...
charrold303's user avatar
0 votes
1 answer
823 views

MQTT subscribe callback fails to be called in ESP8266 deepsleep mode

Refer to ESP8266 deep sleep and MQTT I executed the code in the given link. However i am not able to receive the subscribe message that are send from MQTT test broker(MQTT Lens) on the serial ...
Rohit's user avatar
  • 39
1 vote
2 answers
508 views

How to get a list of IPs in a LAN using NodeMcu?

I'm going to create an IoT system. I use a Raspberry Pi as a MQTT broker and as a webserver. Every day, the Pi gets a new IP address, so I need to find its new IP address via ESP8266 to use this ...
sistemofsis's user avatar
2 votes
3 answers
10k views

Convert byte* to int in Arduino

I am trying to convert byte* value to int here is how I have it. void mqttCallback(char* topic, byte* payload, unsigned int length) { String topicStr = topic; int* payload_value; int ...
user3201500's user avatar
1 vote
0 answers
55 views

Arduino clients suddenly not able to connect (or publish) to MQTT

we are struggling with a project that has things (arduinos as clients) communicating to our MQTT broker (mosquitto) running on a DigitalOcean droplet (inside a docker). We have about 200 things at ...
user avatar
1 vote
1 answer
1k views

Notoriously unstable ESP8266 MQTT-client

I am doing a project where an ESP8266 receives data from an Arduino Uno and publishes it via MQTT. After a random amount of time, it will stop sending data to my MQTT broker. It might be an hour, it ...
Vincent Vega's user avatar
0 votes
1 answer
627 views

Mqtt not subscribe on topic that's converted from String to char array

I am still not sure what should be the exact Title for this question, because I don't know where the problem is. I am using #include <MQTTClient.h> mqtt library to subscribe on a topic. This ...
Anum Sheraz's user avatar
1 vote
0 answers
170 views

I can't send GPS data to server

I am trying to send gps location data every 3 seconds to mqtt server if it's updated but my device shows weird stack errors and resets. What i am missing? I am using tinygps++ and pubsubclient as ...
needhelpsomuch's user avatar
1 vote
0 answers
351 views

Real-time Pub/Sub thru MQTT between JoyStick and OnBoard Drive units [both ESP8266] - Connection issues

I looked around for solutions to my issue by searching on the forum and elsewhere and haven't seen similar issues - (https://arduino.stackexchange.com/search?page=2&tab=Relevance&q=MQTT%...
bhanu's user avatar
  • 11
0 votes
3 answers
6k views

ESP-01 not waking correctly up after deep sleep

I have an ESP-01 that I want to measure pool temperature with. It will send the data over MQTT to the broker. I have connected RST to GPIO16 so I can use the deep sleep functionality. Currently I am ...
rebellion's user avatar
  • 147
1 vote
0 answers
2k views

ESP8266 MQTT periodically disconnecting

I use an MQTT to communicate with an ESP8266. I'm using cloudmqtt.com and PubSubClient. Sometimes the ESP disconnects from the MQTT and reconnects. I checked the log from cloud and I got this data ...
Michał Urban's user avatar
3 votes
1 answer
6k views

ESP8266 deep sleep and MQTT

I am working on a project were I am putting my board into deep sleep mode, and it wakes up with an interrupt from a sensor. When it wakes from deep sleep I would like to send a message to my MQTT ...
Paul Carlson's user avatar
1 vote
0 answers
848 views

Arduino and using a SSL secured mqtt broker

I'm looking for a library helping me to connect from an Arduino to a MQTT Broker. Of course I want to secure the connection via TLS/SSL. The "physical" connection is established via a SIM800 module. ...
Dakkar's user avatar
  • 111
0 votes
1 answer
2k views

MQTT - Can lastwill be sent to multiple topics?

I'm using an ESP8266 as an IOT device, with MQTT to send status messages. Each device have its own availability topic, to state its online or offline state ( needed for Home Assistant indication on ...
guyd's user avatar
  • 917
1 vote
3 answers
1k views

Mosquitto TLS over WifiMulti on ESP8266

With these few lines I am able to attach my certificate, tell it to WifiClientSecure the certificate, start the wifi as well as the mosquito pubsubclient: WiFiClientSecure espClient; WiFi.begin(ssid, ...
arthur's user avatar
  • 123
0 votes
1 answer
398 views

How can I call the constructor of a Class after it called once? [closed]

I have a problem with Classes. I have a bunch of code, that code is uses Adafruit MQTT FONA library. I call the Class for make new Instance and Connect to specified server with this code; ...
Muhammed Çağlar TUFAN's user avatar
0 votes
2 answers
1k views

Using MQTT to send time stamp - to Arduino

In previous question in this forum - I asked about updating clock on an ESP8266, using MQTT broker to send a time stamp on demand, in following manner: 1) ESP8266 sends a publish containing the ...
guyd's user avatar
  • 917
1 vote
1 answer
2k views

Use MQTT to update internal clock

I write code to upload to ESP8266. I wish to use time stamp in order to log events. I found an NTP sketch, I can work with ( since it has a wifi connection ), but I wish to keep my code as simple as ...
guyd's user avatar
  • 917
0 votes
1 answer
268 views

Arduino Uno - MQTT message using PUBSUB on ESP8266

I'm trying to write code involving MQTT messages to operate an ESP8266 relay ( a Sonoff device ), using PubSub library. For some, unknown for me, reason - messages larger than 99 chars are not sent. ...
guyd's user avatar
  • 917
1 vote
1 answer
3k views

ESP8266 fail to connect MQTT broker

I am using NodeMCU dev board with ESP8266 WIFI. Every time I try to connect to my local broker it returns this error: failed, rc=-2 try again in 5 seconds I am using Ubuntu 18.04, my local brokers ...
Adis's user avatar
  • 125
0 votes
1 answer
1k views

Unable to Configure MQTT Client ID using Adafruit MQTT Library

I am utilizing the MQTT library that Adafruit has created, located here, and the library itself works wonderfully - however I am finding myself unable to edit the Client ID or configure the PINGRESP. ...
HobarGJ's user avatar
0 votes
1 answer
1k views

String & Char concatenations

A newbie in Arduino- and I'm trying to concatenate string and chars ( well in python it is quite different ). I'm trying to post a MQTT message- constructed following format to the client.publish(...
guyd's user avatar
  • 917
3 votes
2 answers
8k views

MQTT over serial

I'm planning to build a 32 relay IOT node next to my Raspberry Pi. The relays will be controlled by an Arduino Mega 2560. The Pi will run Home Assistant and Mosquitto so I would prefer to communicate ...
pvoj's user avatar
  • 193
1 vote
2 answers
1k views

MQTT bridging with Arduino and ESP8266 - What software should I use?

Sorry for the vagueness in my question, I am just looking for ideas to point me in the correct direction please... I wish to connect many (read: 20+) different sensors to a local wifi network and ...
Rendeverance's user avatar
1 vote
0 answers
587 views

Soft WDT with HX711 and PubSubClient libraries

I'm using NodeMCU 0.9 My sketch crashes if the following 2 include are present in the sketch: #include <PubSubClient.h> #include <HX711.h> I obtain a Soft WDT reset If I do not use ...
Timmy's user avatar
  • 185
0 votes
1 answer
3k views

MQTT not working on ESP8266 (Nodemcu 0.9)

I'm trying to use NodeMCU on my ESP8266 (NodeMCU 0.9) but the board keep crashing and I don't understand why. I tested the mqtt broker using command line and it works perfectly, so I can suppose that ...
Timmy's user avatar
  • 185
1 vote
1 answer
2k views

ESP8266 MQTT client error

#include <PubSubClient.h> #include <ESP8266WiFi.h> //EDIT THESE LINES TO MATCH YOUR SETUP #define MQTT_SERVER "YOUR.MQTT.SERVER.IP" const char* ssid = "YOUR_SSID"; const char* password = "...
arn1m0nd's user avatar
0 votes
1 answer
2k views

Arduino MQTT Bluetooth

Is there a library to use MQTT with a bluetooth module (HC-06) instead of WiFi? If not is there a similar ready for use implementation of a publisher subscriber pattern available?
Curunir's user avatar
  • 101

1
2