Transfer existing data form HA to InfluxDB

Hey folks,

Yesterday I installed InfluxDB on my HA.
Now I want to transfer all existig data from my HA to the InfluxDB

How can I do this?

Wait 10 days?

Which is a flippant way of saying: you cant. Sorry (for being flippant and that there is no easy way to do this).

But your state data only goes back 10 days by default so you’re not losing that much.

Bad news

Unfortunately I have some long term data collectors utility-meter for energy measurement.

1 Like

The solution will be exporting and importing the data in a CSV format.

https://docs.influxdata.com/influxdb/cloud/write-data/developer-tools/csv/

this sounds good

how can I export the HA data to a CSV file that is readable by InfluxDB?

The utility meter state history only goes back 10 days as well.

utility_meter:
  burntime_weekly:
    name: "tägliche Brenndauer"
    source: sensor.brenndauer_tag
    cycle: weekly
  burntime_yearly:
    name: "jährliche Brenndauer"
    source: sensor.brenndauer_tag
    cycle: yearly

what about the cycle: yearly ?

image

type: custom:mini-graph-card
name: Brenndauer
show_points: false
unit: Stunden
line_width: 1
entities:
  - sensor.brenndauer_tag
lower_bound: 0
upper_bound: 12
show:
  labels: true
  fill: false
hours_to_show: 8760

this data must be somewhere

The utility meter yearly cycle will count up for a year then reset. The state history of that count only goes back 10 days by default. So let’s say it increases by 1 a day and is currently 24, you can only see a history back to 14.

There’s no scale on that graph. It does not go back a year.

Hover you mouse over the early part of the graph and see what the date says.

There’s no point in trying to graph state history for longer than the recorder purge keep days setting (10 days by default). Do not increase this purge setting more than a month. You will suffer performance issues.

Long term statistics are kept forever. This is seperate to state history. For a sensor to store LTS it must have a state_class and a device_class.

hi

but how become the CSV file from HA addon ?

This addon is great to get data on CSV