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
61 stars 14 forks source link

[Bug]: ReturnOutputData.__init__() got an unexpected keyword argument 'originalData' #36

Open maoLz opened 2 weeks ago

maoLz commented 2 weeks ago

What happened?

Hello, I am going to use Home Assistant to integrate apsystem ez1, but the code reports an error. I checked the local interface return contains an extra parameter: "originalData". In your code, "init" failed.

image

The python error

2024-10-08 14:31:44.497 ERROR (MainThread) [homeassistant.components.apsystems] Unexpected error fetching APSystems Data data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/apsystems/coordinator.py", line 46, in _async_update_data
    output_data = await self.api.get_output_data()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/APsystemsEZ1/__init__.py", line 189, in get_output_data
    return ReturnOutputData(**response["data"]) if response else None
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ReturnOutputData.__init__() got an unexpected keyword argument 'originalData'

Your python version

python3

Your OS inlcuding your version

Home ASSISTANT OS 13.1 (RPI 5)

maoLz commented 2 weeks ago

When I write the constructor manually, everything works fine. Can I submit a PR?

image

mawoka-myblock commented 1 week ago

That's not how it works, we'll have to investigate why your inverter returns that data, as other don't. Which model and firmware version are you using specifically?

maoLz commented 1 week ago

Thank you for your prompt reply, invert firmware version is "EZ1 1.7.1", and here is the photo of my inverter information: image

mawoka-myblock commented 1 week ago

Very interesting! I'd appreciate a PR, but you have to make sure that the originalData is optional as my inverter doesn't return that. Just get started with the PR and feel free to ask for help there!

maoLz commented 1 week ago

Thank you, I have submitted a PR.