UDP Send packets with HA

Hello everybody
i try with this command . . .

Copy to clipboard

platform: command_line'
        command_on: "echo 'TestOn1' | nc -u 9998"
        command_off: "echo 'TestOff1' | nc -u 9998"
        friendly_name: Comando Invioa

but it works only once . . . for send again the packege i need to restart hassio . . . have you some advise for me ?
Very appreciate any suggest

Not sure if this is the problem but I had this issue with another configuration there is an option on netcat to close the connection after x seconds…
-q1 or -w1 for 1 second (depends on your netcat version).

1 Like

[SOLVED] Great Paulo, your advise it is correct.
I modify the command insert -w2 parameter and run perfectly . . thanks again . . .
Now i need to control a feedback by UDP.
Have you exeprience about binary sensor with UDP protocol ?
I try this function see post
Receiving UDP traffic
but with bad result.
Thanks again for your support.