Device_tracker.ping entity not appearing

I have added the following configuration (in a package, but also tried the main configuration.yaml) to track a device with ping, but nothing happens. There’s no debug generated either.

device_tracker:
  - platform: ping
    hosts:
      myhost: 192.168.42.2

I also tried a hostname instead of the IP. The entity doesn’t appear.

I have device_tracker entities from UniFi and the mobile app, but nothing from ping.

What am I missing?

Did you restart after adding it? No errors or anything in the log?
Did you try the ping binary sensor for the same host?

Also why do you need ping device trackers when you have the unifi device trackers already?

Yes I’ve restarted several times, nothing in the log. I will try the binary sensor. Do I need to have the binary sensor enabled as well for the device tracker to work?

The UniFi integration is only seeing WiFi devices and I want to track some wired ones. I guess this is because I only have access points and not the USG. I could also try the OpenWRT device tracker potentially but I think ping would detect the device quicker.

The ping binary_sensor appears but is unavailable. I can ping the target from the shell on the HA server though.

Some confusion, here.

Do you have a device_tracker.myhost ?
And , if so, it doesn’t show home / away as status?

No. It doesn’t appear.

The binary sensor is working, it just took quite a while to become available after I added it. The device tracker was added hours ago and has never appeared.

No you don’t need the binary sensor for the device tracker to work, just wanted to see whether the binary sensor works or not.

You say ping works from the HA server, does this mean from the host or from the HA container?

Both. But that’s as root, and I have HA running as non-root in the container. Damn, that’d be it.

Fixed by installing iputils (which has suid ping) in the container.

2 Likes

Just be aware that you need to reinstall it every time you rebuild the container for an update or similar stuff.

1 Like

I’m using GitHub - tribut/homeassistant-docker-venv: Run Home Assistant as non-root using the official docker image which takes care of running HA as non-root in a container and can install packages on start. I just had to tell it to install iputils.

Finally, some packages on Alpine (Home Assistant’s base image) are buggy if not running as root (like ping).

Of the importance of being thorough when describing a problem, especially when using an “exotic” installation method :wink:

1 Like

Fair comment. Weird that nothing showed in the log though, and the sensor never showed up. I expected it would be present but unavailable in that case.

Actually I think it may have even been preventing other things starting properly, as when I installed the Alpine iputils package on the running system I suddenly got a ton of other HA startup logs about unrelated integrations.