core icon indicating copy to clipboard operation
core copied to clipboard

Integration Kostal Plenticore Solar Inverter

Open nowairly opened this issue 2 years ago • 1 comments

The problem

Seems, that G2 Inverter are not supported. Adding the inverter via IP / password ends with an unexpected error.

Kostal Plenticore Plus 8.5 G2 SW-Version 02.06.09313 MC-Version 02.06.2080 IOC-Version 02.06.0441

2023-03-19 14:35:09.170 ERROR (MainThread) [homeassistant.components.kostal_plenticore.config_flow] Unexpected exception Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/kostal_plenticore/config_flow.py", line 54, in async_step_user hostname = await test_connection(self.hass, user_input) File "/usr/src/homeassistant/homeassistant/components/kostal_plenticore/config_flow.py", line 35, in test_connection values = await client.get_setting_values("scb:network", "Hostname") File "/usr/local/lib/python3.10/site-packages/pykoplenti/init.py", line 564, in _wrapper return await fn(self, *args, **kwargs) File "/usr/local/lib/python3.10/site-packages/pykoplenti/init.py", line 760, in get_setting_values return {module_id: {data_response[0]["id"]: data_response[0]["value"]}} IndexError: list index out of range

What version of Home Assistant Core has the issue?

2023.3.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Kostal Plenticore Solar Inverter

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

nowairly avatar Mar 19 '23 13:03 nowairly

Hey there @stegm, mind taking a look at this issue as it has been labeled with an integration (kostal_plenticore) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of kostal_plenticore can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign kostal_plenticore Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


kostal_plenticore documentation kostal_plenticore source (message by IssueLinks)

home-assistant[bot] avatar Mar 19 '23 17:03 home-assistant[bot]

@nowairly

Maybe i'm facing the same issue. I have two Plenticore, one of them is G1 and the the second is G2.

G1 is already in HA and i'm not able to add the second one.

SW-Version  2.06.09313
MC-Version  02.06.2080
IOC-Version  02.06.0441
HW-Version  0106

deadrabbit87 avatar Mar 26 '23 07:03 deadrabbit87

@deadrabbit87 Same for me, the G1 works fine, G2 is not possible to add.

nowairly avatar Apr 02 '23 18:04 nowairly

I get the same error and have a Plenticore plus 10 G2.

erikbadman avatar Apr 04 '23 15:04 erikbadman

Is the correct way to make changes to the code and run it to add the files in the repo under /config/custom_components/kostal_plenticore ?

erikbadman avatar Apr 04 '23 16:04 erikbadman

I have looked a little at this now and it seems the names of settings and data sources has changed. I made a test as per the example in the pykoplenti github repo and used the code from this integration and got the same error. When I changed line 35 in config_flow.py from: values = await client.get_setting_values("scb:network", "Hostname") to: values = await client.get_setting_values("scb:network", "Network:Hostname") it worked

Attaching output of all-settings and all-processdata. all-processdata-G2.txt all-settings-G2.txt

erikbadman avatar Apr 04 '23 20:04 erikbadman

Is the correct way to make changes to the code and run it to add the files in the repo under /config/custom_components/kostal_plenticore ?

Sorry, i didn't know that, but your plan sounds not wrong.

Great that you have found the issue.

BW

deadrabbit87 avatar Apr 05 '23 05:04 deadrabbit87

I made the changes to get G2 working here: https://github.com/erikbadman/core/tree/kostal-plenticore-g2

I have tested this in my home assistant installation and I can now configure the the integration and get data in to HA. Used this information to add the changes locally: https://developers.home-assistant.io/docs/development_tips#test-core-integration-changes-in-your-production-home-assistant-environment

This will of course make G1 stop working, just made this to get my G2 working for now quickly.

erikbadman avatar Apr 05 '23 12:04 erikbadman

Just installed your changed file @erikbadman, it works as described :-) G2 is running now, G1 not. Thank you, for your effort! As far as I understood, this solution overrides the core integration with the custom. Is there a way, to use both integrations?

nowairly avatar Apr 05 '23 16:04 nowairly

@nowairly Yes it overrides the core integration, I think you should be able to use both if you change the name of the custom one. Maybe this could work https://developers.home-assistant.io/blog/2019/04/12/new-integration-structure/

erikbadman avatar Apr 05 '23 16:04 erikbadman

@erikbadman

Could you please have a look on this issue also?

https://github.com/home-assistant/core/issues/87611

deadrabbit87 avatar Apr 06 '23 18:04 deadrabbit87

I can't add my kostal plenticore g2 to home assistant either.

Th0tti avatar Apr 21 '23 14:04 Th0tti

As workaround it is possible to override the core integration with the fix of Erikbadman - for a "G2 only" setup.

For the case of a mixed setup with G1 and G2 you can use the fix of Erikbadman to build a custom integration for the G2 inverter. The core integration can be still used for the G1 in this case.

nowairly avatar Apr 24 '23 08:04 nowairly

The client also contains a method get_settings which returns all available setting ids. Maybe a better way would be to read these ids first and then chose either "Hostname" or "Network:Hostname" depending on which id is available.

Some of the ids are also used in the Plenticoreclass in module helper.py.

I have looked a little at this now and it seems the names of settings and data sources has changed. I made a test as per the example in the pykoplenti github repo and used the code from this integration and got the same error. When I changed line 35 in config_flow.py from: values = await client.get_setting_values("scb:network", "Hostname") to: values = await client.get_setting_values("scb:network", "Network:Hostname") it worked

stegm avatar Apr 25 '23 19:04 stegm

Does anyone know if the core will be changed by official update in the near future?

Th0tti avatar Apr 27 '23 10:04 Th0tti

Same problem here with a (only G2) plenticore setup. And I also hope for the official update ;-)

matzefisi avatar Apr 27 '23 11:04 matzefisi

Same as me. Official Update would be awesome!

deadrabbit87 avatar Apr 28 '23 08:04 deadrabbit87

@erikbadman Did you create a pull request?

Th0tti avatar Apr 28 '23 12:04 Th0tti

@Th0tti I haven't since it's not a proper fix. I will try do to that this weekend if I can find the time

erikbadman avatar Apr 28 '23 13:04 erikbadman

Excellent. Thanks very much. As a solution, there could be a drop-down menu when querying the host, or a second integration with G2 inverters could be added.

Th0tti avatar Apr 28 '23 13:04 Th0tti

@stegm I have added a check as you suggested and created a PR for this (https://github.com/home-assistant/core/pull/92198)

I have tested it locally and it works with my G2 hardware

erikbadman avatar Apr 28 '23 18:04 erikbadman

Nice.

Th0tti avatar Apr 28 '23 19:04 Th0tti

@stegm I have added a check as you suggested and created a PR for this (#92198)

I have tested it locally and it works with my G2 hardware

Thank you for contributing. I reviewed your changes, please take a look at it.

stegm avatar Apr 29 '23 07:04 stegm

@stegm When do you think the update will be released. Version 2023.5?

Th0tti avatar Apr 30 '23 04:04 Th0tti

@stegm When do you think the update will be released. Version 2023.5?

I have no influence of that apart helping reviewing the changes.

stegm avatar May 07 '23 11:05 stegm