UDP Send packets with HA

Hello everybody
i try with this command . . .

Copy to clipboard

platform: command_line'
    switches:
      comandoa:
        command_on: "echo 'TestOn1' | nc -u 192.168.1.136 9998"
        command_off: "echo 'TestOff1' | nc -u 192.168.1.136 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
Bye
Paolo

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).
https://community.home-assistant.io/t/integration-for-sengled-boost-led-wifi-router/197268/2

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.
Bye
Paolo