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

Lifetime energy does not recover after Kiosk max retries. #155

Closed
AndersHoglund opened this issue Mar 5, 2024 · 10 comments
Closed

Lifetime energy does not recover after Kiosk max retries. #155

AndersHoglund opened this issue Mar 5, 2024 · 10 comments

Comments

@AndersHoglund
Copy link
Contributor

Hi,

New (?) kiosk behaviour from Huawei at midnight. Max retries occurs. All entities recover after a while, except total_lifetime_energy. Need to restart HA to get things going again. Log cut out:

2024-03-05 00:02:59.892 ERROR (MainThread) [custom_components.fusion_solar.sensor] Error requesting FusionSolarKiosk data: HTTPSConnectionPool(host='uni002eu5.fusionsolar.huawei.com', port=443): Max retries exceeded with url: /rest/pvms/web/kiosk/v1/station-kiosk-file?kk=Jrlxxxxxxxxxxxxxxxxxxax (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f64a64e60>: Failed to establish a new connection: [Errno -3] Try again'))

All this seems to have starte 1:st of March. Did not notice until yesterday that there was no lifetime_energy data, restarted HA and it all came alive again. Same issue today, restart HA to get it going. Sorry, no debug log was running at those times

Will try to have a fresh debug log running at midnight tonight.
/A
total_lifetime_energy_fail

@AndersHoglund
Copy link
Contributor Author

No problems last night. Nothing new in the logs. Typical, when you start logging, no problems. Will keep an eye on this.

But i did look back in history to the first time I noticed this happening, Jan 29. So now we have at least two records of this happening.
/A
Screenshot 2024-02-29 History – Home Assistant

@AndersHoglund
Copy link
Contributor Author

Happened again last night, twice. And of course, I had no debug logging running at that time.

2024-03-08 00:00:56.613 ERROR (MainThread) [custom_components.fusion_solar.sensor] Error requesting FusionSolarKiosk data: HTTPSConnectionPool(host='uni002eu5.fusionsolar.huawei.com', port=443): Max retries exceeded with url: /rest/pvms/web/kiosk/v1/station-kiosk-file?kk=JrlNJcLJ3daMl24aN4F45PIiLxw36xax (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f70818650>: Failed to establish a new connection: [Errno -3] Try again'))

2024-03-08 01:51:41.614 ERROR (MainThread) [custom_components.fusion_solar.sensor] Error requesting FusionSolarKiosk data: HTTPSConnectionPool(host='uni002eu5.fusionsolar.huawei.com', port=443): Max retries exceeded with url: /rest/pvms/web/kiosk/v1/station-kiosk-file?kk=JrlNJcLJ3daMl24aN4F45PIiLxw36xax (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f762b93a0>: Failed to establish a new connection: [Errno -3] Try again'))

All entities seem to recover, except Lifetime energy:

Screenshot 2024-03-08 at 09-10-26 Huawei VR – Home Assistant

Turned on debug this morning to see what the data from Huawei looks like:

2024-03-08 09:11:41.917 DEBUG (SyncWorker_47) [custom_components.fusion_solar.fusion_solar.kiosk.kiosk_api] {'realTimePower': 4.193, 'cumulativeEnergy': 25062.17, 'monthEnergy': 125.15, 'dailyEnergy': 4.54, 'yearEnergy': 426.98}
2024-03-08 09:11:41.923 DEBUG (MainThread) [custom_components.fusion_solar.sensor] Finished fetching FusionSolarKiosk data in 0.323 seconds (success: True)
2024-03-08 09:11:41.924 INFO (MainThread) [custom_components.fusion_solar.fusion_solar.energy_sensor] sensor.kronkarrs_huawei_vr_jrlxxxxxxxxxxxxxxxxxx36xax_total_lifetime_energy: not available, so no update to prevent issues.

Cumulative Energy data from Huawei seems OK, but this integration returns nothing (or "not available" or "Unknown").
Can it be the glitch filter locking up? Rebooting HA fixes this.
/A

@tijsverkoyen
Copy link
Owner

¯_(ツ)_/¯
I really am thinking about to just remove all code related to handling API errors and just passing data that is received from Huawei

@AndersHoglund
Copy link
Contributor Author

Yeah, I understand your frustration. Same here. Giving up trying to hide the Huawei crap data is one way.....But please, give it one more chance. Maybe my initial "fix" using a global would work better? I could give that a try.
Or just make fewer kiosk accesses. 10min interval when Huawei updates only every 30min is a bit of a waste, 15min polling might be enough. From 144 to 96 times a day. Not sure what the Kiosk limit is. Where do I change this time interval?
/A

@AndersHoglund
Copy link
Contributor Author

Thnx. I increased access rate to once every minute, to provoke failure. Added some debug logging in energy_sensor.py to see what kind of state data we deal with when it fails.

            if entity is not None:
                _LOGGER.debug(f'{self.entity_id} State: {entity.state}')
                try:
                    current_value = float(entity.state)
                except ValueError:
                    _LOGGER.info(f'{self.entity_id}: not available, so no update to prevent issues.')
                    return

Nothing in the log as yet.
/A

@AndersHoglund
Copy link
Contributor Author

Been logging all day yesterday and all night at 60s rate and no problems seen. Will revert to 10min rate and keep logging.
/A

@tijsverkoyen
Copy link
Owner

Any update? Or can this issue be closed?

@AndersHoglund
Copy link
Contributor Author

No incident has occurred since last report, even when trying to provoke.
But this code can still lock up and require restart in some situations, so it is still a lurking problem.

Close if you wish, I can re-open if and when it happens again. Actually, closing the issue may jinx it and provoke a failure ;-)
/A

@AndersHoglund
Copy link
Contributor Author

Again last night:

2024-04-08 22:50:51.441 ERROR (MainThread) [homeassistant.components.hassio.data] Error fetching hassio data: Error on Supervisor API: System is not ready with state: setup 2024-04-08 22:51:07.164 ERROR (MainThread) [metno] Access to https://aa015h6buqvih86i1.api.met.no/weatherapi/locationforecast/2.0/complete returned error 'ClientConnectorError' 2024-04-08 22:51:07.165 ERROR (MainThread) [homeassistant.components.met.coordinator] Error fetching met data: Update failed: 2024-04-08 22:51:07.227 ERROR (MainThread) [custom_components.fusion_solar.sensor] Error requesting FusionSolarKiosk data: HTTPSConnectionPool(host='uni002eu5.fusionsolar.huawei.com', port=443): Max retries exceeded with url: /rest/pvms/web/kiosk/v1/station-kiosk-file?kk=JrlNJcLJ3daMl24aN4F45PIiLxw36xax (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f5e600b90>: Failed to establish a new connection: [Errno -3] Try again'))

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

2 participants