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

Integration stopped working yesterday. Cannot configure after re-installing Enphase Envoy (DEV) #141

Closed
fludo opened this issue Aug 20, 2023 · 16 comments

Comments

@fludo
Copy link

fludo commented Aug 20, 2023

HA 2023.8.3
Version: 0.0.14

Yesterday, after 5pm, no more data available from the different sensor provided by the integration (I think I had version 0.0.13).
Now, I'm trying to configure it again after removing the integration but still got the same error.

Here is the error message (user/pass from enlighten website + checkbox use enlighten before the error).
image

Note: from what I see in envoy_reader.py, value for ENLIGHTEN_TOKEN_URL is https://entrez.enphaseenergy.com/tokens which no longer seems accessible. Can this be the cause ?

Any way to enable debug to have a more precise error from the installation error ?

@catsmanac
Copy link
Collaborator

Just tried with 0.0.14. Deleted my envoy, restarted HA and added the envoy again. It was able to connect to Enphase and obtain a token and communicatie with the envoy. So the tokens page is (now again) working.

In your picture I see 'Utiliser Enlighten' is not checked. Make sure it is checked before using 'Valider'. Might be it was on earlier trial but it should be checked.

@fludo
Copy link
Author

fludo commented Aug 20, 2023

Sure, here is the screen before validation and waiting the extension to generate the token:
image
After the connection failed, I got the screen on my original message with default credentials.

@catsmanac
Copy link
Collaborator

Ok, I just did another delete an re-add and the enphase website is working. The error means that one or more of the items entered are not correct. There's little debug information available. That can be added, but best validate the input first.

@fludo
Copy link
Author

fludo commented Aug 21, 2023

I gave it another try today after restarting the envoy gateway yesterday (which did not fix the issue). Finally it managed to setup the gateway but now, no entity can be found.

image

@catsmanac
Copy link
Collaborator

catsmanac commented Aug 21, 2023

Something is not working correct, it's trying to initialize but fails and retries. Lets see if you can enable debug manually as the button does not show yet.

Can you open the home assistant config folder.
In the config folder you can find the file home-assistant.log. That is the log file showing what is going on. In there may some error showing if something is failing.

If not enable debug for the envoy and that will provide more details on what is going on.
In the config folder edit the file configuration.yaml
At the end of the file add these lines:

logger:
  default: warning
  logs:
    custom_components.enphase_envoy: debug

Exactly with the spaces as they are, so line 1 no spaces, lines 2 and 3 2 spaces and line 4 4 spaces.
Save and close the file
Restart home assistant.
let it run for a couple of minutes
The log file should now show debug information on what it is all doing.

@fludo
Copy link
Author

fludo commented Aug 21, 2023

Thanks, here are the debug info, seems like the gateway is slow to respond.
image

@fludo
Copy link
Author

fludo commented Aug 21, 2023

The gateway (Europe, Metered) version is : D7.6.175 (f79c8d)

@catsmanac
Copy link
Collaborator

Yes, it should be able to respond within 30 seconds and it doesn't. To see if it will startup try to give it more time.

In the config folder open de folder custom_components and there the folder enphase_envoy.

Edit the file __init__.py.

Look for the line

        async with async_timeout.timeout(30):

Change 30 to 50 or 60 and save and close the file. Then restart Home Assistant and see what happens.

@cmseasy
Copy link

cmseasy commented Aug 21, 2023

I had the same problem, my gateway is very slow to respond. I also solved it by modifying the line in init.py. I have set the timeout to 300s.
async with async_timeout.timeout(300):

Maybe not necessary but I also changed all four timeout settings in envoy_reader.py from 30 to 300s. (line 247. 284, 300 and 312).

Maybe way too much but the result is that I get data again.
Can this high values do any harm? I don't notice any downside.

@catsmanac
Copy link
Collaborator

For another issue I made these actually configurable. There's no harm in changing these, but there's relations between them.

The async_timeout.timeout tells when the overall data collection will time out irregardless if 1 or more envoy pages are collected already. So data collection will never take longer then this and result in timeout error if this is exceeded. If the other timeouts are set to 300 as well and one hits, the async_timeout.timeout will fire and end the whole collection right away, preventing an effective retry. So if you want to enable retry make sure that the other times are shorter then the async_timeout.timeout.

@cmseasy
Copy link

cmseasy commented Aug 21, 2023

Thanks for the advice, I reduced the envoy_reader.py timing to 180.

Is it correct that all these timings are for background processes? It doesn't hinder the frontend user?
If so, can the hardcoded default values be increased in the script? Or maybe better, as you mentioned for another issue, made configurable?

@fludo
Copy link
Author

fludo commented Aug 21, 2023

Ok, I tried with a timeout of 60 and 180... still got an error. I opened a ticket for enphase for the slow gateway.
Changing it to to 300s allowed the configuration to proceed.

But now, Envoy 1*****5 Current Power Production is always 0. Was working with previous version.
I will have a look at other issues

@fludo
Copy link
Author

fludo commented Aug 21, 2023

I guess this is related to #134
Closing this issue since increasing timeout for setup fixed the problem

@fludo fludo closed this as completed Aug 21, 2023
@catsmanac
Copy link
Collaborator

Thanks for the advice, I reduced the envoy_reader.py timing to 180.

Is it correct that all these timings are for background processes? It doesn't hinder the frontend user? If so, can the hardcoded default values be increased in the script? Or maybe better, as you mentioned for another issue, made configurable?

This is all for the background processing. Only time a user screen is directly involved is during initial configuration where it may take longer. But I guess better take long and successful then shorter and not able to add. I'll probably add options to tune timing in a next release.

@cmseasy
Copy link

cmseasy commented Aug 21, 2023

But I guess better take long and successful then shorter and not able to add.

I agree.

I'll probably add options to tune timing in a next release.

Thank you.

@catsmanac
Copy link
Collaborator

V0.0.15 is published that has option in the configure menu to change timing. You can increase the 'Timeout for getting single Envoy data page' setting. Default is 30 sec. If needed also increase the 'Overall timeout on getting all Envoy data' which is 55 sec default.

When you update your changes to the code will be overwritten, so you can use the configure menu to change it again.

To find what time is needed, increase the both numbers, enable debug on the envoy and reload it or restart HA. Let it run for couple of minutes and disable debug again. In the log file is downloaded look for line like:

Finished fetching envoy Envoy 122302045041 data in 9.433 seconds (success: True)

This time as an indication for the overall timeout.

For the individual page timeouts look for time used on the home page as taht is typically the slowest one:

HTTP GET Attempt #1 of 2: https://192.168.3.112/home.json: use token: True: Header: <Token hidden>  Timeout: 30 Holdoff: 0
Fetched (1 of 2) in 3.0 sec from https://192.168.3.112/home.json: <Response [200 OK]>: {"software_build_epoch":1687430621,"timezone":"

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

3 participants