Ping (ICMP) Binary Sensor Stopped Working

I’ve been using the subject sensor for some time now. Specifically, I took my example directly out of this documentation.

I recently noticed it had stopped working. I’m not sure if it was at the same time I updated to HA 0.100.3 or not. I’m running HA on a Raspberry Pi 3B+.

I’m getting “Entity not available: binary_sensor.internet_connection.”

In fact, I can’t find any reference to this entity in HA.

My Configuration.yaml file contains the following, which hasn’t changed since May:

# Internet Status: ping host with 2 packets every 60 seconds.
  - platform: ping
    count: 2
    scan_interval: 60
    name: Internet_Connection

I’m wondering if anyone else has this issue, or even where to start looking to diagnose it.

I can ping the host from other machines on my network, so it’s not that.

Thank you!

Any errors in your log related to it?

Im experiencing the same thing. On 0.100.2.
Reboot seems to fix it for a some amount of time but then stop working again.

As it turns out, yes. I didn’t notice it at first:

…ERROR (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key “binary_sensor”. Check lines 151 and 182.

Earlier, I’d added another example that also started “binary_sensor:” That one worked fine. And it passed the “check config” validation successfully, even with both entries, so I didn’t notice then. In the past, stupid mistakes like that were caught in validation. I’m a bit surprised to learn I can’t count on that any more.

I’m not sure I’ll ever figure out the intricacies of YAML.

At any rate, both examples are working fine now, under the one “binary_sensor:” heading

Thank you for pushing me to review the logs one more time!!!

No problem. Yep, there can only be one of each key in configuration.yaml. There are two ways of accomplishing this.

Also, the UI configuration check currently misses some problems. Always good to run the config check command instead of using the UI button.

Thanks again!! Both links were very helpful.

I sort of got the gist of these YAML differences before, but as a relative newbie it’s hard enough to keep straight the hierarchical nature of all the different entries. Then to find there are two fundamentally different ways of implementing them, with some examples written to assume one style, and some written to assume the other, complicates things even more.

Some day maybe I’ll become fluent in this stuff. Meanwhile I’ll try to absorb as much as I can.