I need to create actions (like, TV on) basis UDP commands that are issued from a 3rd party system to HA.
I have successfully setup outgoing UDP commands (so HA sends UDP to an IP address) however I am struggling to set this up the other way around.
I have read that TCP sensors exist, but I don’t want to “monitor” a sensor, I need to have a port continually listening for UDP and then HA responds to these commands instantaneously.
Outgoing is easy. You don’t have to bind to a port.
TCP is slightly easier because the protocol will negotiate the session for you, and HA can initiate it.
Being able to parse random UDP message is going to require a custom application.
You can give this a shot:
But I can’t confirm how well it works.
Otherwise, you can write a quick python app that listens for udp events and sends the events via the RESTApi to home assistant. This would be a little app that just runs along side your HA instance (or on any remote PC if you wanted).
That udp integration is just a custom. You basically copy the entire folder to one at /homeassistant/custom_integration and reload and BAM, you have it and can use it like any other…assuming it’s up to date lol.
Yeah, TCP would be easier because there is already a supported TCP integration.
FWIW, if your system already has Node-Red installed, you can use Node-Red’s UDP node to receive data and consume it in Home Assistant. If you don’t have Node-Red installed, as mentioned by jocnnor, receiving via TCP is simpler and only requires the TCP integration.
If you believe there ought to be a native UDP integration, you can cast your vote here: