Create an integration to interact with devices in MQTT


I want to my LoRaWAN sensors to be compatible with Home Assistant. So I created a LoRaWAN platform (see this PR), currently compatible with only one LoRaWAN server and one sensor, then I wanted to expand compatibility to other devices/brands.

@balloob commented that each device manufacturer should have its own integration, which I can understand, but he also said

The MQTT integration should be used to make lorawan data accessible in Home Assistant. It shouldn’t be wrapped in a config flow for a lorawan integration.

The data are transferred from the LoRaWAN network server to HASS by MQTT, but what does “the MQTT integration should be used” mean?


It means send your data to an MQTT broker, home assistant has a couple of broker addons or there are many others you can run external to home Assistant.

Then in home assistant use the MQTT integration to connect to the broker.

You can then use mqtt integrations to define entities like sensors or switches manually in yaml. Or…

All of these integrations support discovery. So once home assistant is connected to the broker it can receive retained mqtt discovery messages that were sent by your devices and ask the user it they want to set up new entities that have been discovered with very little effort using the UI.

Thanks, but there is something I do not get: the devices are sending raw bytes so we have to decode them to convert 0x00FCFF to 25.2°C and 100% battery. This is why I created the LoRaWAN integration, and this library in the first place.
Last time I used the MQTT integration it was expected a temperature field already decoded, did I missed a way to provide a decoder?