WiPy - MQTT - store message into variable
-
Hi,
I am trying to store a MQTT message (number) from topic "vlaky/speed" into the variable "speed_req" but I couldnt find any command how to save it. Do you know any solution to my problem? I am still learning python so I dont know many things.
Thank you for your answer!
-
Hi,
No worries (if, next time you could use the code tags, iebefore, and
after, that would be nice, so I do not have to hand-copy everything).
It seems you are able to print the message right? You'll need to decode the message to a readable int.
What you can do is the following:speed_req = msg.decode("utf-8")