Nmap setup

still a newbie and working things out. Running the latest hassio on ubuntu 18.04.
I have owntracks setup and it appears to be going ok on my android but my wife’s iphone it just sucks battery.
So I was looking for another presence detection method and thought about nmap.
My router is a draytek vigor. I have our known devices assigned a static ip by mac address in the router.
So my question is this.
I want to detect presence using our wifi - which in our setup (rural) picks up devices from about 100m from home.
Do I just add the following to my config file? And can I specify nmap to track specific ip’s rather than scanning all dhcp addresses?
device_tracker:

  • platform: nmap_tracker
    hosts: 192.168.0.1/100
    Patrick

I don’t think 192.168.0.1/100 is a valid subnet. Other than that it should be OK. In case you missed it, docs are here https://www.home-assistant.io/components/nmap_tracker/

(And I assume “Patrick” is not part of your configuration file. Take a look at point 11 here: How to help us help you - or How to ask a good question)

nickrout,
I appreciate your time. As a HA newbie and a computing novice I’m really struggling at times.

If this helps
Home Assistant 0.95.4 running on intel NUC with ubuntu 18.04
I have very basic setup at the moment with a few sonoff switches (having only recently established a basic understanding of hassio.)

Goal
I want to be able to set my family members and special guests to have automations in lighting (and eventually other components) when they enter my property. I live in a rural area and there is no other light than that provided by my house or the moon. And of course I want the oohs and aaahs of suitably impressed people about how clever I (you guys) are.

That being said I have listened to videos/podcasts from bruh, juantech, superhousetv and others. I flick around the forums. I am NOT a computing knowledge base. I am a good learner though.

My reading and listening indicates that a range of presence detection formats allows a form of redundancy so that if one fails (conflict with back end setup etc) another will effect the change.

I already have owntracks as stated and would prefer that my devices like phone etc are picked up at the range of my wireless network (this network at least has little dropouts as even if power disapears I have a UPS that will provide about 6-8 hours of internet and wireless)

This led me to nmap. Thus my question.
Have just read some more and found the following guide https://hackertarget.com/nmap-cheatsheet-a-quick-reference-guide/
I input the range variable (all my devices that I want are in a small range of static/mac configurations in my draytek) and hassio has them appear in devices.

onward and upward

Patrick (not part of my config)

1 Like

Hi Patrick (not part of your config) :wink:

I use nmap to scan my whole subnet like this:

- platform: nmap_tracker
  hosts: 192.168.0.0/24
  scan_options: "--host-timeout 5s --privileged -sP "
  home_interval: 10

hope this helps. btw if owntracks drains the battery too fast give GPSLogger a try. IMHO more accurate and better for the battery.

:wave:

Void
thanks for the reply. I think I have it working. My draytek router though passes through the device name as device.tracker_(mac address)

My router is a Draytek vigor 2862 and the static Ip address entry in admin profile reads as
IP Address
192.168.0.94
Mac Address 94:BF:2D:15:02:F5
Comment anitaiphone

Is the best way to deal with this by creating a group? and then adding the device tracker entries, so that whichever one is picked up by my home wifi then the automation using node red works.

Patrick

you could define the name of the device_tracker.entity in the known_devices.yaml in your root home assistant folder.

never used NodeRed before, sorry.

you could use an automation that is triggered by the home/not_home state of all your phones

sth like:

automation:  
- alias: notify_homestate
    initial_state: true
    trigger:
      - platform: state
        entity_id:
          - device_tracker.user_devices_phone_one
          - device_tracker.user_devices_phone_two
        from: 'not_home'
        to: 'home'

hope this helps

Void,
sorry - I thought the known_devices.yaml was phased out? It was my impression that the latest way to deal with this was by the person integration?
Patrick

known devices just collects every device_tracker from every platform you’ve added.

person merges multiple device_tracker into one entity.

in short: you got gpslogger, wifi and bluetooth set up for your phone. before person an automation triggers if one more more of these trackers changed from not_home to home (in my case I use and input_boolean that defines if home or not). Now person merges all these trackers.