I’m trying to create a sensor which senses whether a certain port is open on a device on my network. Home Assistant is happy with my configuration and creates the sensor, but it never switches to on when the port is open. Here is the configuration:
binary_sensor: - platform: command_line name: "Port Open" command: '/usr/bin/nmap -p<port> <ip> | /bin/grep open > /dev/null && (echo true) || (echo false)' device_class: connectivity
I’ve run the command from the command line with the port both open and closed and it works as expected. I’ve even run it inside the docker container running HASS (via
docker exec -it <container> /bin/bash) and it runs fine there too.
I’m also getting nothing in the logs about the sensor.
Anyone have any idea what I’m missing here?
Thanks in advance!