NetCat Command Line Sensor

Anyone get NetCat working on HASS.IO on a Pi? I’ve got it working on SSH, however in a command line sensor, nothing happens.

‘echo -n ‘‘SA “Dining Room Gain”>2=F\r’’ | nc 10.50.0.70 10055 -w 1’

sensor:

  • platform: command_line
    scan_interval: 10
    command_timeout: 5
    name: BoseDining
    command: ‘echo -n ‘‘SA “Dining Room Gain”>2=F\r’’ | nc 10.50.0.70 10055 -w 1’

Does the command work inside the HA container?

So I’ve tried running it in the Docker Container and it won’t execute. I’ve tried the same command if i SSH in prior to entering the docker and it works. Is there’s some sort of block on using netcat directly inside the home assistant container?

Try removing the -n option from echo. By default, netcat will only send when it receives a newline character, and the -n will have the effect of preventing that from happening, so netcat will be sitting there forever waiting for the end of the message.