Since MQTT v5 was released the year after this question was posted, I'd suggest putitng the sensor ID in the User Properties map of each message. That seems a better place for it as an identifier vs. the topic or the payload. Yes, it will increase the message size, but no more (not much more?) than having it in the topic or payload.