On 2022-12-25 my Home Assistant was born
So, my Home Assistant database contains data from 2022-12-25 until now.
My Domoticz database (Domoticz is still running) has data from 2019-09-05 until now.
To solve the UNIQUE constraint failed: statistics.metadata_id, statistics.start error I imported data from 2022-12-24 and before.
What I missed was the date in the 2 SQL statements shown below
update statistics set sum = sum + 2696.769 where metadata_id = 1 and start > "2023-01-05 02:00:00.000000"
update statistics_short_term set sum = sum + 2696.769 where metadata_id = 1 and start > "2023-01-05 02:00:00.000000"
An update statics should be done only on the records created by HA. So in my case I needed to changed the date to 2022-12-24, because I should only update records from 2022-12-25 until now.
If you end up, like I did, with executing this SQL statement twice, your sum value will also be doubled.
In my case I had to substract my sum values again Note the - 2696.769 in the SQL statements below.
update statistics set sum = sum - 2696.769 where metadata_id = 1 and start > "2022-12-25 02:00:00.000000"
update statistics_short_term set sum = sum - 2696.769 where metadata_id = 1 and start > "2022-12-25 02:00:00.000000"
Many thanks! I’m running Home Assistant 2023.3.5 in a Docker on my raspi4. Maybe it’s a problem with the kWh vs Wh. I’ll play with is a bit, but good to know that the tool should still work.
Thank you for creating this awesome tool! I imported all my Domoticz history in to Home Assistant. There are 2 things I’m not sure about though, maybe you can shed some light on them:
-I imported until 2023-05-29. On 2023-05-30 there is a hugh spike in generated power. Is this the expected behaviour?
-if this is related to the ‘update sum’ setting (which I set to update) what are the consequences of setting it to not alter the sum?
Hi,
complete newbie here.
I just managed to setup DSMR Reader and integrate it in HA. I’d love to import the Domoticz data as well, but when running the sql script to find the ID, none of the results are in the sensor.dsmr category.
What am I missing here?
Thanks!
Thank you johanbos, your software works nickel.
I am in the process of migrating from domoticz to home assistant.
You wouldn’t be by chance how to migrate the temperature probes in the same way, it will be great
I have downloaded the application (release v0.2.1-ci.140), but as soon as I import the Domoticz *.db file, the applications closes/crashes. Is there an known issue with this version?