CJNE / ha-myenergi

Home Assistant integration for MyEnergi devices
MIT License
150 stars 33 forks source link

Hub does not connect #570

Closed silverailscolo closed 3 months ago

silverailscolo commented 3 months ago

Hub component does not connect. On restart, log says: Connection.__init__() takes from 1 to 4 positional arguments but 5 were given

Version of the custom_component

0.0.28

Configuration

HA version: '2024.8.2', 'installation_type': 'Home Assistant OS
supervisor: 'healthy': True, 'supported': True, 'arch': 'aarch64'
operating_system: 'board': 'rpi4-64', 'version': '13.0'
pymyenergi version installed in hass: 0.0.29

HACS myenergi integration configured via UI Zappi v2, Hub + Harvi all running fine since 2023 (except for a recent warning about missing num_phases attribute).

Today I updated the myenergi integration via HACS.

Describe the bug

myenergi integration does not complete, sensors are grayed out/unavailable. Code in connection.py seems to provide 5 args:

Debug log

[...]
2024-08-21 12:48:17.751 INFO (MainThread) [homeassistant.setup] Setting up myenergi
2024-08-21 12:48:17.751 INFO (MainThread) [homeassistant.setup] Setup of domain myenergi took 0.00 seconds
2024-08-21 12:48:17.751 INFO (MainThread) [custom_components.myenergi] 
-------------------------------------------------------------------
myenergi
Version: 0.0.28
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-08-21 12:48:17.761 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry MyHub for myenergi
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/myenergi/__init__.py", line 51, 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 4 positional arguments but 5 were given
[...]
G6EJD commented 3 months ago

And when was the last time you updated your API key? They were changed recently by MyEnergi.

silverailscolo commented 3 months ago

Generated a new key as suggested, and the key was accepted by the myenergi API when running a python import script. However in HA I still get a message: 'Could not connect to myenergi, please try again in a while."

myenergi HA integration error

Full log:

Deze fout is ontstaan door een aangepaste integratie. [= This error was caused by a custom integration]

Logger: custom_components.myenergi
Bron: custom_components/myenergi/config_flow.py:102
integratie: myenergi (documentatie, problemen)
Eerst voorgekomen: 17:12:48 (14 gebeurtenissen)
Laatst gelogd: 17:55:23

Traceback (most recent call last): File "/config/custom_components/myenergi/config_flow.py", line 88, in _test_credentials conn = await self.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 4 positional arguments but 5 were given
silverailscolo commented 3 months ago

Getting the same "5 args" error in log when trying to reinstall myenergy integration in HA:


Deze fout is ontstaan door een aangepaste integratie.

Logger: custom_components.myenergi
Bron: custom_components/myenergi/config_flow.py:102
integratie: myenergi (documentatie, problemen)
Eerst voorgekomen: 17:12:48 (17 gebeurtenissen)
Laatst gelogd: 19:55:10

Traceback (most recent call last): File "/config/custom_components/myenergi/config_flow.py", line 88, in _test_credentials conn = await self.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 4 positional arguments but 5 were given

Updating pymyenergi to latest version using -U option made no difference.

silverailscolo commented 3 months ago

My issue disappeared after removing an local copy of outdated pymyenergi code that was inside the /homeassistant/ dir on my raspi.

Will close this Issue