Ping sensor

It would be nice to have a ping sensor that would store the latency.
(This is not the same as the Ping device tracker, but the code could be almost the same but some parsing would be needed and a target hostname).

https://github.com/home-assistant/home-assistant/pull/7052

Would be nice if you could test it and give some feedback directly in the Pull request. Thanks.

I’ve seen the new Ping (ICMP) Binary Sensor in V0.43 (https://home-assistant.io/components/binary_sensor.ping/).
Is it possible to provide multiple IPs / hostnames when using it? If so: how?
Thanks!

1 Like

Answering my own question here. I used the following in my included binary sensor yaml file:

- platform: ping
  host: bla1.home.tld
  name: Device Name Nr 1
- platform: ping
  host: 192.168.1.2
  name: Some other cool device

Thanks for the sensor, it works as intended!

Im using it the following way

binary_sensor:
  - platform: ping
    host: 192.168.0.1
    name: router
  - platform: ping
    host: www.google.com
    name: google
  - platform: ping
    host: bahnhof.se
    name: bahnhof

sensor:
  - platform: template
    sensors:
      router:
        value_template: '{% if is_state("binary_sensor.router", "on") %} {{ states.binary_sensor.router.attributes.round_trip_time_avg }} {% else %}Offline{% endif %}'
        unit_of_measurement: 'ms'
      google:
        value_template: '{% if is_state("binary_sensor.google", "on") %} {{ states.binary_sensor.google.attributes.round_trip_time_avg }} {% else %}Offline{% endif %}'
        unit_of_measurement: 'ms'
      bahnhof:
        value_template: '{% if is_state("binary_sensor.bahnhof", "on") %} {{ states.binary_sensor.bahnhof.attributes.round_trip_time_avg }} {% else %}Offline{% endif %}'
        unit_of_measurement: 'ms'

homeassistant:
  customize:
    binary_sensor.google:
      hidden: true
    sensor.google:
      friendly_name: 'Google'
      icon: mdi:google  
    binary_sensor.bahnhof:
      hidden: true
    sensor.bahnhof:
      friendly_name: 'Bahnhof'
      icon: mdi:web

Result:

3 Likes

I believe there may be a small issue, then again I could be mistaken.

When I first installed it used to show the attributes in the panel when you expanded the entity.

Now they are missing. Not a big deal. They are still available for extraction but it was nice seeing them at a glance…

3 posts were split to a new topic: Ping sensor not working