Help needed! Energy database costs calculation wrong, after investigating everything

Yes i did use sqlite3-to-mysql to convert the db
so that happens when i import into MARIADB.

as when it has imported all stats are good, but when homeassistant updates new value i get it messed up.

See above screenshot.
first screenshot is my main system and second screenshot is my test system. u can see the difference

Also i did notice this, looks like it went to 0 after the migration ?

This is from the migration

My original system

screenshots mean didley squat to me, old-school-guy needing table-data
EDIT: and please indicate which part was imported and which was created after

WHat query can i use, i’m not good with sql

in statistics_meta, find the “id” that belongs to the device’s cost…please only 1
Then

select * from statistics where metadata_id = id-from-above

Ok ill check,

here see this,

i hanged the second row to where it needs to be, and now when consuming gas it resets again

I would like to see what/where the diff starts with the cost as this SHOULD be very simple to migrate but… I know HA calculates not always logically

this is from the migration one

the otherone uses the default hass db.
i did run the query but it returned old data and nor recent updated data

my main system

You do understand that I have no clue about what you do , how and what your DB looks like :slight_smile: neither how sort/prin screenshots…
Anyhow, from the 2nd picture, if this is the ‘costs’ one, then ONLY for the 26th this is already not correct line 3: 714.96 + 0.076 should lead to 717.605…which logically it is not, please add a sort on create desc

that looks expected

So it did reset somehow, whike my main system is still at the 22th and the test system at the 26th

This is the query i used on both

SELECT * FROM statistics WHERE metadata_id =5 Order By last_reset Desc

I am lost…really…
Please export from the migrated data, the costs records with YOURID
To not export all, you can create a new table ‘test’ in SQL of phpmyadmin

create table test select * from statistics where metadata_id=YOURID

then use export for the test table and attach here

Here the created row from my main

and this from my migrated one

I need all, screenshots suck for analysis

and maybe you can do the same from the original SQLite, with dbbrowser you can export tables too

here it is

https://www.dropfiles.pro/gcnqAIC6yEMY9ET

and here the one from may main system, but in json format.
as it only let me export to json

https://www.dropfiles.pro/7X0NDMgaZWhshIx

i needed to upload it because its not accepted, also no rar files sadly…

how can i use that query on sqlite as it doesnt work there

updated above post

VERY quick look, this is indeed not as I would expect it


state should add to sum and this is not at all showing… note I am not 100% sure as this I never did but I am basing it on looking at my costs-sensor

can you send me the source too
in sqllite it is slight different

create table test_source as select * from statistics where metadata_id = YOURSOURCEID

sourceid may not be 5 ?
From dbbrowser (if you use that) you can then export test_source

And, what is your current CORRECT running total , the first set indicates 730, i.e. for 2022 you should see roughly 678 EUR (or whatever currency you use)