When sending the config for a device to MQTT, if I include a unit of measurment that is UTF-8 encoded it causes the mqtt host to drop the connection with the error:
mqtt | 1697055412: New connection from 192.168.1.62:50046 on port 1883.
mqtt | 1697055413: New client connected from 192.168.1.62:50046 as enviro_plus (p2, c1, k0, u'ha').
mqtt | 1697055413: Client enviro_plus disconnected due to protocol error.
I’ve tried encoding the string using “µg/m³”.encode() but no good.
How do I set the device class properly via MQTT auto-discovery?
I don’t know if this will help, but I use an HA script that publishes auto-discovery MQTT topics for my devices that don’t have auto-discovery. I seem to be able to copy-paste various units of measure symbols directly into the UI and when I publish it, the MQTT Broker/Client works without any problem.