Emilv2 / huawei_solar

Home Assistant custom component for Huawei inverters
Apache License 2.0
174 stars 41 forks source link

Solar yield is reduced by the battery charge #60

Open killee opened 2 years ago

killee commented 2 years ago

In my understanding the solar yield is the energy that the inverter gets from the PV. The yield that I get is with the substraktion of the energy that flows into the battery. My yield of today: image Battery energy: image And the expression on fusion: image

The problem is if I use it for the energy visualization of HA it did not match... image

I try to solve this by a template:

But to solve this robust a zero handling has also to add... In my opinion this is also not the perfect way.

Any change to handle this in the integration?

johanvh83 commented 2 years ago

I used your template for the PV Solar production but it doesn't works: image Compared to FusionSolar: image Why it's so complicated to setup the Energy Integration? Almost anybody is struggling with it...

killee commented 2 years ago

It seems to be not that easy as expected...

I think I have solved this issue. The attribute gives the DC Power. I integrate it with HA, than template it.

template:

sensor:

It seems to work. Lets have a look at a other day with sunlight.

johanvh83 commented 2 years ago

Changed my code according your idea. Had already made a template sensor based on the input_power and made also the sensor integration (Riemann sum integral integration) but couldn't insert it in the Energy integration because the last template sensor with the correct device_class and state_class was missing. I believe indeed, this should work. I have just 1 concern. I get a warning but that's maybe because there is no solar production at this time:

Schermafbeelding 2021-12-22 om 20 12 11

I'll keep you informed! Thanks, anyway.

killee commented 2 years ago

@johanvh83 I think you have to wait a bit.

With the integration I have another issue: image And the Power: image

It seems that this is a issue with the integration...

johanvh83 commented 2 years ago

Hi, I checked actual state, but all seems to work correctly.

This is my sensor I used in the Energy integration as solar production: image

So far everything looks normal and correct: image

FusionSolar: image

FusionSolar gives yield of 2,47 kWh till 14:05, HA gives 2,7 kWh in the Energy integration till 14:00, there is a difference. Don't know how it's possible. FusionSolar should give more than 2,7 kWh when the measurement is taken 5 minutes later. It has problably to do with some loss...

killee commented 2 years ago

I've the same issue...

But fusion did it wrong. The Daly yield in fusion is only the energy in the battery without the consumption that is directly used...

inigoml commented 2 years ago

Same problem here after adding battery. In my understanding, "Consumed Solar" includes also "Consumed Battery" and since it is added, real consumption is considered twice.

image

inigoml commented 2 years ago

I think I have solved this issue. The attribute gives the DC Power. I integrate it with HA, than template it.

I've implemented your solution and is working properly. However, there is a problem by not using total_generation counters. If for some reason you loose access to inverter (and this happens time to time, at least for me), you won't update stats for that period and there is no way to recover them. I think a more accurate approach would be to subtract to sensor_total_yield_XXXXXX those values given by sensor.storage_total_discharge_XXXXXXX. This way, we would have ONLY energy produced by PV system and not dumped by battery.