davidrapan / ha-solarman

⚡ Solarman Stick Logger integration for 🏠 Home Assistant
MIT License
110 stars 25 forks source link

Todays totals wrong #219

Closed MikealSouth closed 1 month ago

MikealSouth commented 1 month ago

Description

For a couple of weeks/months the Integrations displays incorrect sums for "Today Production/Usage/etc" for a device that's called "deye_12k". Here is the "Today's Production" as a example. Screenshot from 2024-10-17 11-23-38

WhatsApp Image 2024-10-17 at 11 14 58

Could someone please point me to what I am doing wrong? The WiFi connectivity is excellent, also I am using the SG04LP3 yaml file.

Reproduction Steps

Just gathering data, the current sensor data like production, consumption, battery SOC, seems to be fine.

Log

home-assistant_solarman_2024-10-17T09-18-25.668Z.log

Version

24.10.16

davidrapan commented 1 month ago

Hey @MikealSouth, I wouldn't think much of it cause today sensors are not important at all. It could have been just a fluke. The most important is if the total sensors worked and had values as expected.

MikealSouth commented 1 month ago

Hey @MikealSouth, I wouldn't think much of it cause those sensors are not important at all. It could have been just a fluke. The most important is if the total sensors worked and had values as expected.

Hey @davidrapan, the problem is that the total sensors have the same problem, here " Total Production" as my example. Screenshot from 2024-10-17 11-35-37

The smartphone app seems to have the correct values WhatsApp Image 2024-10-17 at 11 38 57

davidrapan commented 1 month ago

So that means that your device caused it.

You will have to correct your history using Developer tools >> STATISTICS >> Total Production >> Graph icon and find the time when this occurred and fix it.

MikealSouth commented 1 month ago

OK, interesting, thank you. Problem is that I can't seem to find the time that the error occured, pretty sure that this happened last month, then I look into the history of last month I can't find anything Screenshot from 2024-10-17 12-04-56

I am currently trying to use the "Fix Issue" function as I seem to have tons of them. Screenshot from 2024-10-17 12-12-11

davidrapan commented 1 month ago

You have to correct it using that icon on the right. There you will see datetime picker and timestamps with values...

MikealSouth commented 1 month ago

OK, thank you for all of your help but I need to bug you once more but this. Do I just need to find one occurance of this or the first one around a month ago? I've tried to google this but can't really find the answer, sorry to bug you teaching me how troubleshoot HA.

Here is my example, yesterdays export to grid Screenshot from 2024-10-17 12-44-01

I couldn't even fully charge my 14,6kWh battery, no way my system has exported +70kWh. Do I just correct/guess these values or do I need to find the first occurance os these spikes?

Is there a way to just delete the historic values and just start from scratch?

davidrapan commented 1 month ago

You need to fix all occasions when this fluke happened. So it depends of how many times it happened. If you click on that bottom left button called OUTLIERS or something like that and if lucky it will show you all the occasions when irregular delta was detected and then if you fix those it should be enough.

So let's say you see for example in some time +13 kWh you correct it to 0 kWh and so on.

Is there a way to just delete the historic values and just start from scratch?

Yes there is a way. If you delete the device from the integration and then again go into STATISTICS page and click on FIX ISSUE and then CONFIRM on all the total sensors which belong to that deleted device. You will essentially delete whole long term statistics (data used in the energy dashboard) of that particular sensor.

MikealSouth commented 1 month ago

I used to have several of these events a day so I chose the "delete historic data" path. Somehow after deleting the device, dev > statistic > search for device and "fix issues" the data came back as seen as I added that device again. So I want the more hardcore route (after a full backup) and used the SQLite explorer

SELECT * FROM "statistics_meta" WHERE "statistic_id" = "sensor.deye_12k_today_production";
765 sensor.deye_12k_today_production;
DELETE FROM statistics WHERE metadata_id="765";
SELECT * FROM "statistics_meta" WHERE "statistic_id" = "sensor.deye_12k_total_production";
766 sensor.deye_12k_total_production;
DELETE FROM statistics WHERE metadata_id="766";

I will report back if that helped. Thank you very much @davidrapan

davidrapan commented 1 month ago

Somehow after deleting the device, dev > statistic > search for device and "fix issues" the data came back as seen as I added that device again.

When you click on the sensor you see short term statistics. 😉 For energy dashboard are important long term statistics and those are deleted using this procedure.

MikealSouth commented 1 month ago

I totally understand your point and if I would have seen another way I would have taken that. The only real long term statistic I really need is this:

Screenshot 2024-10-17 at 20 31 59

Since April 2nd my home has used 114kWh from the grid and send 4498 kWh to the grid.

Would it be great to have that data? Yes sure. If my approach doesn't work tomorrow I'll revert back and put more time into understanding the solution.