Tractive GPS tracker

I have now checked, and do not think it is a time zone issue.

Edit: This workaround is no longer needed with the Tractive integration Tractive - Home Assistant
I will leave this post on here for personal reference.

I have found a workaround to the above mentioned issues.
Since I am not a coder, this might look like a poor man’s solution. :blush:

Reported problems:

  1. The device_tracker state always shows “home” although it is located outside the home zone.
  2. Periodically the device_tracker state shows “away” although it is still in the home zone. This seems to happen, when no GPS coordinates are shown in the attributes of the device_tracker.

My solution was to create a new device_tracker entity based on the data that was provided by the custom component from @Danielhiversen.

Steps:

  1. Install the custom component as described by @Danielhiversen on his GitHub page https://github.com/Danielhiversen/home_assistant_tractive

  2. Add the following lines to your configuration.yaml

proximity:
  home_tractive:
    zone: home
    devices:
      - device_tracker.tractive
    unit_of_measurement: m

and

sensor:
  - platform: template
    sensors:
      tractive_lat:
        friendly_name: Tractive Lat
        value_template: >
          {{ state_attr("device_tracker.yourtracker","latitude") }}
  - platform: template
    sensors:
      tractive_long:
        friendly_name: Tractive Long
        value_template: >          
          {{ state_attr("device_tracker.yourtracker","longitude") }} 
  - platform: template
    sensors:
      tractive_location:
        friendly_name: Tractive Location
        value_template: >          
          {% if states("proximity.home_tractive")|int <100 %} home 
          {% else %} not_home 
          {% endif %}          

Replace the lines “device_tracker.yourtracker” with the entity_id of the device_tracker that has been created by the custom component from @Danielhiversen.

The number “100” in the Tractive Location sensor indicates the distance in meter around the geographic center of your home zone at which the sensor indicates the state “home”. Change it as required to the radius that you desire.

  1. Restart your Home Assistant server. After the restart three new sensors should have been added (sensor.tractive_lat, sensor.tractive_long, and sensor.tractive_location).

  2. Now we have to add an automation that creates and updates our new device_tracker. Use the following lines to create this automation:

alias: Tractive GPS Update
description: ''
trigger:
  - platform: state
    entity_id: sensor.tractive_lat
  - platform: state
    entity_id: sensor.tractive_long
  - platform: state
    entity_id: sensor.tractive_location
condition:
  - condition: and
    conditions:
      - condition: template
        value_template: '{{states("sensor.tractive_lat")|float > 0}}'
      - condition: template
        value_template: '{{states("sensor.tractive_long")|float > 0}}'
action:
  - service: device_tracker.see
    data_template:
      dev_id: tractive
      location_name: '{{ states("sensor.tractive_location") }}'
      gps:
        - '{{ states("sensor.tractive_lat") }}'
        - '{{ states("sensor.tractive_long") }}'
mode: single
  1. After you have created the automation, execute it. This should create a new device_tracker in your known_devices.yaml file. In there you have to change the line “track: false” to “track: true”.

The tracker automatically updates, when any of the three new sensors changes its state. The condition in the automation prevents an update of the device_tracker, when no GPS data is provided by the device_tracker created by the custom component from @Danielhiversen. This seemed to cause the above described problem number 2. Due to this condtion, the device_tracker will not work properly, if you happen to be exactly at the position where the prime meridian and the equator meet (this is somewhere in the atlantic ocean off the coast of Africa) :upside_down_face:.

  1. Restart your Home Assistant server. Now the new device_tracker entity should be visible and indicate the correct state (“home” when inside the home zone and “away” when outside the home zone).

Total newbie to home assistant here and very thankful for the info in this thread.

I am curious if anyone has discovered a way to put a collar into (and take out of) live tracking mode?

Thanks!

Hi,

The API’s are quite easy to handle, but I am not sure yet how to get them into this Add-on for Homeassistant.

https://graph.tractive.com/3/tracker/GEBNUSTG/command/live_tracking/<on,off>
https://graph.tractive.com/3/tracker/GEBNUSTG/command/led_control/<on,off>
https://graph.tractive.com/3/tracker/GEBNUSTG/command/buzzer_control/<on,off>

Raymond

1 Like

Hi there

im still having issues showing the tracker on the “MAP” view on the left. At the lovelace interface map you can create, the view is fine.
Anyone got an idea?

Hello,

I don’t have home -assistant, may I ask you to provide me a small unix shell script for login to tractive and getting the battery charge level or some curl commands for login to tractive and getting the battery charge level
THX

regards

Klaus

Hello,

I installed home-assistant and the add on tractive GPS tracker hopefully correct.

I’m new please tell me how I can use the tractive GPS tracker add on, perhaps you have a sample code for me.

THX

regards

Klaus

Hi all,
Has anyone recently had problems with the default_zoom of the map card in lovelace?
It’s ignored and every time I have to zoom-in the map manually.
Anyone know how to fix?
Thanks.

Tractive will be part of the next Home Assistant release: Tractive - Home Assistant

7 Likes

This is great! I just saw this post and will try it immediatly.
Do you think it would be possible to integrate the “Live Tracking” mode in the future?
I would like it to set it up in a way that it automatically turns on, when I go for a walk with my dog.
If you could integrate it as a switch, it should be easy to create an automation for that.

Additionally, has anybody been able to track the integrated bluetooth of the Tractive device?
Since GPS is not very accurate for presence detection, I would love to add this as a bluetooth tracker.

Thanks again @Danielhiversen !

Yes, it is a work in progress https://github.com/home-assistant/core/pull/55517 :slight_smile:

