OpenWRT - Device Tracker

Hello,

I installed openwrt yesterday just to use DeviceTracker, because TP-Link was a buggy mess.
Configured, and it seems to work fine except 1 thing. Every device is “away”.
Do I have to install some credentials to make it work properly?

device_tracker:
  - platform: luci
    host: 192.168.1.1
    username: username
    password: !secret password
    consider_home: 5
    new_device_defaults:
      track_new_devices: False
      hide_if_away: False

Known device:

XiaomiNote4::
  name: Xiaomi Note 4
  mac: 11:EC:22:49:FC:33
  track: true
  hide_if_away: false
  icon: mdi:cellphone-android

I used to use this device_tracker as well (I use LEDE but pretty much same thing) – I tried ubus and luci; it worked for a while but wasn’t reliable. I ended up using nmap + owntracks ultimately (with a BLE Tile as an additional tracker.) – For luci (and ubus too for that matter) there are additional requirements to be done on the router-side to make sure HA has permission to read data (it’s in the help page for it) otherwise it won’t work but from your config above, the HA-side looks correct to me.

Nmap_tracker is working, thanks for the tip. But it says my phone is away after 20 minutes. I guess Android shut down something to prevent battery draining, so it is not so useful for phones.
Any idea how can I prevent that?

Modern Android phones will go into doze/sleep - there are some ways to get around it but nothing worthwhile imo. I would use multiple tracking methods for presence (for example) rather than relying on one alone. As stated, I use three combined: BLE Tile, Android/iPhone and Owntracks running on both:

Owntracks isn’t visible as a device but with nmap+owntracks, it takes the place of using luci/ubus as it detects the phone either by IP address (ie; when awake) or when it enters the Home region.

Works well (for me.)

I am using Ubus with my TP Link router and openWRT. This is working very good as a device tracker. Luc I did not work either for me.

Worked well for me at the start as well (ubus/odhcpd) - Mine is a TP-Link as well (WDR4300) - when I went to SSL on my LEDE/OpenWRT-based router, it broke. Tried luci afterwards, same thing. Ended up using nmap which does the same thing. One thing with ubus I noticed is that it would give false positives in that a device would still be in the dhcp lease table but be offline and the device would show as home.

When it worked, it worked well but I didn’t care to spend the time figuring out how to get it working with SSL or tweak it to rule out false positives.

I had the same problem with Ubus, but after HA version 0.6 this was fixed. A device will appear as not home very soon after going off line.

I started with 0.60.1 and it worked fine until I went with SSL - by the time I figured out how to get Let’s Encrypt working on my router, I’d run out of space and rebuilt it. I’m sure it more than likely works fine but nmap works just the same for me as I scan the entire subnet:

  - platform: nmap_tracker
    hosts: 192.168.1.0/24
    consider_home: 180
    scan_options: " --privileged -sP -Pn -PR "
    track_new_devices: yes
    exclude: 192.168.1.10
    interval_seconds: 30

But to each their own :slight_smile: