the Home Assistant companion (Android) app sends the location of my phone to HA. This works perfectly, I can see a sensor.geocoded_location entity in HA, which shows latitude/longitude data. I send this data to an InfluxDB database, and try to plot it on a map with Grafana. The Worldmap plugin in grafana needs two separate fields with latitude and longitude, but in the InfluxDB database they are joined together in one string: [lat, lon]
Does anybody managed to get around this problem? How can I write a query that can split the string provided by the mobile app?
Split would be definitely one way to solve this issue. However, the query language (InfluxQL) doesn’t support this function. After some research I’ve found that it is part of another query language developed by the Influx team, called Flux. There is a beta plugin for grafana, I could install and use it as a new datasource. I’ll definitely keep this in mind, but I feel an easier solution here, I’m just not experienced enough to find it with my current tools
Oh, I’m sorry, you’re absolutely right. The Docu I postet was for Flux and not for InfluxQL.
Maybe you can do it with some kind of Regex with InfluxQL?:
But as far as I can see, it is not really possible with InfluxQL, because there is no string processing intended. Wherever I could find something about this, it is recommended to generate separate field values pairs for the data.:
If you don’t have any old data that you still need, you might realy want to try LTSS. This makes data manipulation much easier in any case, since it basically uses a PostgresDB.
Does this flux query still work for you? When I run it in grafana, I get 0 series returned, when I run it in InfluxDB, I get the same table output I was receiving (not split lon/lat) prior to trying your map solution. I am new to InfluxDB & Grafana, I’ve been recording my location in InfluxDB for a while and ready to visualize my data. Thank you for the help!