Effacer les filtres
Effacer les filtres

mqtt web sockets code publish.single(topic, payload,....does not work.

1 vue (au cours des 30 derniers jours)
Barnard Richards
Barnard Richards le 22 Mai 2020
Commenté : Barnard Richards le 23 Fév 2021
The example code
Publish Using WebSockets in Python on a Raspberry Pi
does not work.
my python 3 code executes to the last line of the ThingSpeak example code
print ("There was an error while publishing the data.")
I have been successfully using the same channelID, writeAPIKey and mqttAPIKey with a Arduino for some time using code at
How do do I identify the error with the web sockets publish code.
try:
publish.single(topic,payload,...
i can print on Terminal the topic and payload strings. they appear correct.
  4 commentaires
Graham Coulby
Graham Coulby le 23 Fév 2021
You probably already figured this out by now, but generally when you see <> in strings on APIs it means a placeholder. Therefore you must replace the string in the documentation (including the <>) with what is specified inside the <>:
e.g.:
If it states
channelID = "<YOUR-CHANNEL-ID>"
This becomes:
channelID = "1234567".
Did you ever get data on your channel? My arduino connects, and even publishes the message the payload without error to what appears to be the correct topic /channels/<channel_id>/publish/<channel_write_api>. However, no data is received on the channel.
Barnard Richards
Barnard Richards le 23 Fév 2021
Graham, You are correct my Rasp Pi connects and uploads correctly.
I am also uploading from a couple of Arduino MKR1010 successfully.

Connectez-vous pour commenter.

Réponses (0)

Communautés

Plus de réponses dans  ThingSpeak Community

Catégories

En savoir plus sur Write Data to Channel dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by