Returns a string that is safe to use as an MQTT topic by removing invalid characters. Replaces any character that is
not alphanumeric, underscore, or hyphen with a hyphen. This ensures the resulting string is valid for use in MQTT
topic paths.
Parameters
raw: string
The string to be cleaned
Returns string
A cleaned string containing only alphanumeric characters, underscores, and hyphens
Returns a string that is safe to use as an MQTT topic by removing invalid characters. Replaces any character that is not alphanumeric, underscore, or hyphen with a hyphen. This ensures the resulting string is valid for use in MQTT topic paths.