Home Assistant Community

Question: can Hass send single-byte MQTT messages without UTF8 conversion?


Here’s my problem: I’m looking to send a degree symbol ° (hex 0xB0) to an external device. Every method I’ve tried to get Hass to send this character results in the two characters 0xC2 0xB0 being sent.

Things I’ve tried:

payload: "°"  # < hass pukes on this one, error: 'utf-8' codec can't decode byte 0xb0 in position 852: invalid start byte
payload: "\xb0" # 0xC2 prepended
payload_template: "{{states.sensor.weather_temperature.attributes.unit_of_measurement[0]}}" # 0xC2 prepended

at PowerShell command line I can use the following:

mosquitto_pub -t 'test' -m '°'

And the result is the single byte 0xB0 as I would expect.