MQTT Topic with random string

Good day All,

Firstly, thank you to all in advance for your assistance.

I have an MQTT Topic that contains a random string. This string changes every 120 minutes. It contains both letters, numbers and special characters. It is a Client ID.

I want to read this into Home Assistant “Untouched” as a string, but keep getting “Unkown” displayed in Home Assistant. Planning on running an automation when ClientID changes.

- platform: mqtt
  state_topic: "server/clientid"
  name: "Client ID"
  qos: 2

All other sensors, such as temperature, humidity that is a “number” displays 100%. Only have issues with “strings”.

Can anyone advise on how to display this string untouched in Home Assistant?

Kind Regards
Jason

[2022-02-09 - Resolved - Turn out that the string was too long]

One thought, probably there is a better way. You could call the mqtt.dump service with the willdcard topic “server/#” . This creates a text file in home assistant, “mqtt_dump.txt” . It contains a comma separated list of both the topics and values.

Thank you @dproffer,

Really learnt a lot from your recommendations which assisted in finding the fault.

I suspect the message is way longer than I originally expected. have not researched the string limits, but I eventually trimmed this string to display the last 16 characters only. This was enough for me to see when the Client ID had changed and trigger the automation I wanted to.

Kind Regards
Jason

Good to hear you figured out a solution!