Energy Management in Home Assistant

I understand that, but how is home then calculated? Is it: home=(import + solar production - export)?

yes, you got it right :wink:

Hi,

Looking for help regarding energy dashboard.
Upon first configuration, I get first measurement that take all consumption from the day the electricity supplier installed the main switch. The main switch is connected and reporting cumulative consumption from day 1 i.e. total consumption from day 1 for day and night tariff (2 indexes).
This is killing my reports for months.

I can’t find that huge measurement in dev tools/statistics to fix it.
Any clue where I can find it ?

Can’t find any numbers in DB explaining this neither in short term statistics nor in statistics except this is the first measurement…

Thanks
Pierre

Problematic day


A normal day

The week with both days

Note, I’m UTC + 2 thus showing data of the 24/10 from 22h00 → 24h00.


SELECT * FROM `statistics` where metadata_id = 222 order by start desc;


id	created	start   	mean	min	max	last_reset	state	sum	metadata_id	
159930	2022-10-26 09:00:10.683621	2022-10-26 08:00:00.000000	NULL	NULL	NULL	NULL	10169.506	233.89290185546815	222	
159799	2022-10-26 08:00:10.670152	2022-10-26 07:00:00.000000	NULL	NULL	NULL	NULL	10169.506	233.89290185546815	222	
159671	2022-10-26 07:00:10.673472	2022-10-26 06:00:00.000000	NULL	NULL	NULL	NULL	10169.506	233.89290185546815	222	
159547	2022-10-26 06:00:10.579217	2022-10-26 05:00:00.000000	NULL	NULL	NULL	NULL	10169.506	233.89290185546815	222	
159423	2022-10-26 05:00:10.714225	2022-10-26 04:00:00.000000	NULL	NULL	NULL	NULL	10169.506	233.89290185546815	222	
159299	2022-10-26 04:00:10.630627	2022-10-26 03:00:00.000000	NULL	NULL	NULL	NULL	10168.906	233.2929018554696	222	
159175	2022-10-26 03:00:10.640018	2022-10-26 02:00:00.000000	NULL	NULL	NULL	NULL	10168.096	232.4829018554683	222	
159051	2022-10-26 02:00:10.653450	2022-10-26 01:00:00.000000	NULL	NULL	NULL	NULL	10167.639	232.02590185546796	222	
158927	2022-10-26 01:00:10.679000	2022-10-26 00:00:00.000000	NULL	NULL	NULL	NULL	10167.123	231.50990185546834	222	
158803	2022-10-26 00:00:10.577061	2022-10-25 23:00:00.000000	NULL	NULL	NULL	NULL	10166.697	231.08390185546887	222	
158679	2022-10-25 23:00:10.695987	2022-10-25 22:00:00.000000	NULL	NULL	NULL	NULL	10165.42	229.80690185546882	222	
158556	2022-10-25 22:00:10.633242	2022-10-25 21:00:00.000000	NULL	NULL	NULL	NULL	10161.663	226.04990185546922	222	
158430	2022-10-25 21:00:10.631961	2022-10-25 20:00:00.000000	NULL	NULL	NULL	NULL	10157.713	222.0999018554685	222	
158304	2022-10-25 20:00:10.711343	2022-10-25 19:00:00.000000	NULL	NULL	NULL	NULL	10155.222	219.6089018554685	222	
158177	2022-10-25 19:00:10.604263	2022-10-25 18:00:00.000000	NULL	NULL	NULL	NULL	10155.222	219.6089018554685	222	
158050	2022-10-25 18:00:10.746140	2022-10-25 17:00:00.000000	NULL	NULL	NULL	NULL	10155.222	219.6089018554685	222	
157923	2022-10-25 17:00:10.603313	2022-10-25 16:00:00.000000	NULL	NULL	NULL	NULL	10155.222	219.6089018554685	222	
157796	2022-10-25 16:00:10.637288	2022-10-25 15:00:00.000000	NULL	NULL	NULL	NULL	10155.222	219.6089018554685	222	
157669	2022-10-25 15:00:10.617960	2022-10-25 14:00:00.000000	NULL	NULL	NULL	NULL	10155.222	219.6089018554685	222	
157542	2022-10-25 14:00:10.576056	2022-10-25 13:00:00.000000	NULL	NULL	NULL	NULL	10155.222	219.6089018554685	222	
157416	2022-10-25 13:00:10.659544	2022-10-25 12:00:00.000000	NULL	NULL	NULL	NULL	10155.222	219.6089018554685	222	
157300	2022-10-25 12:00:10.508818	2022-10-25 11:00:00.000000	NULL	NULL	NULL	NULL	10155.222	219.6089018554685	222	
157184	2022-10-25 11:00:10.654766	2022-10-25 10:00:00.000000	NULL	NULL	NULL	NULL	10155.222	219.6089018554685	222	
157058	2022-10-25 10:00:10.455965	2022-10-25 09:00:00.000000	NULL	NULL	NULL	NULL	10155.222	219.6089018554685	222	
156939	2022-10-25 09:00:10.482849	2022-10-25 08:00:00.000000	NULL	NULL	NULL	NULL	10155.222	219.6089018554685	222	
156820	2022-10-25 08:00:10.680726	2022-10-25 07:00:00.000000	NULL	NULL	NULL	NULL	10155.222	219.6089018554685	222	
156701	2022-10-25 07:00:10.742765	2022-10-25 06:00:00.000000	NULL	NULL	NULL	NULL	10155.222	219.6089018554685	222	
156582	2022-10-25 06:00:10.791069	2022-10-25 05:00:00.000000	NULL	NULL	NULL	NULL	10155.222	219.6089018554685	222	
156463	2022-10-25 05:00:10.824973	2022-10-25 04:00:00.000000	NULL	NULL	NULL	NULL	10155.222	219.6089018554685	222	
156344	2022-10-25 04:00:10.778136	2022-10-25 03:00:00.000000	NULL	NULL	NULL	NULL	10154.536	218.9229018554688	222	
156225	2022-10-25 03:00:10.814557	2022-10-25 02:00:00.000000	NULL	NULL	NULL	NULL	10153.106	217.49290185546852	222	
156106	2022-10-25 02:00:10.844061	2022-10-25 01:00:00.000000	NULL	NULL	NULL	NULL	10152.522	216.9089018554696	222	
155987	2022-10-25 01:00:10.808046	2022-10-25 00:00:00.000000	NULL	NULL	NULL	NULL	10151.865	216.25190185546853	222	
155868	2022-10-25 00:00:10.754567	2022-10-24 23:00:00.000000	NULL	NULL	NULL	NULL	10151.303	215.68990185546863	222	


