Let's say I've several devices each having a temperature. All messages related to device temperature are published on topics device/1/temerature
, device/2/temperature
, etc. . I handle all messages published on this topic with Python paho-mqtt with a callback function which uses a wildcard expression client.message_on_callback_add("device/+/temperature", ...)
. Is there a way to get the value of the wildcard expression, here +
directly (w.o. need for parsing of msg.topic
)?
No, the callback includes the topic the message was published to.
It is up to you to extract what ever information you need from the topic.