oke thanks voor de tips maar dit is voor mij nog te hoog gegrepen zou je voor mij wat kunnen aanpassen en hier neer kunnen zetten in de goede volgorde zodat ik volledig over kan naar HA
heb al div dingen geprobeerd maar krijg iedere keer fout meldingen
als ik de states / query selecteer
dan krijg ik SELECT *
FROM "states"
als ik de home assistant import aan het werk zet krijg ik dit
update statistics set sum = sum + 22160.671 where metadata_id = 203 and start_ts > unixepoch("2025-10-31")
update statistics_short_term set sum = sum + 22160.671 where metadata_id = 203 and start_ts > unixepoch("2025-10-31")
insert into statistics (created_ts, start_ts, state, sum, metadata_id) values
(unixepoch("2017-10-17", "utc"), unixepoch("2017-10-17", "utc"), 38.902, 0.000, 203),
(unixepoch("2017-10-18", "utc"), unixepoch("2017-10-18", "utc"), 43.568, 4.666, 203),
(unixepoch("2017-10-19", "utc"), unixepoch("2017-10-19", "utc"), 47.067, 8.165, 203),
(unixepoch("2017-10-20", "utc"), unixepoch("2017-10-20", "utc"), 50.184, 11.282, 203),
(unixepoch("2017-10-21", "utc"), unixepoch("2017-10-21", "utc"), 54.724, 15.822, 203),
(unixepoch("2017-10-22", "utc"), unixepoch("2017-10-22", "utc"), 60.625, 21.723, 203),
(unixepoch("2017-10-23", "utc"), unixepoch("2017-10-23", "utc"), 64.202, 25.300, 203),
(unixepoch("2017-10-24", "utc"), unixepoch("2017-10-24", "utc"), 67.729, 28.827, 203),
(unixepoch("2017-10-25", "utc"), unixepoch("2017-10-25", "utc"), 71.047, 32.145, 203),
(unixepoch("2017-10-26", "utc"), unixepoch("2017-10-26", "utc"), 74.780, 35.878, 203),
(unixepoch("2017-10-27", "utc"), unixepoch("2017-10-27", "utc"), 78.923, 40.021, 203),
(unixepoch("2017-10-28", "utc"), unixepoch("2017-10-28", "utc"), 83.212, 44.310, 203),
(unixepoch("2017-10-29", "utc"), unixepoch("2017-10-29", "utc"), 90.099, 51.197, 203),
(unixepoch("2017-10-30", "utc"), unixepoch("2017-10-30", "utc"), 97.554, 58.652, 203),
(unixepoch("2017-10-31", "utc"), unixepoch("2017-10-31", "utc"), 103.693, 64.791, 203),
(unixepoch("2017-11-01", "utc"), unixepoch("2017-11-01", "utc"), 108.513, 69.611, 203),
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| SELECT *
FROM "states"
update statistics set sum = sum + 22160.671 where metadata_id = 203 and start_ts > unixepoch("2025-10-31")
update statistics_short_term set sum = sum + 22160.671 where metadata_id = 203 and start_ts > unixepoch("2025-10-31")
insert into statistics (created_ts, start_ts, state, sum, metadata_id) values
(unixepoch("2017-10-17", "utc"), unixepoch("2017-10-17", "utc"), 38.902, 0.000, 203),
(unixepoch("2017-10-18", "utc"), unixepoch("2017-10-18", "utc"), 43.568, 4.666, 203),
(unixepoch("2017-10-19", "utc"), unixepoch("2017-10-19", "utc"), 47.067, 8.165, 203),
(unixepoch("2017-10-20", "utc"), unixepoch("2017-10-20", "utc"), 50.184, 11.282, 203),
(unixepoch("2017-10-21", "utc"), unixepoch("2017-10-21", "utc"), 54.724, 15.822, 203),
(unixepoch("2017-10-22", "utc"), unixepoch("2017-10-22", "utc"), 60.625, 21.723, 203),
(unixepoch("2017-10-23", "utc"), unixepoch("2017-10-23", "utc"), 64.202, 25.300, 203),
(unixepoch("2017-10-24", "utc"), unixepoch("2017-10-24", "utc"), 67.729, 28.827, 203),
(unixepoch("2017-10-25", "utc"), unixepoch("2017-10-25", "utc"), 71.047, 32.145, 203),
(unixepoch("2017-10-26", "utc"), unixepoch("2017-10-26", "utc"), 74.780, 35.878, 203),
(unixepoch("2017-10-27", "utc"), unixepoch("2017-10-27", "utc"), 78.923, 40.021, 203),
(unixepoch("2017-10-28", "utc"), unixepoch("2017-10-28", "utc"), 83.212, 44.310, 203),
(unixepoch("2017-10-29", "utc"), unixepoch("2017-10-29", "utc"), 90.099, 51.197, 203),
(unixepoch("2017-10-30", "utc"), unixepoch("2017-10-30", "utc"), 97.554, 58.652, 203),
(unixepoch("2017-10-31", "utc"), unixepoch("2017-10-31", "utc"), 103.693, 64.791, 203), |