Adafruit_CircuitPython_MiniMQTT
Adafruit_CircuitPython_MiniMQTT copied to clipboard
refactor will_set function to match the publish function and allow the msg/payload to be encoded bytes, not just str, int or float.
As far as I can understand in reading the specification and talking with our mqtt broker host, there is no reason to disallow the last_will message being sent as bytes (encoded json) in the same way that you are supposed to for all other publish operations. As the last_will is still 'just' a publish operation, albeit a delayed one, this seems logical. Perhaps more controversially, I have changed the use of 'payload' as a key name in last_will to also match the publish function and use 'msg' for the same content. I did so because I believe it will help prevent any future confusion.