Not sure if anyone has tested using Bluetooth as presence detection, but would be interesting.

2 Likes

Perfect! I’ve tested the new integration today and it runs out of the box with no issues so far.
Great job! It is nice to hear that you are already trying to improve the integration. The “Live Tracking” feature would be a great addition!

Regarding the bluetooth tracking, I have made some progress.
In addition to GPS tracking, Tractive uses Bluetooth LE to measure how far your cell phone is away from the tracker. This might be helpful, if you are trying to find your pet in the dark or in very dense forest or bushes. In Home Assistant this could be used for presence detection.

I was never able to track the tracker with Home Assistant using the Bluetooth LE Tracker integration alone. Therefore, I used an andriod app that scans for Bluetooth devices in your surrounding and displays their MAC address. Although some Bluetooth LE devices change their MAC address constantly for security reasons, Tractive maintains its address. This makes it possible to track it over a longer time period.

In order to track Tractive’s Bluetooth LE emissions, I went trough the following steps:

  1. Activate the Bluetooth LE Tracker integration in Home Assistant Bluetooth LE Tracker - Home Assistant
    Of course this requires a Bluetooth LE receiver connected to your Home Assistant server.

  2. Restart Home Assistant

  3. After the restart you might already find your Tractive tracker in the known_devices.yaml file. Its MAC address should look like something like this: BLE_XX:XX:XX:XX:XX:XX
    This didn’t work for me. That is why I used an Android app to scan for Bluetooth devices to determine the MAC address of my Tractive tracker.

  4. If Home Assistant was able to find your device make sure that it is also tracked by writing “true” behind “track:”. If you couldn’t find your device in the known_devices.yaml, you need to scan for your device with another device (Android app etc…) to determine its MAC address and add some lines to the known_devices.yaml file:

choose_a_name:
  name: CHOOSE_A_NAME
  mac: BLE_XX:XX:XX:XX:XX:XX
  icon:
  picture:
  track: true
  1. Make sure you write “BLE_” before the MAC address. This way Home Assistant knows it is a BLE device.

  2. After saving the file and restarting Home Assistant again, you should be able to track your Tractive trough Bluetooth LE in Home Assistant and use it for presence detection.

I have found out that the Bluetooth LE emissions from the Tractive device are not very strong. Therefore, you might need multiple Bluetooth LE receivers to track the signal over mulitple rooms.

3 Likes

Nice, will try it :ok_hand:

I have also added a template sensor by combining Bluetooth LE tracking and GPS tracking to generate a more accurate tracking for the state “home” or “not_home” while inside the house.

This is the text that I have added to my sensors.yaml file:

- platform: template
  sensors:
    composite_state_tractive:
      friendly_name: Composite State Tractive
      value_template: >
        {% if is_state("device_tracker.your_tractive_gps","not_home") and is_state("device_tracker.your_tractive_ble","not_home") %} not_home
        {% else %} home
        {% endif %}   

I have splitted my configuration.yaml into an additional sensors.yaml. Therfore, you might not have this file. If this is the case, you can also create the template sensor in your configuration.yaml.
However, it needs to be reformated to this:

sensor:
  - platform: template
    sensors:
      composite_state_tractive:
        friendly_name: Composite State Tractive
        value_template: >
          {% if is_state("device_tracker.your_tractive_gps","not_home") and is_state("device_tracker.your_tractive_ble","not_home") %} not_home
          {% else %} home
          {% endif %}   

I then used an automation to create a new device tracker:

alias: Tractive Device Tracker
description: ''
trigger:
  - platform: state
    entity_id: sensor.composite_state_tractive
  - platform: homeassistant
    event: start
condition: []
action:
  - service: device_tracker.see
    data_template:
      dev_id: tractive
      location_name: '{{ states("sensor.composite_state_tractive") }}'
mode: single

This device tracker can then be added to a person for tracking purposes.

2 Likes

Hello, I have a problem with logging. When I created the account I did it with the google integration, now I have no way to link ha and tractive servers since the google password does not serve me. Any suggestions?

You can change your login credentials once logged in at tractive.com under your account settings.
There you should be able to change your username and password to something the tractive integration accepts.

Update on Bluetooth tracking:

The Bluetooh LE integration is pretty basic and didn’t seem to be very reliable. Therefore, I switched to Room Assistant. The Tractive Tracker works pretty well with it. Currently, I have only one Bluetooth receiver, but I have ordered two more Raspberry Pi Zero W. I am planning to install Room Assistant on both of them in order to increase Bluetooth range and to be able to track the Tractive Tracker in various rooms (room presence detection).

1 Like

Just to throw in an alternative: monitor.sh

It is more lightweight than room-assistant and works mostly without any troubles (after a few months with no restart it gets stuck; solved by restarting the PiZero every night).

But I have to ask, how do you do this with your dog? Is the tracker always on and always with the dog? I have the tracker on her harness, and she get’s this only taken on, if we leave home…

Thank you, I was looking into monitor as well, but I was not able to find a docker version of it for my QNAP NAS.

I am also taking the harness off the dog, when we come back from a walk. I am planning to use room assistant mainly for range extension. However, I have seen that some people like to keep the Tractive tracker on a collar, when their dog is able to move freely from the house into a yard. I think people with cats would also keep the Tractive collar on their pet most of the time.

I would like to use presence detection for Tractive for certain automations, e.g. if nobody is home, I would like to decrease the heating in winter or switch off the ceiling fan in summer. If my dog is still at home, I don’t want these things to happen.

1 Like

Hi all,

Would I be able to use this without a subscription?
How power hungry is the device? Looking to install something permanent into my motorbike