Track map history

hi,
i would like to use a plugin TrackMap for Grafana that can show location history on a map.
i added the TrackMap plugin and i dont know how to select the right table.

in the plugin page it say:
The plugin requires latitude and longitude measurements provided as floats in two separate fields.

The following setup has been tested using InfluxDB as a data source in the case where latitude and longitude are stored in the location table. You will have customize the query for your setup accordingly.

SELECT median("latitude"), median("longitude") FROM "location" WHERE $timeFilter GROUP BY time($interval)

It’s also possible to use MySQL/MariaDB as a data source by using 2 queries along the lines of:

A: SELECT "latitude" as value, $__time(timestamp) FROM "location" WHERE $__timeFilter(timestamp) ORDER BY timestamp ASC
B: SELECT "longitude" as value, $__time(timestamp) FROM "location" WHERE $__timeFilter(timestamp) ORDER BY timestamp ASC

i have entinty from life360 that have the info for latitide and longitude but i cant find it in the grafana quary.

ani idea?

1 Like

hi,
i now can get this in grafana:

Object
xhrStatus:"complete"
request:Object
method:"GET"
url:"api/datasources/proxy/1/query"
params:Object
db:"homeassistant"
q:"SELECT mean("latitude") FROM "state" WHERE ("domain" = 'device_tracker' AND "entity_id" = 'life360_moshe_perez') AND time >= now() - 24h GROUP BY time(5m) fill(null)"
epoch:"ms"
data:null
precision:"ms"
response:Object
results:Array[1]
0:Object
statement_id:0
series:Array[1]
0:Object
name:"state"
columns:Array[2]
0:"time"
1:"mean"
values:Array[289]
0:Array[1572600900000,31.6248668]
1:Array[1572601200000,null]
2:Array[1572601500000,31.6248668]
3:Array[1572601800000,null]
4:Array[1572602100000,31.623172657142863]```

but still, i don't know how to continue

its working, this is the code.

SELECT mean("latitude"), mean("longitude") FROM "state" WHERE ("domain" = 'device_tracker' AND "entity_id" = 'life360_moshe_perez') AND $timeFilter GROUP BY time($__interval) fill(none)
4 Likes