Issue In publishing the Wireless Temperature Sensor Data Using MQTT API in Thingspeak | ThingSpeak Apps | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Issue In publishing the Wireless Temperature Sensor Data Using MQTT API in Thingspeak
No permission to create posts
March 13, 2019
8:14 am
Avatar
Tany87
New Member
Members
Forum Posts: 4
Member Since:
January 21, 2019
sp_UserOfflineSmall Offline

Hi,I am publishing the Wireless Temperature sensor data to Thingspeak using its MQTT API. The data is publishing successfully, even I am getting MQTT to publish status in thingspeak. However, the value is not updated in the chart. When I am checking the export data the fields are getting null values.


String strx(rms_x,DEC);
String stry(rms_y,DEC);
String dataString = String("field1="+ strx + "&field2=" + stry + "&field3=" + String(cTemp,DEC));
Serial.println(mqttCli.publish(topicBuffer,dataString.c_str())? "published" : "published failed");

Wireless Temperature Sensor : https://store.ncd.io/product/industrial-iot-wireless-temperature-humidity-sensor/

Suggestions on this will be a great help

March 13, 2019
4:02 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 610
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

Can you try hard coding a string that you know should work?
String dataString = String("field1=123");

Also can you show the topic string you are using? It should have the form:
channels//publish/

https://www.mathworks.com/help/thingspeak/publishtoachannelfeed.html

March 14, 2019
2:04 am
Avatar
Tany87
New Member
Members
Forum Posts: 4
Member Since:
January 21, 2019
sp_UserOfflineSmall Offline

Hi, I had tried the same thing that you suggested but I didn't get the result. I guess the is with the size of the payload
mentioned below is the "Publish" topic which I am using
String topicString ="channels/"+String(channelID)+"/publish/"+String(writeAPIKey);

March 14, 2019
6:55 am
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 610
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

Can you clarify
"The data is publishing successfully, even I am getting MQTT to publish status in thingspeak" ?
Are you seeing the number of entries increase on your channel, but not able to see data on your field charts?
Can you export the data (use the export button on the first tab -for the private view of your channel. Then you can see the raw data.

Are you able to publish via MQTT using a desktop based MQTT client, such as MQTT.fx?
The MQTT documentation has links to download MQTT.fx in the examples section.
https://www.mathworks.com/help/thingspeak/mqtt-api.html

There is also a troublehsooting section:
https://www.mathworks.com/help/thingspeak/troubleshoot-MQTT-publish.html

We have seen may devices with libraries that have MQTT buffer sizes too small to complete the request. You may have to increase the buffer size.

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
28 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

adeeeban, theweddingties, Vasant Gosai, pavithra, shivaniprakash, Akeyan

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457