MQTT Discovery: how can I suggest a "friendly_name" for a device when I send 'config' topic from it?

I’m working on a custom MQTT device and I succesfully implemented the config and state topics with their data. Now I would like to send some data to suggest the basic “friendly_name” for the device so for the user is not required to change it to get a “human readable” name.

How can I achieve that? I need to use “attributes” field?

Looking at one of my mqtt discovered items I think it is just ‘name’:

{"device_class":"connectivity","payload_on":"online","payload_off":"offline","name":"Mailbox Status","state_topic":"mailbox/status","availability_topic":"mailbox/status","unique_id":"ESPbinary_sensormailbox_status","device":{"identifiers":"redacted","name":"mailbox","sw_version":"esphome v1.14.3 Nov 26 2019, 15:18:06","model":"NodeMCU-32S","manufacturer":"espressif"}}

Thanks, it works very well :slight_smile: I don’t know why when I read documentation I though the name has to be something like a device ID or similar.

In addiction to this, do you have any experience how to use

json_attributes_topic

and

json_attributes_template