I'm NOT home

Hi, I used to use owntracks to send location info to my hass android app, but since the latest update it comes with a native location tracker, which is great, even though it does not work for me.
My needs are simple: When I’m home, I want hass to know I’m home. When I’m not home, I am not home. binary 1/0, I don’t need live GPS tracking of my position and over the air communication to my pi. So all these geotracking systems are probably an overkill and also don’t work for me, because my app cannot talk to my pi when it is not in the WiFi.
Consequently, WHEN the app is in the WiFi zone it is automatically home. Can hass note that, and set it to NOT home, whenever it loses connection? Right now it just maintains the ‘home’ state, even though I am at work…

Thanks

Use ping, or router integration for a device tracker.

I’m seeing the same issue on my android.

Did you already enter this in your configuration.yaml

mobile_app:

I’ve read about issues when you setup your android app while the config is not in place on Hassio

Here is what I have to check if my mobile phones are connected to the LAN in Wifi:
for a Fritz Box Router (router integration):

# 
# Enable device tracking on the router
# 
device_tracker:
  - platform: fritz
    host: 192.168.2.1
    interval_seconds: 15
    consider_home: 60
    new_device_defaults:
      track_new_devices: false
      hide_if_away: false

Or you can use NMAP (equivalent to a ping but your phone needs to have a fix IP address on your lan):

#
#  Device Tracker
#
device_tracker:
  - platform: nmap_tracker
    home_interval: 10
    hosts:
      - 192.168.1.200

Thanks for your tips.
So you write that in your configuration.yaml? Can I just paste it anywhere there?
How can I see if it works/registers new devices etc.?

Also, is there a quick way / commandline to check if my router does Device Tracking? I couldn’t find such an option on my router, but it has something called “LAN Discover” where it lists all connected devices.

I’m not 100% sure, I just entered it in my config and I haven’t left the house yet

There’s an issue about it on the github page:

Someone suggested it there, also something about that the app should complain or simply not install when that config is not in place

I’m really hoping this works, I’ve already went down the nmap path, and my router did not work well with HA

EDIT:

For my router (it’s just an AP) I tried to pull the arp table from snmp, so you could try snmpwalk. Worked on my AP but the arp table or client list were not in the data :roll_eyes:

For NMAP, you need to install some software if not already installed, see below for more details:

You have to give a fixed ip address to your phone on the Lan… Than you track it with HA.

For the router integration, I just searched in home assistant the brand of my ADSL router and found the procedure for router integration…

Both approaches are working… I read that the NMAP solution is consuming more battery on the phone… but I have no choice to use it as the router on my second location is not integrated within HA.

Okay, wow, that link was extremely helpful. I have now setup the NMAP service in my configuration.yaml, because I don’t have a Fritzbox and I couldn’t find a device tracker on my Sagem router.

I feel really stupid now, but what’s next? How can I see if my device was discovered? In NMAP there is no option to give the discovered device a name or anything. Reminder: I want to create an automation in hass.io that in it’s simplest form says “turn lights on at 7am, except when my phone is not in the zone”.

Is it an event, or a service or something i need to manually trigger to get a ping?

If I remember correctly the nmap scans every 3 or 10 minutes, then the device will be listed in know_devices.yaml
From there it should simply be an automation like that.

But I’ve stopped using nmap cause not really reliable for me, sometimes my phone does not get discovered, like at night. I think it disables wifi to save energy but I’m not certain on that…

I’m waiting on location through the app, far easier when it works

When you have the fixed IP address of your phone (you need to do that on your SAGEM router by assigning an IP address to your phone Mac Address)… Than you enter the following lines in the configuration.yaml file:

device_tracker:
  - platform: nmap_tracker
    home_interval: 10
    hosts:
      - <your phone IP address>

You have to restart HA. A device will be created (when discovered for the first time on the LAN) starting with : “device_tracker.”, you can see it in the development tools (tab: states)… You can use that name in your automation.

Cool, it works now :slight_smile: Thanks so much!