Create an integration to interact with devices in MQTT (LoRaWAN)


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?

Hello @tom_l , community,
Any update on this please?
I would really like to push this further, LoRaWAN devices could be useful to reach far away devices or do tracking


Please don’t tag people demanding answers.

Yes you missed the value_template available in mqtt sensors.

Oh, sorry for the tag.

Regarding the discussion I missed that we can unpack raw bytes, thanks. So we might achieve something for most devices but not all, and some of them would be really difficult to maintain.
At some point I wonder if I should create a separate service like Zigbee2mqtt and an add-on, but it might be less user friendly

I just found out this Github comment by Balloob which clarifies it: if the template is not powerful enough for bytes processing we should create an integration.