Error while publishing the data - existing script problem from today

Patrick De Wispelaere on 14 Apr 2022
Latest activity Reply by Patrick De Wispelaere on 17 Apr 2022

Hello, today my Python script is giving error messages "There was an error while publishing the data". It is an existing script that runs for a couple of years already. My local network, Wifi, ... is OK. Rebooting Pi does not help. Is there maybe an issue on the Thingspeak servers ? Kind regards, Patrick (Belgium).

Patrick De Wispelaere
Patrick De Wispelaere on 15 Apr 2022

Dear Vinod, Thank you for your quick answer. I missed the communications about the updated mqtt service, it seems.) I have updated my code according to your example for Raspberry Pi (Websockets port 80). Now the script does not give any errors anymore so I was convinced that it worked. But my new data do not appear in my channel(s), I downloaded the data and latest is from > 1 day ago. Does it take some time to have the newly added "devices" to start working ? Kind regards, Patrick.

Vinod
Vinod on 15 Apr 2022 (Edited on 15 Apr 2022)

Once you've reprogrammed your device. It should be instantaneous. Export the data in the channel. Are you seeing new data in the csv file? If you see no data in the csv file, I would double check the topic you are publishing to and the credentials and permissions. If it is not correct the connection will be dropped.

Take a look at the MQTT API documentation: https://www.mathworks.com/help/thingspeak/mqtt-api.html

Patrick De Wispelaere
Patrick De Wispelaere on 17 Apr 2022

Found the solution: when modifying the topic string to the new code, I forgot to delete the "/" at the end so it had ...."/publish/" instead of the correct ..."/publish". Thank you for your help !

Vinod
Vinod on 14 Apr 2022

Likely that your code uses the legacy MQTT service. We've sent emails for over 6 months warning about it being deprecated. Also, it has been posted here for many months.

You need to make minor updates to your code. See the updated documentation here: https://www.mathworks.com/help/thingspeak/mqtt-basics.html

Tags

No tags entered yet.