SELECT * FROM `statistics` where metadata_id = 223 order by start desc;


id	created	start   	mean	min	max	last_reset	state	sum	metadata_id	
159931	2022-10-26 09:00:10.684912	2022-10-26 08:00:00.000000	NULL	NULL	NULL	NULL	19810.866	321.76727563476743	223	
159800	2022-10-26 08:00:10.671495	2022-10-26 07:00:00.000000	NULL	NULL	NULL	NULL	19810.463	321.36427563476536	223	
159672	2022-10-26 07:00:10.674771	2022-10-26 06:00:00.000000	NULL	NULL	NULL	NULL	19809.533	320.4342756347651	223	
159548	2022-10-26 06:00:10.580526	2022-10-26 05:00:00.000000	NULL	NULL	NULL	NULL	19808.18	319.0812756347659	223	
159424	2022-10-26 05:00:10.715525	2022-10-26 04:00:00.000000	NULL	NULL	NULL	NULL	19807.247	318.148275634765	223	
159300	2022-10-26 04:00:10.631976	2022-10-26 03:00:00.000000	NULL	NULL	NULL	NULL	19806.636	317.5372756347642	223	
159176	2022-10-26 03:00:10.641339	2022-10-26 02:00:00.000000	NULL	NULL	NULL	NULL	19806.636	317.5372756347642	223	
159052	2022-10-26 02:00:10.654725	2022-10-26 01:00:00.000000	NULL	NULL	NULL	NULL	19806.636	317.5372756347642	223	
158928	2022-10-26 01:00:10.680670	2022-10-26 00:00:00.000000	NULL	NULL	NULL	NULL	19806.636	317.5372756347642	223	
158804	2022-10-26 00:00:10.578348	2022-10-25 23:00:00.000000	NULL	NULL	NULL	NULL	19806.636	317.5372756347642	223	
158680	2022-10-25 23:00:10.698131	2022-10-25 22:00:00.000000	NULL	NULL	NULL	NULL	19806.636	317.5372756347642	223	
158557	2022-10-25 22:00:10.634488	2022-10-25 21:00:00.000000	NULL	NULL	NULL	NULL	19806.636	317.5372756347642	223	
158431	2022-10-25 21:00:10.633266	2022-10-25 20:00:00.000000	NULL	NULL	NULL	NULL	19806.636	317.5372756347642	223	
158305	2022-10-25 20:00:10.713831	2022-10-25 19:00:00.000000	NULL	NULL	NULL	NULL	19806.029	316.93027563476426	223	
158178	2022-10-25 19:00:10.605573	2022-10-25 18:00:00.000000	NULL	NULL	NULL	NULL	19804.965	315.86627563476577	223	
158051	2022-10-25 18:00:10.747526	2022-10-25 17:00:00.000000	NULL	NULL	NULL	NULL	19804.299	315.2002756347647	223	
157924	2022-10-25 17:00:10.604610	2022-10-25 16:00:00.000000	NULL	NULL	NULL	NULL	19803.407	314.30827563476487	223	
157797	2022-10-25 16:00:10.638630	2022-10-25 15:00:00.000000	NULL	NULL	NULL	NULL	19801.867	312.768275634764	223	
157670	2022-10-25 15:00:10.619236	2022-10-25 14:00:00.000000	NULL	NULL	NULL	NULL	19801.001	311.90227563476583	223	
157543	2022-10-25 14:00:10.577620	2022-10-25 13:00:00.000000	NULL	NULL	NULL	NULL	19800.248	311.1492756347652	223	
157417	2022-10-25 13:00:10.660993	2022-10-25 12:00:00.000000	NULL	NULL	NULL	NULL	19799.484	310.385275634766	223	
157301	2022-10-25 12:00:10.510276	2022-10-25 11:00:00.000000	NULL	NULL	NULL	NULL	19798.916	309.8172756347667	223	
157185	2022-10-25 11:00:10.656313	2022-10-25 10:00:00.000000	NULL	NULL	NULL	NULL	19798.399	309.3002756347669	223	
157059	2022-10-25 10:00:10.457268	2022-10-25 09:00:00.000000	NULL	NULL	NULL	NULL	19797.373	308.2742756347652	223	
156940	2022-10-25 09:00:10.484538	2022-10-25 08:00:00.000000	NULL	NULL	NULL	NULL	19796.846	307.747275634767	223	
156821	2022-10-25 08:00:10.682606	2022-10-25 07:00:00.000000	NULL	NULL	NULL	NULL	19796.018	306.91927563476565	223	
156702	2022-10-25 07:00:10.744969	2022-10-25 06:00:00.000000	NULL	NULL	NULL	NULL	19794.089	304.99027563476557	223	
156583	2022-10-25 06:00:10.792703	2022-10-25 05:00:00.000000	NULL	NULL	NULL	NULL	19793.259	304.1602756347638	223	
156464	2022-10-25 05:00:10.826258	2022-10-25 04:00:00.000000	NULL	NULL	NULL	NULL	19792.006	302.90727563476685	223	
156345	2022-10-25 04:00:10.779404	2022-10-25 03:00:00.000000	NULL	NULL	NULL	NULL	19791.512	302.41327563476443	223	
156226	2022-10-25 03:00:10.815989	2022-10-25 02:00:00.000000	NULL	NULL	NULL	NULL	19791.512	302.41327563476443	223	
156107	2022-10-25 02:00:10.846034	2022-10-25 01:00:00.000000	NULL	NULL	NULL	NULL	19791.512	302.41327563476443	223	
155988	2022-10-25 01:00:10.809565	2022-10-25 00:00:00.000000	NULL	NULL	NULL	NULL	19791.512	302.41327563476443	223	
155869	2022-10-25 00:00:10.755953	2022-10-24 23:00:00.000000	NULL	NULL	NULL	NULL	19791.512	302.41327563476443	223	



SELECT * FROM `statistics_short_term` where metadata_id = 222 order by start desc;


id	created	start   	mean	min	max	last_reset	state	sum	metadata_id	
1858874	2022-10-24 23:45:10.497616	2022-10-24 23:40:00.000000	NULL	NULL	NULL	NULL	10151.154	215.5409018554692	222	
1858757	2022-10-24 23:40:10.492945	2022-10-24 23:35:00.000000	NULL	NULL	NULL	NULL	10151.113	215.49990185546812	222	
1858640	2022-10-24 23:35:10.478558	2022-10-24 23:30:00.000000	NULL	NULL	NULL	NULL	10151.065	215.45190185546926	222	
1858523	2022-10-24 23:30:10.472035	2022-10-24 23:25:00.000000	NULL	NULL	NULL	NULL	10151.024	215.41090185546818	222	
1858406	2022-10-24 23:25:10.502559	2022-10-24 23:20:00.000000	NULL	NULL	NULL	NULL	10150.98	215.3669018554683	222	
1858289	2022-10-24 23:20:10.495029	2022-10-24 23:15:00.000000	NULL	NULL	NULL	NULL	10150.933	215.31990185546965	222	
1858172	2022-10-24 23:15:10.508730	2022-10-24 23:10:00.000000	NULL	NULL	NULL	NULL	10150.887	215.27390185546938	222	
1858055	2022-10-24 23:10:10.485829	2022-10-24 23:05:00.000000	NULL	NULL	NULL	NULL	10150.833	215.2199018554693	222	
1857938	2022-10-24 23:05:10.481446	2022-10-24 23:00:00.000000	NULL	NULL	NULL	NULL	10150.79	215.17690185546962	222	
1857821	2022-10-24 23:00:10.457594	2022-10-24 22:55:00.000000	NULL	NULL	NULL	NULL	10150.744	215.13090185546935	222	
1857706	2022-10-24 22:55:10.473723	2022-10-24 22:50:00.000000	NULL	NULL	NULL	NULL	10150.701	215.08790185546786	222	
1857591	2022-10-24 22:50:10.495297	2022-10-24 22:45:00.000000	NULL	NULL	NULL	NULL	10150.651	215.0379018554686	222	
1857474	2022-10-24 22:45:10.488631	2022-10-24 22:40:00.000000	NULL	NULL	NULL	NULL	10150.609	214.99590185546913	222	
1857357	2022-10-24 22:40:10.484946	2022-10-24 22:35:00.000000	NULL	NULL	NULL	NULL	10150.558	214.94490185546965	222	
1857240	2022-10-24 22:35:10.490866	2022-10-24 22:30:00.000000	NULL	NULL	NULL	NULL	10150.504	214.89090185546956	222	
1857123	2022-10-24 22:30:10.462701	2022-10-24 22:25:00.000000	NULL	NULL	NULL	NULL	10150.451	214.83790185546786	222	
1857008	2022-10-24 22:25:10.476402	2022-10-24 22:20:00.000000	NULL	NULL	NULL	NULL	10150.401	214.7879018554686	222	
1856893	2022-10-24 22:20:10.467576	2022-10-24 22:15:00.000000	NULL	NULL	NULL	NULL	10150.355	214.7419018554683	222	
1856776	2022-10-24 22:15:10.478508	2022-10-24 22:10:00.000000	NULL	NULL	NULL	NULL	10150.309	214.69590185546804	222	
1856659	2022-10-24 22:10:10.376396	2022-10-24 22:05:00.000000	NULL	NULL	NULL	NULL	10150.266	214.65290185546837	222	
1856540	2022-10-24 22:08:21.275439	2022-10-24 22:00:00.000000	NULL	NULL	NULL	NULL	10150.221	214.6079018554683	222	
1856421	2022-10-24 22:00:10.464638	2022-10-24 21:55:00.000000	NULL	NULL	NULL	NULL	10150.175	214.56190185546802	222	
1856302	2022-10-24 21:55:10.478164	2022-10-24 21:50:00.000000	NULL	NULL	NULL	NULL	10149.989	214.37590185546833	222	
1856183	2022-10-24 21:50:10.482522	2022-10-24 21:45:00.000000	NULL	NULL	NULL	NULL	10149.651	214.0379018554686	222	
1856064	2022-10-24 21:45:10.510826	2022-10-24 21:40:00.000000	NULL	NULL	NULL	NULL	10149.322	213.70890185546887	222	
1855945	2022-10-24 21:40:10.489884	2022-10-24 21:35:00.000000	NULL	NULL	NULL	NULL	10148.997	213.38390185546814	222	
1855826	2022-10-24 21:35:10.439765	2022-10-24 21:30:00.000000	NULL	NULL	NULL	NULL	10148.681	213.06790185546924	222	
1855707	2022-10-24 21:30:10.478963	2022-10-24 21:25:00.000000	NULL	NULL	NULL	NULL	10148.367	212.75390185546894	222	
1855590	2022-10-24 21:25:10.462965	2022-10-24 21:20:00.000000	NULL	NULL	NULL	NULL	10148.054	212.44090185546884	222	
1855473	2022-10-24 21:20:10.476605	2022-10-24 21:15:00.000000	NULL	NULL	NULL	NULL	10147.734	212.12090185546913	222	
1855354	2022-10-24 21:15:10.493533	2022-10-24 21:10:00.000000	NULL	NULL	NULL	NULL	10147.408	211.7949018554682	222	
1855235	2022-10-24 21:10:10.447878	2022-10-24 21:05:00.000000	NULL	NULL	NULL	NULL	10147.083	211.4699018554693	222	
1855116	2022-10-24 21:05:11.133019	2022-10-24 21:00:00.000000	NULL	NULL	NULL	NULL	10146.762	211.14890185546938	222	
1854997	2022-10-24 21:00:10.489243	2022-10-24 20:55:00.000000	NULL	NULL	NULL	NULL	10146.437	210.82390185546865	222	
1854878	2022-10-24 20:55:10.502886	2022-10-24 20:50:00.000000	NULL	NULL	NULL	NULL	10146.03	210.4169018554694	222	
1854759	2022-10-24 20:50:10.480329	2022-10-24 20:45:00.000000	NULL	NULL	NULL	NULL	10145.537	209.923901855469	222	
1854640	2022-10-24 20:45:10.469584	2022-10-24 20:40:00.000000	NULL	NULL	NULL	NULL	10145.114	209.50090185546833	222	
1854521	2022-10-24 20:40:10.471178	2022-10-24 20:35:00.000000	NULL	NULL	NULL	NULL	10144.773	209.15990185546798	222	
1854402	2022-10-24 20:35:10.473748	2022-10-24 20:30:00.000000	NULL	NULL	NULL	NULL	10144.44	208.82690185546926	222	
1854285	2022-10-24 20:30:10.402779	2022-10-24 20:25:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1854168	2022-10-24 20:25:10.472018	2022-10-24 20:20:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1854049	2022-10-24 20:20:10.379690	2022-10-24 20:15:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1853930	2022-10-24 20:15:10.479737	2022-10-24 20:10:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1853813	2022-10-24 20:10:10.470362	2022-10-24 20:05:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1853696	2022-10-24 20:05:10.459959	2022-10-24 20:00:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1853577	2022-10-24 20:00:10.476178	2022-10-24 19:55:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1853458	2022-10-24 19:55:10.465975	2022-10-24 19:50:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1853339	2022-10-24 19:50:10.480251	2022-10-24 19:45:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1853220	2022-10-24 19:45:10.460740	2022-10-24 19:40:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1853101	2022-10-24 19:40:10.470696	2022-10-24 19:35:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1852982	2022-10-24 19:35:10.485710	2022-10-24 19:30:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1852863	2022-10-24 19:30:10.458149	2022-10-24 19:25:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1852744	2022-10-24 19:25:10.466207	2022-10-24 19:20:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1852625	2022-10-24 19:20:10.499278	2022-10-24 19:15:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1852506	2022-10-24 19:15:10.460471	2022-10-24 19:10:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1852387	2022-10-24 19:10:10.469928	2022-10-24 19:05:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1852268	2022-10-24 19:05:10.464701	2022-10-24 19:00:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1852149	2022-10-24 19:00:10.477892	2022-10-24 18:55:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1852030	2022-10-24 18:55:10.463808	2022-10-24 18:50:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1851911	2022-10-24 18:50:10.468409	2022-10-24 18:45:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1851792	2022-10-24 18:45:10.478494	2022-10-24 18:40:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1851675	2022-10-24 18:40:10.460848	2022-10-24 18:35:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1851556	2022-10-24 18:35:10.465072	2022-10-24 18:30:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1851437	2022-10-24 18:30:10.458245	2022-10-24 18:25:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1851318	2022-10-24 18:25:10.488927	2022-10-24 18:20:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1851199	2022-10-24 18:20:10.486716	2022-10-24 18:15:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1851080	2022-10-24 18:15:10.478172	2022-10-24 18:10:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1850961	2022-10-24 18:10:10.472262	2022-10-24 18:05:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1850842	2022-10-24 18:05:10.454049	2022-10-24 18:00:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1850723	2022-10-24 18:00:10.477027	2022-10-24 17:55:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1850604	2022-10-24 17:55:10.459923	2022-10-24 17:50:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1850485	2022-10-24 17:50:10.465942	2022-10-24 17:45:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1850366	2022-10-24 17:45:10.454625	2022-10-24 17:40:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1850247	2022-10-24 17:40:10.465526	2022-10-24 17:35:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1850128	2022-10-24 17:35:10.486100	2022-10-24 17:30:00.000000	NULL	NULL	NULL	NULL	10144.204	208.59090185546847	222	
1850009	2022-10-24 17:30:10.000000	2022-10-24 17:25:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.59100341796875	222	
1849890	2022-10-24 17:25:10.000000	2022-10-24 17:20:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.58700561523438	222	
1849771	2022-10-24 17:20:10.000000	2022-10-24 17:15:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.58299255371094	222	
1849652	2022-10-24 17:15:10.000000	2022-10-24 17:10:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.57899475097656	222	
1849533	2022-10-24 17:10:10.000000	2022-10-24 17:05:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.5749969482422	222	
1849414	2022-10-24 17:05:10.000000	2022-10-24 17:00:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.5709991455078	222	
1849295	2022-10-24 17:00:10.000000	2022-10-24 16:55:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.56700134277344	222	
1849176	2022-10-24 16:55:10.000000	2022-10-24 16:50:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.56300354003906	222	
1849057	2022-10-24 16:50:10.000000	2022-10-24 16:45:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.5590057373047	222	
1848938	2022-10-24 16:45:10.000000	2022-10-24 16:40:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.55499267578125	222	
1848821	2022-10-24 16:40:10.000000	2022-10-24 16:35:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.55099487304688	222	
1848704	2022-10-24 16:35:10.000000	2022-10-24 16:30:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.5469970703125	222	
1848585	2022-10-24 16:30:10.000000	2022-10-24 16:25:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.54299926757812	222	
1848466	2022-10-24 16:25:10.000000	2022-10-24 16:20:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.53900146484375	222	
1848347	2022-10-24 16:20:10.000000	2022-10-24 16:15:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.53500366210938	222	
1848228	2022-10-24 16:15:10.000000	2022-10-24 16:10:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.531005859375	222	
1848109	2022-10-24 16:10:10.000000	2022-10-24 16:05:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.52699279785156	222	
1847990	2022-10-24 16:05:10.000000	2022-10-24 16:00:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.5229949951172	222	
1847871	2022-10-24 16:00:10.000000	2022-10-24 15:55:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.5189971923828	222	
1847752	2022-10-24 15:55:10.000000	2022-10-24 15:50:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.51499938964844	222	
1847633	2022-10-24 15:50:10.000000	2022-10-24 15:45:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.51100158691406	222	
1847514	2022-10-24 15:45:10.000000	2022-10-24 15:40:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.5070037841797	222	
1847395	2022-10-24 15:40:10.000000	2022-10-24 15:35:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.5030059814453	222	
1847278	2022-10-24 15:35:10.000000	2022-10-24 15:30:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.49899291992188	222	
1847159	2022-10-24 15:30:10.000000	2022-10-24 15:25:00.000000	NULL	NULL	NULL	NULL	10144.2041015625	208.4949951171875	222	



