Setting up Device Tracker when using dnsmasq

Hello cogniscenti,
I am happily using dnsmasq on a separate Raspberry Pi 3 to run as the DHCP and DNS server. HA is happily running in a container on a Raspberry Pi 4.
Please could someone tell me how I can set up a device tracker in HA to use the DHCP server to know which devices are on the network? I’ve had a look on the forum and there is a bit about PiHole and a bit about dnsmasq running in Hassio but I can’t find what I am looking for. Many apologies if this has been dealt with already, please can you point me to the info if it has.

I just setup dnsmasq on a dedicated Pi3 also and want to do the exact same thing.

@papasierra Did you even find anything useful?

Hi @GervaisdeM, sorry nothing received yet.

@papasierra I’m testing something and thought I would share.

I have an Asus router and had to make a bunch of changes recently and have been looking at this integration over the last couple of days. There are settings in there that refer to the location of the dnsmasq.leases file. The default location on the the Asus router is the same as on my dnsmasq installation: /var/lib/misc/dnsmasq.leases. Even if that is not where yours is, there is a way to configure the location.


I didn’t look too closely at the integration code as I am not fluent in python. I went ahead and added the following to my configuration.yaml:

  username: pi
  ssh_key: /home/homeassistant/.ssh/id_rsa

It is reporting items that look like the following, but there are not enough items being display for my network. :frowning:

source_type: router
latitude: 35.2465334
longitude:  -116.7666609
gps_accuracy: 0
scanner: AsusWrtDeviceScanner
friendly_name: Galaxy-S8-new-phone-maybe

I’m not certain how accurate it will be… :crossed_fingers:

It seems to me like someone who knows python could look at the asuswrt integration code and make something specific to dnsmasq.