MQTT Autodiscovery implementation in DIY board

Hello everyone,
i have build a DIY board able to communicate through MQTT protocol. Now my next step is to be able to implement autodiscovery for OpenHAB.

I have read all documentation and search into forum but i have not found a clear example of what the board must Publish/Subscibe in order to be auto-discovered by OpenHAB.

Not importat if i have to follow Homie or HomeAssistant conventions.

The board has 4 dimmable light channels, so my questions are:

  • which ones are the topics i have to publish in order to enable auto-discovery of the board and its capabilities (the 4 dimmable light channels)?
  • where i found an example of previous topics payload?

Thank you.

That’s largely because those standards are not created by us. For Homie you need to go to https://homieiot.github.io/ and read their specification and make your device publish and subscribe to topics as defined by that standard.

I don’t know where the HomeAsssitant standard is published.

Hi,
thank you for your reply. I have already read documentation for both “standards” and is quite clear.

The not clear part is how openhab map identify “channels”, since at the moment i was able only to discovery “things”, but no channel is found. I have not found documentation about that.

Any practical example somewere?

You have to make your device publish the information talked about in the spec in the format defined by the spec to the topics defined by the spec. I’m sure there are examples for how to make a device that conforms to the Homie spec on the Homie web sites. There are likely even libraries you can use. If openHAB is not creating the expected channels it is most likely that the device is not following the spec correctly.

You will not find examples here on the openHAB side because this is really outside of openHAB. If your device follows the spec then openHAB will discover it. If not then openHAB will not be able to discover it properly. You can look in the binding code and see details about how openHAB actually performs the discovery but over all that too is largely controlled by the Homie spec.

Thank you for your time, i will read the spec again to be compliant with the spec defined into the spec documentation.