How to use COAP in custom intergration?

Hello,

I do have a Siemens KNX IoT sensors QPA2892/WI. These are battery powered sensors, which are using Thread for wireless. They offer an API, which can be accessed via COAP REST APi: Swagger UI

After connecting them to an Open Thread Boarder router, I was able to access them with a Python script using the aiocoap library. I also managed to get a PoC for a custom integration into Home Assistant. So far, so good.

I was looking for inspiration from other existing integrations using COAP. E.g, the Shelly or Homekit integration. I was surprised to see, that these use their own raw code for the COAP protocol, and not an existing library like aiocoap.

  • Should I refrain from using aiocoap? If so, why?
  • And is writing raw COAP protocol the way to go?

Many thanks!

Matthias

2 Likes

I have a similar need and am experimenting with going via mqtt using this library: node-red-contrib-coap (node) - Node-RED

As long as the library is asynchronous Iā€™d stick to it. Unless what your are doing is so simple that a full library would be overkill.