ICMP binary sensor? aka Is host online?

Hi,

I searched the home-assistant website but couldn’t find anythin about it. I simply want to trigger an action, if a host in my network is available. Is there such a machanism? Something like an ICMP/ping sensor? I came to the device tracker but the group.all_devices state would change to home although I am not at home, just because my NAS has been remotely started.
Did someone else ever ran into the same problem?

I added a new example to Command Line Binary Sensor with shows how to check the state of a system with ping.

Many thanks. I didn’t know about the command line platform. :slight_smile: This will lead to a whole new set of options in triggering events.

Does anyone have a working example they can share?

I am attempting to ping a binary sensor as shown below

binary_sensor 1:

  • platform: command_line
    name: Asus RT-AC66R
    command: ping -W 1 -c 1 192.168.0.3 > /dev/null 2>&1 && echo success || echo fail
    device_class: connectivity
    payload_on: “Up”
    payload_off: “Down”

I have two issues.

  1. The devices appear as “off”, despite the fact that I can execute the command from cli and exit with “success”
  2. Should the payload values override “on” “off”. I am trying to have Up/Down