Why isnt my MQTT sensor showing up in HA?

here are the configuration and state messages observed by running mosquitto_sub to peek at mqtt traffic:

homeassistant/sensor/feeder_24hr_feeds/config {"unit_of_measurement": "", "state_topic": "homeassistant/sensor/feeder_24hr_feeds/state", "name": "Daily Feeds"}
homeassistant/sensor/feeder_24hr_feeds/state 13

and Home Assistant is receiving the messages, i see this in the logs:

2020-03-11 09:04:44 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor feeder_24hr_feeds

but no sensor ever actually appears under dev_state. any idea why?

Your auto discovery message lacks some fields required. Read the mqtt discovery docs again.

the docs only list one required field.

Try this :

{"name":"Daily Feeds","state_topic":"homeassistant/sensor/feeder_24hr_feeds/state","unit_of_measurement":"","unique_id":"feeder_24hr_feeds","device":{"identifiers":["feeder_24hr_feeds"],"name":"feeder_24hr_feeds","model":"DIY","manufacturer":"DIY"}}

Tested, shows up :
image

i see what my issue was. the “name” was used as the entity name. i thought this name was a friendly name and that the entity name would come from the object id in the topic.

Thanks