Owntracks and Nmap = arrgghh

Hello, I am new to this but have been playing around with HA for a week or 2. I have mosquitto and HA on a RPi and I am using Owntracks and Nmap on mine and my wife’s android phones. On mine everything works as it should Owntracks tracks when phone is in my pocket etc. My wifes needs to be manually pushed to update, hence why I added Nmap as well - perfect… but no…

yesterday we were both out and came home and Owntracks still thought she was away, Nmap tried to update her as home so it kept flip flopping between home and not home. Own tracks won and HA thought she was away. Is there any way if one of them says she is home it overrides the other one please??

Cheers
Mark

I haven’t figured out how to make those two services work reliably. IMO its crap, simply not working, absolutely unreliable. Is the only thing that I don’t like of HA (presence detection). I tried GPSlogger, owntracks, nmap, netgear … nada

GPSlogger and Nmap is working perfectly in combination here.

would you mind sharing your setup for presence detection

2 Likes

with that indentation??

ANd you don’t have gpslogger?

Yes, I use gpslogger.

interesting thanks. So GPS logger works with zones?

If you put both devices in a group, the group will be ‘home’ if one of the items in the group is home. You use the status of the group for your automations.

you mean like this? As I already have this and she (we) only have 1 device each
device_tracker:

  • platform: owntracks
    max_gps_accuracy: 200
    waypoints: True

  • platform: nmap_tracker
    home_interval: 10
    hosts:

    • xxxxxxx
    • xxxxxxx

devices

mark_mark:
hide_if_away: false
mac: 0000000000000
name: Mark
picture:
track: true
vendor:

her_her:
hide_if_away: false
mac: 00000000000000
name: Her
picture:
track: true
vendor:

I think you must have combined the entries in known_devices.yaml. There should be a separate entry for both nmap and owntracks in known_devices.yaml.

Then in configuration.yaml you need something like

group:
   mark: devices.mark_nmap, devices.mark_opentracks

Use group.mark as your automation trigger.

I’m afraid I’m doing this from memory, as I decided nmap was sufficient on its own for my purposes, so there may be some syntax errors.

thanks for the replies!
I thought once the device was discovered by 2 trackers, you could pick say owntracks and just add the mac address to that and remove the other? or was I reading something wrong before?

I think there is something written down somewhere that says you can do this. But that does not mean that it is necessarily the best thing to do.

so if I have owntracks and Nmap trackers like this
9cd917222a6a:
hide_if_away: false
mac: 00000000000000000
name: Mark
picture:
track: true
vendor: Motorola Mobility LLC, a Lenovo Company

mark_mark:
hide_if_away: false
mac:
name: Mark
picture:
track: true
vendor:

they both show up in the user panel as either home/away/etc and I have track :true for both as I want to track via both methods. I think I am getting my knickers in a twist :smiley:

If you put the two devices in a group, the group state will be home if either of the devices report as home. Which is what I thought you wanted. If you wanted something else, please explain.

Do as @gpbenton says and put them in a group. Then in your customize section, make device_tracker.9cd917222a6a and device_tracker.mark_mark hidden so they don’t show up in the default view. Or, replace the default view with your own and only put the things you want to show up.

Thanks for the replies both of you. If I do this, how would I get our devices to show up like the snip? as at the moment I don’t group our 2 trackers (phones) so they stay at the top. if I do as you suggest i.e. if I hide both trackers (nmap/owntracks) for each of our phones nothing would show as I have no idea who I would make the group.mark, group.helen to be shown at the top.

I’m probably not explaining myself properly…

I can’t help you there. I don’t really use the UI.

If you really want the single tracker to show up at the top like that without being in a group on the page, I think you’d have to basically create a “virtual” tracker and manage it yourself.

Check out this dicuscussion for one example. That uses an input_boolean and automation, but you could probably also use a template binary sensor with the class set to “occupancy” to achieve similar results, depending on the behavior you want.

For the gravatar image, I think you’ll have to customize the virtual sensor and add the entity_picture. You can get the URL from the attributes of your existing tracker.

Honestly though, it may be worthwhile to figure out why it was flip flopping to begin with. According to the docs, if you combine Owntracks with nmap in the way you did, it should use the state of whichever one reported last. In order for it to flip flop, either one of them was going back and forth or they were both continuously updating with one reporting “home” and the other “not_home”. Either way sounds like an issue with the tracking of one of the components.