Publishing 10 variables from ESP32 to cloud over MQTT

Lavanya
Posts: 6
Joined: Mon Jan 07, 2019 6:54 am

Publishing 10 variables from ESP32 to cloud over MQTT

Postby Lavanya » Mon Jan 21, 2019 11:53 am

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

ESP_@In逍遥子
Posts: 132
Joined: Thu Nov 15, 2018 2:06 am

Re: Publishing 10 variables from ESP32 to cloud over MQTT

Postby ESP_@In逍遥子 » Thu Jan 24, 2019 8:31 am

Can you show your source code about mqtt publish?

WizKid32
Posts: 2
Joined: Wed Dec 19, 2018 8:26 am

Re: Publishing 10 variables from ESP32 to cloud over MQTT

Postby WizKid32 » Tue Jan 29, 2019 9:10 am

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

Lavanya
Posts: 6
Joined: Mon Jan 07, 2019 6:54 am

Re: Publishing 10 variables from ESP32 to cloud over MQTT

Postby Lavanya » Fri Mar 08, 2019 7:05 am

@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

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Publishing 10 variables from ESP32 to cloud over MQTT

Postby fly135 » Mon Mar 18, 2019 9:27 pm

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

Lavanya
Posts: 6
Joined: Mon Jan 07, 2019 6:54 am

Re: Publishing 10 variables from ESP32 to cloud over MQTT

Postby Lavanya » Tue May 21, 2019 3:38 am

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

Who is online

Users browsing this forum: No registered users and 20 guests