vincentwolsink / home_assistant_enphase_envoy_installer

This is a HACS custom integration for Enphase Envoys with firmware version 7 and up.
Apache License 2.0
54 stars 10 forks source link

Lot's of status changes (not available) #13

Closed posixx closed 1 year ago

posixx commented 1 year ago

I see a lot of disconnects using this integration for the last week now. Every device (gateway. relay and inverters) often disconnects resulting in not available for some time. This happens about every hour.

afbeelding

vincentwolsink commented 1 year ago

Hi @posixx, do you have any other script/integration/job running that uses the installer account to connect to your Envoy? The Envoy only allows one installer session at a time.

posixx commented 1 year ago

No nothing that i'm aware of. On PC and Phone i use owner account when using enlighten.

vincentwolsink commented 1 year ago

Does this happen only for the binary sensors (producing/communicating) or also for the other sensors? And how many solar panels do you have installed?

posixx commented 1 year ago

It happens on all devices so it seems like a general disconnect. I have 36 panels

vincentwolsink commented 1 year ago

Does it happen around a fixed time? Can you maybe enable debug logging for the integration a bit before that time and send the log to me, so I can check the response from the Envoy?

posixx commented 1 year ago

Around every hour, but not fixed. Enabled debug logging, will send an update when it happens again.

posixx commented 1 year ago

It happened again after 67 minutes after restart. Upon restart and after 67 minutes what i see in hte eventlog:

2023-05-16 14:54:12.110 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Checking Token value: 2023-05-16 14:54:12.110 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Found empty token: 2023-05-16 14:54:15.562 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Commissioned Token valid for 364.99999349197304 days

So it looks like it is getting a new token every hour? It sure has to do with these lines..

vincentwolsink commented 1 year ago

Interesting, because it claims the token validity is a year there. Owner tokens are valid for a year, installer tokens only for 12 hours. Your installer account, is it a true installer account or a DHZ one?

Can you also maybe give a bit more context around this? The HTTP request just before the token refresh for example.

posixx commented 1 year ago

I have a installer account no DHZ.

vincentwolsink commented 1 year ago

@posixx The url returns a page not found.

posixx commented 1 year ago

Well then someone else has downloaded it. Sorry i don't have any mailadres or someting to reach you

posixx commented 1 year ago

Hi @posixx, do you have any other script/integration/job running that uses the installer account to connect to your Envoy? The Envoy only allows one installer session at a time.

I have created an installer account and connected it to my system. The original installer (the company who installed panels and configured everything) also still has connection to my system. Could that be the issue? Cannot imagine this would cause the problem as this installer doesn’t have access to internal ip etc..

vincentwolsink commented 1 year ago

The limitation is on the local connection. The installer company uses the Enphase cloud so that is not an issue.

Can you please send the debug log to this (temporary) email: ziener06joduur@icloud.com

posixx commented 1 year ago

Done!

vincentwolsink commented 1 year ago

Thanks. In the logfile I see it is reusing the token like it should, but suddenly at 16:01 it either starts another update parallel to the regular one, or it crashed halfway during the run and lost the token (although I don't see any exceptions or errors).

Which version of Home Assistant are you running?

posixx commented 1 year ago

Thanks. In the logfile I see it is reusing the token like it should, but suddenly at 16:01 it either starts another update parallel to the regular one, or it crashed halfway during the run and lost the token (although I don't see any exceptions or errors).

Which version of Home Assistant are you running?

Latest, 2023.5.3

Also, every day at exactly 23:00 and/or 0:00 i get a timeout on the envoy:

2023-05-16 23:00:42.448 ERROR (MainThread) [custom_components.enphase_envoy] Timeout fetching envoy Envoy xxxxxxxxxxxxxx data 2023-05-17 23:01:36.229 ERROR (MainThread) [custom_components.enphase_envoy] Timeout fetching envoy Envoy xxxxxxxxxxxxxx data 2023-05-18 23:01:46.359 ERROR (MainThread) [custom_components.enphase_envoy] Timeout fetching envoy Envoy xxxxxxxxxxxxxx data 2023-05-19 00:01:19.357 ERROR (MainThread) [custom_components.enphase_envoy] Timeout fetching envoy Envoy xxxxxxxxxxxxxx data 2023-05-20 23:01:47.160 ERROR (MainThread) [custom_components.enphase_envoy] Timeout fetching envoy Envoy xxxxxxxxxxxxxx data 2023-05-21 00:01:25.252 ERROR (MainThread) [custom_components.enphase_envoy] Timeout fetching envoy Envoy xxxxxxxxxxxxxx data 2023-05-22 00:00:49.062 ERROR (MainThread) [custom_components.enphase_envoy] Timeout fetching envoy Envoy xxxxxxxxxxxxxx data

vincentwolsink commented 1 year ago

The timeout on the Envoy must be something outside the integration, so either on the Envoy itself, the network etc. I cannot reproduce the issue with the token currently. It is very suspicious that the token issue happens every hour. Actually the code around tokens did not change between this and your integration at all. What if you run your own versions of the integration with your installer account, does it also have the issue? And what about if you run it with your owner account?

posixx commented 1 year ago

I never used my own fork with the D7 firmware; i switched over to yours. Also i didn't touch the token code nor did i look at it to understand it; i only expanded the repo from brian to include the 3-phase sensors. I will do some test if i find the time for it.

posixx commented 1 year ago

I switched to my fork with installer login and will update tomorrow.

posixx commented 1 year ago

Vincent,

Not a single disconnect using my fork for mort than a day:

afbeelding

The timeout messages are still there in the HA log at 23u or 00u.

vincentwolsink commented 1 year ago

Then the issue is not in the token code, since that didn’t change between forks. Maybe something with the high number of sensors. But currently I have no way of debugging this since I cannot reproduce the issue.

posixx commented 1 year ago

OK, then i will continue to use my fork for now..

vincentwolsink commented 1 year ago

@posixx You could also help me and maybe others by doing some debugging for me, since you are also somewhat familiar with the code.