A custom presence locator in Home Assistant

This post will show how to configure a custom presence locator in Home Assistant using GPSLogger and a personal server.

Presence service based on mobile phones in Home Assistant is now available using Owntracks or Locative. Owntracks works enough, but it’s too much battery consuming. Locative simply does not fit my needs.

I found another simple Android application for GPS trackinig: GPSLogger. Every Android device, with geolocation feature enabled, tracks itself using GPS sensors or WiFi networks. Installing another GPS app will lead to battery drain for sure unless it will use cached data.

GPSLogger can use multiple source: the passive one just get the latest Android known location, without activating GPS sensors or scanning for WiFi networks.

On my mobile phone, GPSLogger is using about 4% of battery so it’s the best tool in my opinion.

Installing the GPSLogger patch

I developed a small patch for Home Assistant, and it has been included in the offical repo.

Configuring Home Assistant

Check the old post and configures zones and automation.

Configure presence using GPSLogger:

    * platform: gpslogger

MQTT configuration and daemon can be removed.

Configuring GPSLogger on Android

Install Logger GPS per Android and configure it like the following:

  • General Options:
    • Start on boot: yes
    • Start on app launch: yes
    • Display Imperial units: as you wish
    • Hide notification buttons: yes
    • Enable/Disable GPS: yes
    • Write to debug file: no
  • Logging details:
    • Log to GPX: no
    • Log to KML: no
    • Log to custom URL: yes and set https://username:password@example.moo.com/api/gpslogger?latitude=%LAT&longitude=%LON&battery=%BATT&device=%SER&accuracy=%ACC
    • Log to OpenGTS Server: no
    • Log to Plain Text: no
    • Log to NMEA: no
    • Performance:
      • Location providers:
        • GPS: no
        • Network: no
        • Passive: yes
      • Time before logging: 60
      • Keep GPS on between fixes: no
      • Distance filter: 0
      • Accuracy Filter: 40
      • Retry time interval for accuracy filter: 60
      • Absolute Timeout: 3

Custom URL can also use API password, just add it to the URL (remember I prefer another security type, and check my previous post).

Start logging, check your known_devices.yaml file and enjoy your light location service.