MQTT service discovery

Hi,

I have some custom hardware which I’m integrating into Home Assistant. I’ve chosen to use the MQTT component to do just that and so far so good. Well except for one point.

There are some services/commands that my nodes can call. I can, for example, make them blink a LED for a few second in order to identify themselves (say, the IDENTIFY service). As of now, if I want to integrate these services into the frontend I’m left with manually configuring an “Entity Button Card” with the topic and payload to send to my nodes and use the “mqtt.publish” service. That works. But, on my end, I can dynamically “discover” the nodes and determine the list of services that they can call. And I wish I could pre-populate this list of services in the frontend (or at least the service registry) and reduce the necessity for user’s intervention. But as far as I know, this doesn’t seem possible.

In other words, I wish I could have a topic like

discovery_prefix/services/node_id/object_id

on which I could publish the service specification and have the corresponding service be instantiated, at least, in the list of services inside the developer tools.

So my question is: how would you advice to add a service discovery feature for the MQTT component and still be coherent with the broader HA architecture? Does that even make sense?

Thank You.

Did you read the documentation ?