Could it be that you deleted some rows, or reused an entity id which is now a different sensor? The sum column of a new statistic should start at 0 for the oldest entry in the database, or you will get a spike like this.

I do notice that the most recent row you posted for statistics_short_term of metadata_id 222 has a start of 2022-10-24 23:40:00.000000 while the most recent row in statistics has a start of 2022-10-26 08:00:00.000000, which seems strange to me.

Indeed, database was corrupted after Mariadb migration and I had to delete all old values. Then I deleted sensor from dashboard and started again. I will update stats to start from 0 via sql.

Kudos Kars

Solved


UPDATE `statistics` SET sum = sum - 215 where metadata_id = 222;
UPDATE `statistics` SET sum = sum - 302 where metadata_id = 223;

1 Like

Hi kars

It is solved. I have 2 devices in my growatt integration. The converter and the plant. I had the converter used at first but now use the plant and it works great.

Thanks

You also have to fix your statistics_short_terrm table, or you will get a spike and wrong sums again at the next hourly run.

Profit! Now I can finally visualize the energy consumption which I am not measuring (which is strange as I measure energy consumption throughout my house at 24 different points). Maybe I will have to have a look at calibrating all energy sensors again…

Capture

1 Like

Indeed, again thanks @Kars


UPDATE `statistics` SET sum = sum - 215 where metadata_id = 222 and sum > 215;
UPDATE `statistics` SET sum = sum - 302 where metadata_id = 223 and sum > 302;
UPDATE `statistics_short_term` SET sum = sum - 215 where metadata_id = 222 and sum > 215;
UPDATE `statistics_short_term` SET sum = sum - 302 where metadata_id = 223 and sum > 302;

