nordicopen / easee_hass

Custom component for Easee EV charger integration with Home Assistant
216 stars 37 forks source link

Version 0.9.61 not starting after upgrade #475

Closed dschaedl closed 1 month ago

dschaedl commented 1 month ago

Before creating an issue...

The problem

After Upgrade to Version 0.9.61 from 0.9.59 the easee extension does not start anymore. (I already had the same issue in version 0.9.60, but did not file a report). the Integration just says "failed to set up: check the logs". Also the configuration of the extension is not working and returns: "Config flow could not be loaded: 500 Internal Server Error Server got itself in trouble" after downgrade to 0.9.59 everything is ok again.

Version of Easee integration having the issue?

easee-0.9.61

Version of Home Assistant Core having the issue?

core-2024.9.3

Anything in the logs that might be useful for us?

2024-09-27 20:52:10.376 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry xxx.yyy@ggg.com for easee
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/easee/__init__.py", line 37, in async_setup_entry
await controller.initialize()
File "/config/custom_components/easee/controller.py", line 469, in initialize
self.easee = Easee(
^^^^^^
TypeError: Easee.__init__() takes from 3 to 4 positional arguments but 5 were given

Additional information

No response

olalid commented 1 month ago

My guess is that your installation is somehow broken and does not succeed in installing the right version of pyeasee lib. Do you see some lines like this?

2024-09-26 22:31:03.198 INFO (SyncWorker_6) [homeassistant.util.package] Attempting install of pyeasee==0.8.4 2024-09-26 22:31:24.480 INFO (MainThread) [pyeasee.easee] Easee python library version: 0.8.4

dschaedl commented 1 month ago

I see no reference to "Attempting install of pyeasee" in my logs. after installation of 0.9.61 I see 2024-09-28 10:56:03.823 DEBUG (MainThread) [custom_components.easee] Setting up Easee component version 0.9.61 2024-09-28 10:56:03.823 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry xy@g.c for easee

and after installing 0.9.59 I see a reference to the installation of pyeasee: 2024-09-27 21:02:46.987 DEBUG (MainThread) [custom_components.easee] Setting up Easee component version 0.9.59 2024-09-27 21:02:46.987 INFO (MainThread) [pyeasee.easee] Easee python library version: 0.8.1 2024-09-27 21:02:46.987 DEBUG (MainThread) [pyeasee.easee] getting token for user: xy@g.c

Can I enforce the installation of the later pyeasee?

olalid commented 1 month ago

The "attempting install of pyeasee" usually appears only the first time you restart HA after upgrading to a new version of the Easee integration, if the lib version is different between the versions of the integration. So if you install 0.9.61 again after having installed 0.9.59 you should see such a line in the log. If you do not that is very strange since that means HA does not even attempt to upgrade the lib.

olalid commented 1 month ago

And to answer the other question, it is supposed to already be enforced that the right version of the lib gets installed. The integrations manifest file points out the specific version of pyeasee it needs to run.

The error you are seeing is most likely because the lib is not the right version, since it says there is an extra argument, which was added in the more recent versions of pyeasee and HA component, so they have to match to work.

What kind of installation do you have, do you have access to the python environment where HA runs so you could manually install libs?

dschaedl commented 1 month ago

So, It seems I'm somehow stuck with the wrong version. I'm running HA in Supervised mode. So I should have access to everything. I'm just inexperienced to fiddle around with Python libraries...

astrandb commented 1 month ago

Try this from the linux prompt in the HA environment:

# pip uninstall pyeasee
# pip install  pyeasee==0.8.4

To show info on a library:

# pip show pyeasee
dschaedl commented 1 month ago

I don't get it... I opened a sh on the HA-docker container (docker exec -it sh ) checked for the pyeasee library and installed version 0.8.4:

pip show pyeasee Name: pyeasee Version: 0.8.4 Summary: Easee EV charger API library Home-page: https://github.com/nordicopen/pyeasee Author: Ola Lidholm Author-email: olal@plea.se License: MIT Location: /usr/local/lib/python3.12/site-packages Requires: aiohttp, pysignalr Required-by:

Then upgraded the easee integration to 0.9.61 after restart the pyeasee version is now still 0.8.4

but I still get the same error when starting the integration. And still noting in the log about the pyeasee version.

astrandb commented 1 month ago

I don't know where the runtime environment is stored in your instance. It is obviously not where the lib was stored by your pip command. Do a pip uninstall before continuing your troubleshooting.

dschaedl commented 1 month ago

A short update (sorry, I did not care about a version update in the last weeks): I removed pyeasse (in Version 0.8.1) with: rm -rf /config/deps/lib/python3.12/site-packages/pyeasee* then re-downloaded the latest easee integration (0.9.62) using HACS. restarted HA and all was good again :-)

(I got this approach from a similar issue with another integration)