On Fri, 27 Aug 2021 14:02:19 +0100, PeterMerchant wrote: > Patrick, I am most grateful for your comments. You obviously know a > lot more about MQTT than I.
I wouldn't say I know a lot about MQTT, and I did not mean to imply that I do. I have a fairly basic high-level understanding of it, but I've forgotten most of the lower-level details I previously had a light grasp of! I haven't looked at paho-mqtt or Arduino MQTT before, so for my own understanding I had to go back over the basics that you are probably used to dealing with. I may well have learnt more from trying to find the problem in your code than you will have learnt from me! I didn't want to make any assumptions about what kind of data your system was sending and how it was packaging it up and unpackaging it, because there is potentially more than one MQTT client library for Python, and there is certainly more than one way to encode an MQTT payload. For example, some people might use Google's Protocol Buffers or another serialisation scheme to encode program objects into bytes and then stuff those into an MQTT payload. Others might define a scheme of their own. In your case, it is ASCII text (a perfectly valid option). Just in case it was unclear to anyone: when I said the payload is bytes, rather than a text string, what I meant was that it is not a Python text string object, and MQTT does not require it to encode a text string. However, in this particular program it does encode an ASCII text string, so in that sense it IS very much a text string, and Python makes it easy to treat it as one. Patrick -- Next meeting: Online, Jitsi, Tuesday, 2021-09-07 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk