I’m trying to setup a command line sensor as shown in the code below. If I uncomment the second line (and comment the third line), it works as expected. When I run HA with the third line uncommented (and second commented), it doesn’t work.
I’ve been doing this for PCs and printers in my office with NMap and sensor templates. This approach looks a lot more reliable and with less overhead. I’m going to give this a try, @fabaff - thanks!
This is why I try to read all the new threads, even if it’s not something I think may relate to my setup. I usually end up learning something valuable!
You’re correct in that I should probably switch to a binary sensor. I’ve also got a template connected to the sensor which I would probably be able to get rid of.
Anyways, I need to define which port to scan, which is the reason for using the nmap-command. I know for a fact that port 81 on 192.168.0.198 is closed (in fact, the camera I’m pointing on is powered off so the host is completely down). If I run the command in shell I get the expected result:
Same issue here. Bash and PHP script work on the cli. Both Time Out in Hass.
platform: command_line
name: WAN In
command: “/usr/bin/php /home/homeassistant/.homeassistant/bandwidth.php In 16”
unit_of_measurement: mbps
scan_interval: 30