UDP Listener needed. lightwave TRV

Hello,

I have set about a project to add support of Gen 1 Lightwave RF thermostat radiator valves (TRV).

I’ve modified a copy of the existing HA Lightwave integration for lights/switches (will contribute changes back in due course).
This sets up the TRVs as climate devices, and changing the temperature in HA sends the instruction to the TRV as expected.

The last piece of the puzzle is to update the Climate.TRV status, and also a separate sensor for TRV battery status.

The Lightwave TRVs broadcast their status via UDP.
Outside of HA, I have a python network listener that captures the statuses, and as an initial hack writes them to a file. In HA I then use the file sensor to read the file and update the TRV status. This works as a proof-of-concept. The integration via file is horrid, so my next plan is to replace the file interface via an HA API call.

Before I do this, I welcome suggestions as to how I could do this from the HA platform, rather than an external process.

I have considered a TCP sensor, but decided against this because…

  1. it seem inefficient to poll, when the info is ‘pushed’ via UDP broadcast.
  2. each status message contains several data items, to be pushed to the climate entity and battery sensor.

So my question. Can I create a UDP listener in HA, and have it trigger an activity when data is received? if so, guidance on where to start would be gratefully received.

Sorry for the long message, but wanted to give as much context to the question as I could.

Colin.

For info, I solved the issue outside of HA, but creating a proxy for Lightwave TRVs…
https://github.com/ColinRobbins/Homeassistant-Lightwave-TRV