Should have been like this first time :


UPDATE `statistics` SET sum = sum - 215 where metadata_id = 222 ;
UPDATE `statistics` SET sum = sum - 302 where metadata_id = 223 ;
UPDATE `statistics_short_term` SET sum = sum - 215 where metadata_id = 222 ;
UPDATE `statistics_short_term` SET sum = sum - 302 where metadata_id = 223 ;
1 Like

Hello Frank,
I’ve only been running my HA for about a month and I’m looking for exactly this value. Can you explain this to a newbie how to get it?
Best regards and thanks in advance

Decided to create a separate topic for that. Find my description: Measure unmeasured energy consumption

1 Like

Hi,

I use an ESPHome based ultrasonic distance sensor to measure the remaining amount of heating oil in my tank. It has been working flawlessly since march now and I’ve added it succesfully to the energy dashboard (why can’t we rename gas to “oil” or just “heating”??).
grafik
The esp reports the oillevel only once a day, at 2 o’clock in the night.
Now to my problem: there’s days when we do not use any oil (on warmer days, and when we instead use electric heating). If no usage was reported for a specific day, the cost for that day is 0 (which is off course correct) however the cost for the following day is always 0 as well, even if there is oilusage on that day.
This is clearly a bug in the energy dashboard. Is there anything I can do about it?

