Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on load with 0.0.29, too many function arguments #592

Open
Gnarfoz opened this issue Oct 17, 2024 · 12 comments
Open

Error on load with 0.0.29, too many function arguments #592

Gnarfoz opened this issue Oct 17, 2024 · 12 comments

Comments

@Gnarfoz
Copy link

Gnarfoz commented Oct 17, 2024

Version of the custom_component

0.0.29

Error log

2024-10-17 08:38:57.864 INFO (MainThread) [custom_components.myenergi]
-------------------------------------------------------------------
myenergi
Version: 0.0.29
This is a custom integration!
If you have any issues with this you need to open an issue here:
https://github.com/CJNE/ha-myenergi/issues
-------------------------------------------------------------------

2024-10-17 08:38:57.866 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry The Doghouse for myenergi
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/myenergi/__init__.py", line 54, in async_setup_entry
    conn = await hass.async_add_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Connection.__init__() takes from 1 to 6 positional arguments but 7 were given

Describe the bug

When the integration is initialized, the error is logged and the integration is not loaded.
Looks like the changes in 410c0f9 for #577 are causing this.

Debug log

2024-10-17 08:50:33.712 DEBUG (MainThread) [homeassistant.loader] Component myenergi import took 2.816 seconds (loaded_executor=True)
2024-10-17 08:50:33.713 INFO (MainThread) [homeassistant.setup] Setting up myenergi
2024-10-17 08:50:33.713 INFO (MainThread) [homeassistant.setup] Setup of domain myenergi took 0.00 seconds
2024-10-17 08:50:33.713 INFO (MainThread) [custom_components.myenergi]
-------------------------------------------------------------------
myenergi
Version: 0.0.29
This is a custom integration!
If you have any issues with this you need to open an issue here:
https://github.com/CJNE/ha-myenergi/issues
-------------------------------------------------------------------

2024-10-17 08:50:33.716 DEBUG (MainThread) [homeassistant.setup] Phase config_entry_setup for myenergi (f59520777d730fb0dc1779105035a534) took 0.00s (elapsed=0.00s) (wait_time=0.00s)
2024-10-17 08:50:33.716 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry The Doghouse for myenergi
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/myenergi/__init__.py", line 54, in async_setup_entry
    conn = await hass.async_add_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Connection.__init__() takes from 1 to 6 positional arguments but 7 were given
2024-10-17 08:50:33.724 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=myenergi>
@CJNE
Copy link
Owner

CJNE commented Oct 17, 2024

It sounds like the latest version of pymyenergi has not been installed properly, perhaps a restart will fix it?

@zxcq
Copy link

zxcq commented Oct 17, 2024

Had the same this morning; after a couple of restarts I rolled back to 0.0.28

@Gnarfoz
Copy link
Author

Gnarfoz commented Oct 17, 2024

I restarted at least twice - once to update the integration, and once more to enable debug logging. The error was present in both cases.
Can I somehow check which version of pymyenergi is installed?

@trizmark
Copy link
Contributor

@Gnarfoz If you're running homeassistant in docker, you can do the following:

pi@rpi-prod:~ $ docker exec -it homeassistant pip list | grep pymyenergi
pymyenergi                       0.2.1

@zxcq
Copy link

zxcq commented Oct 17, 2024

On 2024.10.1 from ghcr.io/home-assistant/home-assistant:stable pip list | grep pymyenergi doesn't return a result (other packages exist) but it's working at the mo on 0.0.28 ?

@CJNE
Copy link
Owner

CJNE commented Oct 17, 2024

Version 0.2.2 of pymyenergi is required for 0.0.29, not sure why HA isn't using it though, in the integration manifest it's set to pymyenrgi==0.2.2.

Perhaps it's looking at the latest version on Github?
The latest version was incorrectly set to 0.2.1 there, i've changed that now.

@trizmark
Copy link
Contributor

I've got my 'main' HA server on 2024.9.3, with ha-myenergi still on 0.0..28.
pymyenergi 0.2.1
My 'dev' HA server is on 2024.10.1, where I just upgraded ha-myenergi to 0.0.29.
pymyenergi 0.2.2
It looks correct from my side.

@zxcq
Copy link

zxcq commented Oct 17, 2024

Probably in for a world of python pain later but fixed by manually removing 0.2.1 from

config# find . -name pymyenergi\*
./deps/lib/python3.12/site-packages/pymyenergi-0.2.1.dist-info
./deps/lib/python3.12/site-packages/pymyenergi
./deps/pymyenergi
./deps/pymyenergi-0.2.2.dist-info

and reinstalling

@Gnarfoz
Copy link
Author

Gnarfoz commented Oct 17, 2024

@zxcq same here, pymyenergi doesn't show up in pip list.

The weird thing about the deps folder is:

root@beta:/var/opt/homeassistant/config# cat deps/pymyenergi/VERSION
0.2.2

root@beta:/var/opt/homeassistant/config# cat deps/lib/python3.12/site-packages/pymyenergi/VERSION
0.2.1

Why are they different? Hmm.

@Gnarfoz
Copy link
Author

Gnarfoz commented Oct 17, 2024

@CJNE looks like this is a bug in Home Assistant :-(
home-assistant/core#127966

@CJNE
Copy link
Owner

CJNE commented Oct 17, 2024

@Gnarfoz ouch, updating dependencies has been working fine in the past, hopefully this is a temporary glitch.

For the moment it's totally fine to stick to 0.0.28, the only change is 0.0.29 is that it uses the non-blocking http client so that HA no longer warns about it.
I'll try to investigate how to best handle this, perhaps the best option would be to make a new release that isn't depending on pymyenergi 0.2.2

@CJNE
Copy link
Owner

CJNE commented Oct 17, 2024

I've changed the latest label to 0.0.28 for now since 0.0.29 won't work until the dependency issue in HA has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants