Hm ok. Yea I thought I was actually having better success with BT near then BT connected but I’ll keep an eye on it. If you’re phone is the only one that connects to the car then BT connected is the way to go. In my case sometimes my phone is connected and sometimes my wife’s is so I switched to BT near to try and keep tracking even when my phone wasn’t the one directly connected.
Is that what that is? I actually didn’t know, I thought it was a percent lol. That totally makes sense though. I remember in my testing I was getting really confusing readings from Tasker’s Location Accuracy variable and so I just put 100 in and figured I’d come back to it if it caused an issue. Thanks!
Ah crap, I forgot about this. Unfortunately there’s no OOTB way to do this. I remember discovering this and creating a feature request for it. I do have a workaround but it involves Node RED. Basically what I do is any time the device_tracker.see
service is called, Node RED picks up on it and stores that info in a sensor it creates. Then on HA start-up it calls device_tracker.see
for each data backup sensor.
If you have Node RED I can share my code with you. You’ll have to change the sensor names but its pretty straightforward otherwise.
If you don’t have Node RED you can build restore functionality using two automations and the variables custom component. With that component you just need to add this:
variable:
car_tracker_backup:
restore: true
value: home
attributes:
friendly_name: 'Car tracker backup'
automation:
- id: backup_tracker_data
alias: Backup custom device trackers
description: Use a variable to persist custom device tracker data across resets
trigger:
- entity_id: device_tracker.car
platform: state
condition: []
action:
- service: variable.set_variable
data:
variable: car_tracker_backup
value_template: {{ trigger.to_state.state }}
attributes_template: >
{
"source_type": "{{ trigger.to_state.attributes.source_type }}",
"latitude": "{{ trigger.to_state.attributes.latitude }}",
"longitude": "{{ trigger.to_state.attributes.longitude }}",
"gps_accuracy": "{{ trigger.to_state.attributes.gps_accuracy }}",
"host_name": "{{ trigger.to_state.attributes.friendly_name }}"
}
- id: restore_trackers_on_startup
alias: Restore custom device trackers
description: Restore data for custom device trackers on startup
trigger:
- event: start
platform: homeassistant
condition: []
action:
- service: device_tracker.see
data_template:
dev_id: car
host_name: "{{ state_attr('variable.car_tracker_backup', 'host_name') }}"
location_name: "{{ states('variable.car_tracker_backup') }}"
gps:
- "{{ state_attr('variable.car_tracker_backup', 'latitude') }}"
- "{{ state_attr('variable.car_tracker_backup', 'longitude') }}"
gps_accuracy: "{{ state_attr('variable.car_tracker_backup', 'gps_accuracy') }}"
Also alternatively since this requires the variable component anyway you could just track the car location using restorable variables and drop the device trackers. Just basically switch the service call on taskers side from device_tracker.see
to variable.set_variable
and adjust the parameters accordingly.
I can’t really think of any other options unfortunately. Other then upvoting the feature request and hoping custom device trackers get native restore.