I switched to use Enphase Envoy integration today, before that I was using the DEV version. The new sensor was created in kW instead of W, so my script made an error to produce in kkWh (kilo kWh).
How to DELETE those incorrect data from the database? Which table should I look for?
If you know the period of the bad data, you can adjust it from the Developer Tools, Statistics option.
Search for the relevant sensor and select the statistic graph icon.
You will get a pop-up allowing you to adjust the value.
One lesson I learnt when I had this happen to me is to not use the hardware sensor directly. Load it into a utility meter and use that. That way if you change the hardware or rename the sensor, it won’t mess anything up until you match it in the utility meter so you can check it looks right beforehand.
Shame the Statistics one didnt work for you - that’s by far the easiest method.
If you can afford to lose all of your energy data, you can delete the home-assistant_v2.db in the config folder and restart (this will delete every sensor value however).
If you’ve too much and can’t afford to lose any, there’s several methods others have used.
e.g. Remove bad data from energy database