Importing CSV File Into InfluxDB

Hi everyone,

I am using InfluxDB and Grafana, but I cannot figure out how to import data from a CSV file into InfluxDB to be visualized in Grafana. I have no problem importing data from the entities in HassOS, but I have data in a CSV file that’s pretty unrelated to Home Assistant which I would like to import into InfluxDB, and then visualize in Grafana. Is there a way to do this? And if not, is there a way I can take the data in the CSV file and reformat it into something else that will be importable into InfluxDB?

Thanks.

may this help you
https://www.home-assistant.io/integrations/file#sensor

Hi I am grappling with the same issue of how to manually get data into influxdb, did you get this sorted in the end?

Yeah, I actually did manage to figure it out to an extent.

So in the InfluxDB UI, you can go to the Explore tab, and in the top right there’s a “Write Data” button. It will let you upload a file or you can choose manual entry. You just have to either type in the entry (in the correct format), or you can upload a file that has multiple entries (but also have to be in the specific format).

The format is the hard part, but I think once you play around with it for a little while it gets easier and more understandable. I do have a couple examples though.

So I have a “tag” called Nutrition, and under that tag are a few measurements like water, caffeine, etc, in which I can record my daily water/caffeine intake manually. Those measurements only have one value, of course, for water it’s grams (g). The “manual entry” format I use to add a data point for the day for water is:

Nutrition,measurement=Water,unit=grams value=2000 1645750800000000000

So as far as I understand it, this will create a new tag called Nutrition, with 1 measurement called Water. As you can see below I have a few more than water, but you get the idea.

I don’t think I’ve actually ever tried to manually enter a database entry for an auto-importing sensor from Home Assistant itself, for example, my thermostat temperature, but I’m sure it’s possible given the same format.

2 Likes