SonnenladenGmbH / APsystems-EZ1-API

The APsystems EZ1 Python library offers a streamlined interface for interacting with the local API of APsystems EZ1 Microinverters.
MIT License
63 stars 14 forks source link

Restart of daily production #30

Open patman15 opened 2 months ago

patman15 commented 2 months ago

Hi @mawoka-myblock!

Referring to https://github.com/SonnenladenGmbH/APsystems-EZ1-API-HomeAssistant/issues/34 I now made a patch for the HA integration. Nevertheless, after being done I thought, probably this should better be fixed already in the API, i.e. in this repo. Would you agree/accept a patch for the get_ouput_data function? Only issue is that the API is then not stateless any more versus some strange code in the HA integration that does not seem to belong there. Please let me know your thoughts then I can prepare a patch accordingly. I'm still on the old repo due to this missing functionality. Thanks!

mawoka-myblock commented 2 months ago

Thanks for bringing that back up! The thing is that hardly any user seems to be facing this issue. I'd accept a PR when the debounce is/would be opt-in.

def __init__([...], debounce_values: bool = False):

I'd accept and appreciate that! I really appreciate the caution and thoughts you put into this library!

patman15 commented 2 months ago

The thing is that hardly any user seems to be facing this issue.

Well I think that most people simply don't care about the small fluctuations in the morning and in the evening. Also loss of solar power during the day is rather rare, or people just don't use the daily counter. Otherwise, I would bet a lot of people are affected and just didn't notice. :smile:

Anyway, I would only debounce the daily values, there is no point for the others. I'll make a proposal, your __init__ prototype is great for backwards compatibility, but also means that a small change also in the integration is needed, right? How would you envision that?

Thanks for showing the willingness to fix it, helps me a lot as I do not have that big solar and thus the difference matters.

mawoka-myblock commented 2 months ago

I really don't know where it's coming from. My inverter handles it without a problem.

image

mawoka-myblock commented 2 months ago

I honestly don't consider this to be required as the Home assistant integration doesn't use it and I've never heard anyone complain about that problem. I honestly really think your inverter is faulty. And just setting it in the init of the home assistant integration to true isn't a huge problem at all. Please just create the PR here and only debounce the daily values when the option is set in the init function.

patman15 commented 2 months ago

I really don't know where it's coming from. My inverter handles it without a problem.

Not sure, can you deep zoom-in on 3rd of May, especially morning?

I honestly don't consider this to be required as the Home assistant integration doesn't use it.

Sorry, I lost track, what do you mean by 'it' that is not used by HA?

In my opinion it is a principle issue (not saying it is dramatic :wink:) with the inverter. The inverter turns of all communication (WiFi, BT) when there is not enough power from solar for some minutes and it resets daily energy value. Thus, whenever the solar power drops so the inverter turns off the issue occurs. Obviously, this is unlikely during day, especially summer times. No doubt.

I might see the issue more easily because I have very low power panels connected, but as described above it is an inherent topic due to the inverter functionality. Please correct me if I got something wrong.

UPDATE: Just verified using BT app (direct connection): production running (later afternoon), daily production ~0.4kWh, unplugged solar, waited 1 minute, plugged solar in, daily production 0.0kWh, runtime 15sec. So, as soon as solar is gone the day "ends" which makes sense from simplicity point of view, but not for correct counting ;-)