Keeping tracking history and show statistics and route

Is it somehow possible to keep and store the tracking device history like speed and altitude together with the route? This could then be used for statistics or maybe even map from the travel Routes to show of and show in a dashboard - the last bike trip!

Why use Cloud based Sport tracking services if HA have all the data already (of course the HA Mobile App could be improved to store GPS points and timestamps)

I can see that we have all the nice data in our mobile device tracking entity - an automation could maybe activate the route recorder (to prevent data overflow):

image

I know that the map can show the route for some hours but it will not keep it for later:

image

There will be no need for any integration to any new devices. I think the Map-card already have most of the needed options. It is more like having a way to do the following:

  1. Create an activity
  2. Add devices to store tracking history for
  3. Maybe add an activity category like Walk, Running, Bike, etc.

Behind the scene I could see information like this being stored (the data model):

  • Activity
  • Trip no. (sequence no.)
  • Date
  • Start Time
  • Devices to track
  • Distance
  • Average speed
  • Max. speed
  • Max. altitude
  • Stop Time
  • etc. like weather measures

General setup of the Add-on/hacs could be:

  • Distance Unit of measure (if not taken from HA setup)
  • Storage information like database link if external stored
  • Days to keep history
  • etc.

Use an automation to call the file notifier to write the attributes you want to record to a csv file.

You can trigger it by state change (best done with the attributes broken out as entities using template sensors) or by a simple time interval. Enabling or disabling the automation starts and stops the recorder.

Here’s an examplee I used to record energy sensor states to a csv file:
Notification service

- platform: file
  name: energy_log
  filename: /config/www/csv_logs/energy_log.csv
  timestamp: false

Action in the automation:

  - service: notify.energy_log
    data_template:
      message: "{{ states('sensor.date') }},{{ states('sensor.energy_t31_light_and_power_day') }},{{ states('sensor.energy_t31_light_and_power_night') }},{{ states('sensor.energy_t31_light_and_power_total') }},{{ states('sensor.energy_t41_heating_day') }},{{ states('sensor.energy_t41_heating_night') }},{{ states('sensor.energy_t41_heating_total') }},{{ states('sensor.total_energy_day') }},{{ states('sensor.total_energy_night') }},{{ states('sensor.total_energy') }},{{ state_attr('sensor.power_stats','min_value') }},{{ state_attr('sensor.power_stats','max_value') }},{{ states('sensor.power_stats') }},{{ states('sensor.total_cost_today') }}"

If you get the format right it shouldn’t be too hard to import into Google Earth.

1 Like

OK that’s a nice “workaround” and could be used temporarily. But wouldn’t it be nice to build in the function in HA as it is already possible to store the map route form devices for some hours? (actual a coool feature also)

If it was possible to add a route no. and add devices and then set start and stop time afterwards that could be used to show route driven, average speed (maybe average speed per mile or kilometer) and max attitude and maybe even some weather measures also - wow that could be cool

1 Like

Would you like me to move this to feature requests?

1 Like

Ohh yes please

1 Like

Done. Don’t forget to vote for your own request.

1 Like

So… it’s 2 years later… where is this integration? lol

Come on, doesn’t anyone track their miles/kms?

2 Likes

This might be what you’re after, although no advanced statistics to go along with it.

5 Likes