zxdavb / evohome-async

An asyncio Python client to access the Evohome web service
http://evohome-client.readthedocs.org/en/latest/
Apache License 2.0
11 stars 11 forks source link

Adding a second evohome location creates error during setup #15

Open jwmaas opened 9 months ago

jwmaas commented 9 months ago

I have added a second evohome location exactly following the steps in the wiki. I have two separate accounts on the Total Connect website. I am running Home Assistant 2023.12.3

I get the following error:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 332, in _async_setup_component result = await task ^^^^^^^^^^ File "/config/custom_components/customevohome3/init.py", line 265, in async_setup await broker.save_auth_tokens() File "/config/custom_components/customevohome3/init.py", line 445, in save_auth_tokens user_id = self.client_v1.user_data["userInfo"]["userID"] # type: ignore[index]


KeyError: 'userInfo'

In this case the error is in setting up the custom component (the evohome component loads as it should). But sometimes I get the same error in setting up the evohome component itself (but then the custom component loads successfully). I have been running the main and custom approach for a few years without any issues. The problem first appeared in HA 2023.12.1 (not 100% sure).
jwmaas commented 9 months ago

I solved this issue by painstakingly following the wiki for multiple evohome locations. Then I decided to change the execution rights of the custom component files as follows, as suggested by @sesame26 : image

I also changed the call frequency to 600 seconds. One of these solutions did the trick.

Ingo-Klein commented 9 months ago

same problem:

Logger: homeassistant.setup Source: setup.py:332 First occurred: 18. Dezember 2023 um 00:44:54 (1 occurrences) Last logged: 18. Dezember 2023 um 00:44:54

Error during setup of component evohome_1 Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 332, in _async_setup_component result = await task ^^^^^^^^^^ File "/config/custom_components/evohome_1/init.py", line 265, in async_setup await broker.save_auth_tokens() File "/config/custom_components/evohome_1/init.py", line 445, in save_auth_tokens user_id = self.client_v1.user_data["userInfo"]["userID"] # type: ignore[index]


KeyError: 'userInfo'

I have the same problem..

I have already re-downloaded several times.. set chmod rights to 777... set the frequency to 600 seconds.. all without success
Ingo-Klein commented 9 months ago

What I also noticed:

location_idx integer (Optional, default: 0)

Only 0 is accepted now... that wasn't the case before either... that's not a problem for me because I have separate accounts. but I noticed this when testing

jwmaas commented 9 months ago

Other things I always do:

Ingo-Klein commented 9 months ago

the solution was:

delete all references to evohome in the .storage directory

(then it works again with the old chmod rights)

Excellent ! Thanks alot

smarthomefamilyverrips commented 9 months ago

I solved this issue by painstakingly following the wiki for multiple evohome locations. Then I decided to change the execution rights of the custom component files as follows, as suggested by @sesame26 : image

I also changed the call frequency to 600 seconds. One of these solutions did the trick.

@jwmaas nice to see my suggestion did help you, I also had same problem but just downloading the raw files from HA core files on github and replace the files in custom folder with these (after first manual adjusting the const.py and manifest.json with correct values) did do the trick for me.

Out of curiosity with call frequency you mean setting the scan_interval?

jwmaas commented 9 months ago

That was my usual approach that did not work this time for some reason.