Allowed device_class for "Number"

Hello,

I am developing some mqtt auto-discovery.
I have some data, that I would like to pass, that is a plain number and does not fit into the existing device_classes (e.g. a pure counter, some valve-setting in percent, …).

I create my payload

      device_class="None"  
      entity_type="number"  
      unit_of_measurement="None"
    config_topic = f"{device_name}_{entity_type}_{entity_name}"
    config_payload = {
        "device_class": device_class,
        "name": entity_name,
        "unit_of_measurement": unit_of_measurement,
        }

The docs say:

A full list of available number device classes is below:

  • None: Generic number. This is the default and doesn’t need to be set.

Still, I get an error:

2024-01-22 23:22:22.202 ERROR (MainThread) [homeassistant.components.mqtt.mixins] Error ‘expected NumberDeviceClass or one of ‘apparent_power’, ‘aqi’, …, ‘wind_speed’ for dictionary value @ data[‘device_class’]’ when processing MQTT discovery message topic: ‘homeassistant/number/UVR_TADesigner_number_solstart_z_hler_startversuche/config’, message: ‘{‘device_class’: ‘None’, ‘name’: ‘solstart_z_hler_startversuche’, ‘state_topic’: ‘homeassistant/number/UVR_TADesigner/state’, ‘unit_of_measurement’: ‘None’, ‘value_template’: ‘{{ value_json.solstart_z_hler_startversuche}}’, ‘unique_id’: ‘uvr_tadesigner_number_solstart_z_hler_startversuchexxxzzzaaa’, ‘device’: {‘identifiers’: [‘uvr_tadesignerxxxzzzaaa’], ‘name’: ‘Uvr_tadesigner’}, ‘platform’: ‘mqtt’}’

What am I doing wrong?

Thanks in advance,
Hendrik

Did you try not setting the device class?
“None” is a string, if you MUST set the deviceclass, try null instead (again NOT in quotes).

None of device_class nor unit_of_measurement are mandatory in the payload of the MQTT discovery topic. If you don’t use them, just do not send them, but "None" is surely wrong as said above.

Thank you. Not providing it did solve my issue.

Greetings,
Hendrik