-
Notifications
You must be signed in to change notification settings - Fork 76
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
Sensor entities stop receiving data #86
Comments
More error logs if this helps: Logger: homeassistant.config_entries Error setting up entry Envoy 122243060763 for enphase_envoy During handling of the above exception, another exception occurred: Traceback (most recent call last): |
Recycling it bring the data back but doing this repeatedly is a pain. Code needs updating such that this error does not crash the program, instead it waits and rescans for data. |
Agree, but though it seems to crash the program you'll probably find in the log that 1 minute later it tries again and dumps the same log. The crash only terminates the current scan cycle but I expect you see the next scan will start but just hits the same problem. Can you confirm this? I learned that with some other of these crash dumps. The real issue is understanding why the Envoy terminates the data flow until it restarts. I've had the envoy disconnect with status 503, service unavailable, when I was testing with a second home assistance instance in parallel to the same envoy. But that recovered after 5 minutes. |
You can enable debug on the integration, that will add some debug output to the logfile and show more details on what it is doing. |
If I leave the integration without restarting, it may fetch data after a period of minutes or hours. It is completely random. When checking the enphase app or logging into it over IP the envoy is connected and appears fine. |
Yes that is consistent with remarks in the other issues mentioned. Just to understand it correctly, "If I leave the integration without restarting" is restarting the HA Envoy integration, HA completely or the Envoy? |
Normally I restart the integration, but restarting HA or conducting a HA reboot makes no noticeable difference. The only thing I haven’t done is restart the enphase envoy unit. |
Any idea if this is happening at the same point each time? The integration performs multiple gets to obtain data from the envoy. Is it always the same get that triggers this? (To find this you probably need to enable debug until it happens. Might generate a lengthy logfile.) What envoy are you using and do you have meters and/or batteries included and how is it connected to the network? I see the code has not much error catching and logic to work on cookies when something fails. So changing it to detect and handle this situation will at least require quite some testing. Probably doable, but will take time. Potential temporary work-around to automatically restart the integration when this happens (no root-cause fix at all) is to create a trigger detecting an unavailable status of one of the envoy items and then call the service homeassistant.reload_config_entry to reload the envoy integration. Would need to have a bit of smarts to not execute at HA start or during reload of the integration as status will be unavailable then too. Other work-around may be to use the rest integration as described in 32. Will require quite some configuration work and testing. Or some other fork of this. Though many of these have the same core logic. |
My observations today so far is that this problem only happens when the envoy cannot connect with the cloud server. It can connect to the local network and internet but for some reason there is no connection with the enphase server. When this happens the envoy does not transmit complete data to HA. If you restart in integration, the data appears momentarily before it then displays data unavailable. Once the link with the server is restored, the envoy will then share the data with HA.
My observations today so far is that this problem only happens when the envoy cannot connect with the cloud server. It can connect to the local network and internet but for some reason there is no connection with the enphase server. When this happens the envoy does not transmit complete data to HA. If you restart in integration, the data appears momentarily before it then displays data unavailable. Once the link with the server is restored, the envoy will then share the data with HA. |
Given my observations today, I believe this is linked to the following: Thoughts? |
This integration by @briancmpbll and others is actually the solution to those 2 items. The Envoy firmware versions starting with D7.0 and newer have added a security mechanism that requires the use of a token to authenticate with the envoy. When configuring the envoy you had to specify your enphase enlighten website username and password and check the 'use enlighten' option to activate that mechanism. That tells the integration to connect to the enphase website en obtain a token to use for it's connections to the envoy. If not you may have an older firmware. You can find your envoy firmware in the enphase website. To see in the logfile if it is getting a token before connecting you can enable debug on the integration (go to the integrations screens, click the 3 dot menu in the lower right corner of the envoy and select enable debug). Then reload the envoy integration again to get startup debug as while. After couple of minutes disable debug again. That will download the log file to your computer and you are in for some detailed reading of what it all did. You should be able to find logs of it obtaining a token and making first contact with the envoy. IF that all works the issues you mentioned are no longer related. |
I am having the same problem where it goes unavailable. Super weird, some are 5 minutes long, one was a whole hour. I am happy to help debug or provide logs, though I'm pretty new to HA (Hubitat user mostly). |
Extract from debugging log: 2023-06-06 20:28:19.227 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] TransportError: peer closed connection without sending complete message body (incomplete chunked read) |
This only happens when the envoy can’t connect to enlighten. Diagnostics in envoy show no connectivity issues yet problem with connection to enlighten with envoy persist. |
@rdunbar17507, your logs shows attempts 2 and 3 to read home.json page in the envoy
This comes from the code section where it first reads /production.json then /ivp/ensemble/inventory, and lastly home.json. Can you find the same HTTP Get attempts for /production.json and /ivp/ensemble/inventory or is it just having the issue with home.json? Home.json is (only) used to get grid status but is also reporting all kind of status of the envoy itself. If issues only happens on home.json, a far shot try could be to disable the call to get home.json in the code and see if that is a workaround. You would loose grid status reported by the Envoy during that testing. As said it's a far shot to see if home.json is the actual culprit or not. Edit envoy_reader.py in /config/custom_components/enphase_envoy and look for ENDPOINT_URL_HOME_JSON and comment the 3 code lines in _update_from_pc_endpoint as shown below.
|
If I log into the device's web UI, the browser dev tools show that even their own request to home.json is failing! If I copy the request as a curl command and add
If I make curl send an HTTP/1.0 request instead of HTTP/1.1, by adding
|
My experience is that the connection between the Envoy and their website regularly experiences delays. It's meant to call home every 15 minutes, but I find an hour delay is not unusual. The frustrating thing is that we can still see the data on the Envoy webpage - but apparently cannot harvest it locally. Update: My Envoy was off-line from Enlighten for more than 3 hours today, so the HACS integration was dropping out after about a minute. Reloading the integration would make it reconnect for another minute. My Envoy reconnected with Enlighten half an hour ago and the integration came back up. |
I have now gone nearly 40 hours without a drop-out, so maybe Enphase has improved the connection between the Envoy and Enlighten????? I'm still inclined to ask for a firmware downgrade. |
It's been a while on this one. Is this still an issue? We learned that some or many Envoy have a communication hickup at 23:00 and last releases allows for tuning time-outs. |
Once working this integrations seems to lose connection and needs restarting. Deletion and reinstallation does not help, nor rebooting. Error log below:
Error communicating with API: peer closed connection without sending complete message body (incomplete chunked read)
The text was updated successfully, but these errors were encountered: