Help with tcp/udp listner

Hi,

Can anyone point me in the right direction?

I need to set up a TCP or UDP listener, that listens for commands like this:

2=0

2=2

4=2
4=0
4=2
4=0
2=0
1=2
1=0
2=2

The first number eq 4 is the device, that sends status and 0 is off, and 2 is on.

Have a look at this. This will create the listener. Your job then would be to actually do something instead of simply echoing the message.

I think I posted one for RTI remote a long time ago you could reuse.

There’s a TCP Sensor component available.

There’s also a custom component for receiving UDP.

FWIW, I also had a need to receive UDP traffic (from my phone). I already use Node-Red so I created a simple flow to receive UDP traffic and re-transmit it as MQTT topics. In Home Assistant, I simply added a few MQTT sensors to subscribe to the topics.