Importing csv to InfluxDB

I’m gradually going to use InfluxDB and I would like to import my old energy monitoring data from Homeseer to OH3.

I have managed to create csv files and would like to import the csv files to InfluxDB but when trying to upload a csv file using InfluxDB UI–>Load Data–>Sources–>Flux Annotated CSV I get an error (see the screenshot below):

My csv files have format (first few lines):

datetime,electricity,energy,water,PVexp,deltakwh,netotus,nethyv,netdeltaPV
1.5.2008 15:00,10652.2,16.925,0,0,0,0,0,0

I didn’t have water meter and solar panels back in 2008 so therefore the data is missing. I have tried to look for correct syntax for csv files but it’s not clear to me what is wrong with my csv file. One thing which is not clear to me at all is that can a row have several “measurements” or not.

I have also looked at Influxdata community, e.g.
https://community.influxdata.com/t/easiest-way-for-a-beginner-to-import-csv-data-with-time/18780

I haven’t installed Telegraf yet and when looking at the discussion above it seems that importing using Telegraf does not look very simple, at least for me.

I would try the REST API ( PUT /persistence/items/{itemname} ) of openHAB.

Or have a look to Migrate your existing persistence data to InfluxDB ( it points to GitHub - CWempe/rest2influxdb ) which makes use of call to the influxdb server like

curl -i -XPOST -u $influxuser:$influxpw "http://$influxserver:$influxport/write?db=$influxdatbase" --data-binary @$i
to import data per item.

Thanks. I think I need to sort out the csv file format first before trying to import the cvs file to InfluxDB.

Have you tried exporting the data from influxdb to see what the ‘annotated flux data’ would need to look like?
Otherwise I’m sure the influx documentation mentions what it needs to look like?

My InfluxDB is still empty because I haven’t persisted any OH data yet. I have tried to look at documentation for format of annotated lux data but haven’t figured out yet what is wrong with my csv file. Perhaps I should ask about my problem at Infuxdb community.

It seems to me you need to describe the data as outlined here: Annotated CSV | InfluxDB Cloud Documentation
The way I interpret this is as you need a row preceding the actual data starting with a # to describe the data being input.
Influx describes this as:

#datatype measurement,tag,tag,field,field,ignored,time

Ie tell influx what datatype each column contains.

OK, many thanks. My csv file contains several measurement columns so is this acceptable? Another issue is the order of the columns, can e.g. time be the first column?

Honestly I’m not an influxdb expert, but I’d expect the annotation to take care of that. Otherwise some expert(here or at influxdb) should be able to guide you there.