Troubleshooting MQTT-Auto-Discovery

Hi there,

I have configured my device to match the needs of HA for autodiscovery. Seems to work so far. I can see the sensors and even in Grafana I can use them.

Just, my sensors I configured as "device_class" : "None" I do not see them in HA. Monitoring the MQTT topics all seems to be fine.
Configuration topic:

root@zentrale:~# mosquitto_sub -t homeassistant/sensor/wetter-vorhersage-01h-clouds/config
{ "device_class": "None", "name": "wetter-vorhersage-01h-clouds", "state_topic": "homeassistant\/sensor\/wetter-vorhersage-01h\/state", "force_update": "yes", "unit_of_measurement": "%", "value_template": "{{value_json.clouds}}" }

And the state topic:

root@zentrale:~# mosquitto_sub -t homeassistant/sensor/wetter-vorhersage-01h/state
   "clouds": 100,
   "humidity": 68,
   "pressure": 1021,
   "wind_deg": 119,
   "rain":   0.0,
   "snow":   0.0,
   "dew_point":   9.9,
   "temp":  15.8,
   "feels_like":  15.2,
   "wind_speed":   2.2

I found the related docs about device classes but it just states: “Generic sensor. This is the default and doesn’t need to be set.” Does this mean I am not allowed to set the value?

What other reason can exist for devices not to appear in HA? How can I troubleshoot?

Thanks a lot!

You’re setting it to none, which isn’t needed. Remove it from the discovery of there is no device class for it


thanks. I will try this for my device. Allthought this does not make sense to me. Not being allowed to use a default value…

Anyways, I will report!


If there is no device class then you don’t need to specify it. "None" is not a valid device class, so you’re setting it to an invalid type. None is valid, however specifying that in json would be null. Either way, you’re going to run into problems with that if you don’t know what you’re doing in regards to json. So it’s best to just not set it.

Explains it, indeed, and it should be added to the documentation as “None” appears to be a valid type there.

Anyways, tried it without and the sensors appear now absolutely fine.



It is a valid type, but you added quotes around it making it a string. It does not contain quotes in the docs :wink:

Also, keep in mind that the documents are in regards to python & home assistant. Where JSON will be null. So if you’re creating this from your device in it’s UI, you have to follow JSON rules (Or whatever rules are imposed by that UI).

1 Like