osohotwateriot / osoenergy_community

This is an OSO Energy integration for the Home Assistant Community Store
MIT License
3 stars 0 forks source link

Add integration failed with "Invalid autentication" #1

Closed Olgmo closed 11 months ago

Olgmo commented 11 months ago

After adding the repository and restart and trying to add integration in HA the installation stops with errors. When adding the API key (32 chars) I get an "Invalid autentication" error on screen. I know the key is okay as I can use this in the swagger test api okay.

When looking in the HA log I see this error: 2023-11-12 09:58:31.755 ERROR (MainThread) [custom_components.osoenergy_community.config_flow] Unknown error occurred Traceback (most recent call last): File "/config/custom_components/osoenergy_community/config_flow.py", line 68, in get_user_email return await client.get_user_email() ^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'OSOEnergy' object has no attribute 'get_user_email'

I've tried manually copy and paste the files as well without any difference. I'm on HA 11.2 and running in Docker on a Linux computer.

osohotwateriot commented 11 months ago

Hello,

I have tried reproducing the issue but am unable to do so. I ran HA as a docker container (new installation) and I successfully installed HACS and then the OSO Energy HACS integration without any issues. I've tested the same on an installation running HA OS

The get_user_email method is available in the package requirements of pyosoenergyapi from the latest version 1.0.5 It appears as if you have an older version of the package but I cannot be sure about that.

You can check the version of the package by going to '/usr/local/lib/python3.11/site-packages' - python version may be different for you. I have the latest version: image Normally HA should install the version specified in the manifest.json file of the custom component. You can check if the manifest file is configured to the correct version "requirements": ["pyosoenergyapi==1.0.5"],

If you see a difference in the version you can try to remove all installations of the integration - restart HA - add the integration again - restart.

Olgmo commented 11 months ago

That is the same as here.

Docker:/usr/local/lib/python3.11/site-packages#

drwxr-xr-x 5 root root 4096 Nov 12 09:58 pyosoenergyapi drwxr-xr-x 2 root root 4096 Nov 12 09:58 pyosoenergyapi-1.0.5.dist-info

Also did a new remove from HACS and Restart. Install again from HACS and restart. Add integration and have same error as before.

osohotwateriot commented 11 months ago

Can you provide me with a zip of the package. You can also verify if the get_user_email method exists by going to the pyosoenergyapi and executing 'cat session.py' This behaviour is very strange. I run another test on linux docker but still cannot reproduce the issue. Is it possible that you have multiple versions installed for this package.

You can also try to install the package manually with 'pip install pyosoenergyapi==1.0.5' but the package files are updated on reboot. It should override the current package files but I cannot guarantee what the efects are going to be.

Olgmo commented 11 months ago

Ahhhh, my mistake :-( I had to remove the old unofficial installation before adding the new HACS. All seems to be good now.