Page 1 of 1

Publishing 10 variables from ESP32 to cloud over MQTT

Posted: Mon Jan 21, 2019 11:53 am
by Lavanya
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

Re: Publishing 10 variables from ESP32 to cloud over MQTT

Posted: Thu Jan 24, 2019 8:31 am
by ESP_@In逍遥子
Can you show your source code about mqtt publish?

Re: Publishing 10 variables from ESP32 to cloud over MQTT

Posted: Tue Jan 29, 2019 9:10 am
by WizKid32
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

Re: Publishing 10 variables from ESP32 to cloud over MQTT

Posted: Fri Mar 08, 2019 7:05 am
by Lavanya
@In逍遥子 wrote:
Thu Jan 24, 2019 8:31 am
Can you show your source code about mqtt publish?
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

Posted: Mon Mar 18, 2019 9:27 pm
by fly135
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

Re: Publishing 10 variables from ESP32 to cloud over MQTT

Posted: Tue May 21, 2019 3:38 am
by Lavanya
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