Device Tracker - Ignore location when accuracy is too large?

I’m using the iOS app and device_tracker to track location of my family. My youngest has an iphone SE which seems to have trouble with accuracy. Several times a day we’ll get a message that he has left school (set up as a Zone) when he’s still a home. His school is about 3 miles away.

Is there anyway to ignore changes in location when the accuracy is, say, worse than 200m? Although accuracy is an attribute, it doesn’t seem obvious how to leverage it when using the tracker and zones.

2 Likes

I know the answer is a bit late but I think I found a workaround for this problem.

In a nutshell it is about creating a new device tracker that is updated by an automation. The automation will be activated every time the latitude or longitude of the devicetracker to be managed changes but only if the accuracy respects what you want (in my case 150m). In other cases the automation will not be activated and consequently the positions with more than that accuracy will be ignored.

Then you will have to replace the device tracker attached to the person with this newly created one.

I left you here the automation snippet:

- alias: "GPS - collect GPS only if under accuracy"

  trigger:
    - platform:  state
      entity_id: device_tracker.your_inaccurate_tracker
      attribute: latitude
    - platform:  state
      entity_id: device_tracker.your_inaccurate_tracker
      attribute: longitude
      
  condition:
     - condition: numeric_state
       entity_id: device_tracker.your_inaccurate_tracker
       attribute: "gps_accuracy"
       below: 150 		#METERS OVER IT WON'T COLLECT DATA
       
  action:
    - service: device_tracker.see
      data_template:
        dev_id: mynewtrackerid
        gps:
          - "{{ state_attr('device_tracker.your_inaccurate_tracker','latitude')|float }}"
          - "{{ state_attr('device_tracker.your_inaccurate_tracker','longitude')|float }}"
        gps_accuracy: "{{ state_attr('device_tracker.your_inaccurate_tracker','gps_accuracy')|float }}"
        battery: "{{ state_attr('device_tracker.your_inaccurate_tracker','battery_level')|float }}"
        location_name: "{{ states('device_tracker.your_inaccurate_tracker')}}"
        host_name: "My New Tracker Name"

I am sry for not using the best English :grin:
Hope this help

P.S.: To create the new tracker you don’t have to do anything, just create the automation and as soon as it is activated the device_tracker.see service will create the device tracker with the setted dev_id.

1 Like