Costs of water are not being tracked.
Why is that?


Took some time, now it’s fixed.

Hi,
I have a Growatt inverter that I used to monitor with the build-in Growatt integration of HA (Growatt Inverter uses a Dongle, that sends info to the Growatt servers, then HA contacts those Growatt server). But since that sometimes doesn’t work correctly (Growatt blocking the calls from HA, due to checking if the request is actually coming from a phone running ShinePhone), I have built an ESP32+TTL-to-RS-485 converter to locally monitor it locally using ESPHome. That is working just great, and is recognized as an energy source, but now I want to change my Energy Dashboard to use the readings from ESPHome AND retain the historical data from the Growatt integrated data.
Is this possible ? So modify the Solar energy part of the dashboard to use the ESPHome Growatt data and still retain the old statistics ?

How do I configure Home Assistant to never delete the meter readings of my P1 integration (slimme meter). And is there an easy way to export meter readings to CSV?

Long term hourly statistics are kept indefinitely as far as I know.

If you are using the default SQLite database, you could install the SQLite Web add-on. It has the option to export to CSV.

Metadata about the entities that have statistics is in the statistics_meta table, the statistic_id column is the entity name, and the id column is used as a foreign key in the statistics table (column metadata_id). For energy entities the sum is the total sum since creation of the statistic. The actual readings are kept in the state column.

