Hello All,
We are trying to publish 7 variables from ESP32 to cloud over MQTT. We can publish upto 6 variables but still one variables is not been published. What could be the problem?
Changed MQTT packet size to 1024. But still no success.
Pls help
Publishing 10 variables from ESP32 to cloud over MQTT
-
- Posts: 132
- Joined: Thu Nov 15, 2018 2:06 am
Re: Publishing 10 variables from ESP32 to cloud over MQTT
Can you show your source code about mqtt publish?
Re: Publishing 10 variables from ESP32 to cloud over MQTT
Hi,
I'm also trying to push data into the cloud using an HTTP bridge. My problem is that I cannot generate a successful JWT otherwise called a JASON token. I tried using the GoogleIoTCore.h and other Google based libraries for the ESP32 but none have been successful in generating a JWT which I can authenticate using JWT.io. As I understand it you still need the JWT when using the MQTT bridge so I am hoping we share a similarity here and since you can connect and push your data I am hoping you have a solution to my problem.
Kind regards
I'm also trying to push data into the cloud using an HTTP bridge. My problem is that I cannot generate a successful JWT otherwise called a JASON token. I tried using the GoogleIoTCore.h and other Google based libraries for the ESP32 but none have been successful in generating a JWT which I can authenticate using JWT.io. As I understand it you still need the JWT when using the MQTT bridge so I am hoping we share a similarity here and since you can connect and push your data I am hoping you have a solution to my problem.
Kind regards
Re: Publishing 10 variables from ESP32 to cloud over MQTT
publishing part of the code
sprintf(topic, "%s%s", "/v1.6/devices/", DEVICE_LABEL);
sprintf(payload, "%s", ""); // Cleans the payload
sprintf(payload, "{\"%s\":", VARIABLE_LABEL1); // Adds the variable label
sprintf(payload, "%s {\"value\": %s", payload, str_sensor1); // Adds the value
sprintf(payload, "%s } }", payload); // Closes the dictionary brackets
Serial.println("Publishing data to Ubidots Cloud");
Serial.println(payload);
client.publish(topic, payload);
client.loop();
delay(500);
the above is repeated for all variables.. but only 6 is published
Re: Publishing 10 variables from ESP32 to cloud over MQTT
Instead of passing payload, you should pass &payload[payload_len]. Then update with payload_len = strlen(payload). I'm not sure that sprintfing payload back on to itself is safe.
John A
John A
Re: Publishing 10 variables from ESP32 to cloud over MQTT
what is the maximum number of sensors that can be connected to ESP32?
How many analog input channels are available for connecting sensor input for ESP32 DEVKIT with 30 pin version
Regards,
Lavanya.R
How many analog input channels are available for connecting sensor input for ESP32 DEVKIT with 30 pin version
Regards,
Lavanya.R
Who is online
Users browsing this forum: No registered users and 45 guests