Insert historical values to statistics table?

I would like to insert historical sensor values directly to statistics data table
(SQL Inserts)

Can you please advise if:

  • Would be that safe for HA ?
  • Does HA needs correct ID sequences or (I hope) on created / start fields ?

** EDIT **

For example - my sensor (energy return) has id=46
As you can see below DB has historical entries started from day Ive created that sensor 17.III.2022

Question is if I can safely insert historical records (prior 17th of Match), but obviously with higher IDs

Im mostly interested to add historical energy production / consumption data

1 Like

Guys - any thoughts on this ?

I’m currently attempting to do the same.

Did you make any progress on this?

Have you ever found a solution?

I have seen that frenck’s spook integration has a service for that - However, no guarantee this works.
frenck has a lot of disclaimers for that integration.

I will be testing this in the next week as I think this will be the best way back from postgresql to sqlite.

Did you have any success with the Recorder service from spook integration? I’m currently trying to “implement” process for manually entering values from my energy/water meters and I usually only do that when I feel like. (But it’s usually at least once a month.)
Problem is that when I enter the meter value, the increase of the value shows in the Energy dashboard as a consumption for the time of the entering of the value.
What I’d like to do to split the current value into multiple data points in history between the previous and current readouts.
For example:
I did a readout on 1st: 1000 then next on 5th I enter value of 1400 and I’d like to automatically fill the history with values for 2nd = 1100, 3rd = 1200, 4th = 1300. Whit my goal to have continuous graph for monthly consumption in the energy dashboard in case I for example miss a month.

To be honest: I am heavily procrastinating on the migration from PostgreSQL back to sqlite which I wanted to solve with this service.

Regarding your problem: I am doing something similar but on a weekly basis. With this resolution, I am happy with the monthly values

Can someone please help me understand how the tables in the database refer to the statistics?

Discussion continued in the Energy category