Hello there, I’m writing to you because last night my statistics got messed up… I’ve read several hints from this thread and I think I can pinpoint a moment in time that my database went wrong. But it doesn’t look like there’s one wrong value / row that I could delete to fix it, because the error is in the sum column… Could you please point me in the right direction to fix it?

This is my database content where you can see the sum went wrong even though the readout from entity was right…

In Developer Tools > Statistics you can see each entity, and then delete or correct rows for a specific time where the error occurred. You need to click on the icon showing an arrow pointing up a slope which should be visible for the entity you are having issues with.

Thanks for brilliant advice, didn’t know there’s a tool already to do that :slight_smile:

All’s fine now. Thanks again.

Hi all,

For starters, I’d like to say that having recently added by PV batteries to the Energy management, it all was working apparently well during the short time I was feeding the batteries directly from DC with the hybrid inverters.

However it all went “wrong” when the weather got worse this month, the energy sale value went up, and it became more interesting to charge the batteries at night during off-peak hours from the grid, use them to satisfy the loads at peak hours during the day, and keep all PV production with feed-in priority, i.e. sell it all.

Now, in this use case, although the intra-day solar production appears correctly, the graph on the right with the total values for the day appears to be wrong, as it does when we try to see any of week/month/year when the manager sums it all up:

It seems Energy management is assuming the battery was charged from solar as far as daily totals go, because I see no orange arc on the “Home” total, and there is a pink dot descending from “Solar” into “Battery” which was not supposed to be there, as the battery was fully charged from the grid.

If I go to the weekly agregation, all the self-consumption is missing from that day’s bar (Dec 5th):

Is there any configuration I might be missing?
Or is this a unforeseen use case that was not programmed in the first place?

Thanks in advance,
-jprates

1 Like