tijsverkoyen / HomeAssistant-FusionSolar

Integrate FusionSolar into your Home Assistant.
MIT License
149 stars 27 forks source link

CERTIFICATE_VERIFY_FAILED when using kiosk mode #103

Closed julchevalier closed 1 year ago

julchevalier commented 1 year ago

Hello!

As the installer only gave me a end-user account I'm trying to setup this integration with the Kiosk mode but it triggers an SSL error when doing so.

I can access the kiosk url without any issue, production data are populated and there's no certificate warning in my browser while viewing the page so I don't know what to do :(

If needed I can give you my Kiosk id in private but I wanted to avoid to give it publicly.

Any help would be appreciated.

==================== Full log ====================

2023-08-02 10:28:16.810 ERROR (MainThread) [custom_components.fusion_solar.sensor] Error requesting FusionSolarKiosk data: HTTPSConnectionPool(host='region05eu5.fusionsolar.huawei.com', port=443): Max retries exceeded with url: /rest/pvms/web/kiosk/v1/station-kiosk-file?kk=xxxxxxxxxxxxxxxxxxxx (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))) 2023-08-02 10:41:55.499 DEBUG (MainThread) [custom_components.fusion_solar.config_flow] async_step_choose_type: None 2023-08-02 10:41:57.677 DEBUG (MainThread) [custom_components.fusion_solar.config_flow] async_step_choose_type: {'type': 'kiosk'} 2023-08-02 10:41:57.677 DEBUG (MainThread) [custom_components.fusion_solar.config_flow] async_step_kiosk: None 2023-08-02 10:42:12.541 DEBUG (MainThread) [custom_components.fusion_solar.config_flow] async_step_kiosk: {'name': 'HuaweiSolar', 'url': 'https://region05eu5.fusionsolar.huawei.com/pvmswebsite/nologin/assets/build/cloud.html#/kiosk?kk=xxxxxxxxxxxxxxxxxxxx'} 2023-08-02 10:42:12.549 DEBUG (MainThread) [custom_components.fusion_solar.fusion_solar.kiosk.kiosk] calculated KioskId: xxxxxxxxxxxxxxxxxxxx 2023-08-02 10:42:12.549 DEBUG (MainThread) [custom_components.fusion_solar.sensor] Adding entities for kiosk xxxxxxxxxxxxxxxxxxxx 2023-08-02 10:42:12.549 DEBUG (MainThread) [custom_components.fusion_solar.fusion_solar.kiosk.kiosk] calculated API base url for xxxxxxxxxxxxxxxxxxxx: https://region05eu5.fusionsolar.huawei.com/ 2023-08-02 10:42:12.549 DEBUG (MainThread) [custom_components.fusion_solar.sensor] fusion_solar 2023-08-02 10:42:12.549 DEBUG (MainThread) [custom_components.fusion_solar.sensor] xxxxxxxxxxxxxxxxxxxx 2023-08-02 10:42:12.668 ERROR (MainThread) [custom_components.fusion_solar.sensor] Error requesting FusionSolarKiosk data: HTTPSConnectionPool(host='region05eu5.fusionsolar.huawei.com', port=443): Max retries exceeded with url: /rest/pvms/web/kiosk/v1/station-kiosk-file?kk=xxxxxxxxxxxxxxxxxxxx (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))) 2023-08-02 10:42:12.672 DEBUG (MainThread) [custom_components.fusion_solar.sensor] Finished fetching FusionSolarKiosk data in 0.123 seconds (success: False) 2023-08-02 10:42:12.673 DEBUG (MainThread) [custom_components.fusion_solar.fusion_solar.kiosk.kiosk] calculated KioskId: xxxxxxxxxxxxxxxxxxxx 2023-08-02 10:42:12.674 DEBUG (MainThread) [custom_components.fusion_solar.sensor] Adding entities for kiosk xxxxxxxxxxxxxxxxxxxx 2023-08-02 10:42:12.674 DEBUG (MainThread) [custom_components.fusion_solar.fusion_solar.kiosk.kiosk] calculated API base url for xxxxxxxxxxxxxxxxxxxx: https://region05eu5.fusionsolar.huawei.com/ 2023-08-02 10:42:12.674 DEBUG (MainThread) [custom_components.fusion_solar.sensor] fusion_solar 2023-08-02 10:42:12.674 DEBUG (MainThread) [custom_components.fusion_solar.sensor] xxxxxxxxxxxxxxxxxxxx 2023-08-02 10:42:12.803 ERROR (MainThread) [custom_components.fusion_solar.sensor] Error requesting FusionSolarKiosk data: HTTPSConnectionPool(host='region05eu5.fusionsolar.huawei.com', port=443): Max retries exceeded with url: /rest/pvms/web/kiosk/v1/station-kiosk-file?kk=xxxxxxxxxxxxxxxxxxxx (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))) 2023-08-02 10:42:12.806 DEBUG (MainThread) [custom_components.fusion_solar.sensor] Finished fetching FusionSolarKiosk data in 0.132 seconds (success: False)

tijsverkoyen commented 1 year ago

The error states that the SSL certificate for region05eu5.fusionsolar.huawei.com is not valid.

Validating the certificate is not part of this integration. I have checked it and the certificate for region05eu5.fusionsolar.huawei.com is valid, see: https://www.ssllabs.com/ssltest/analyze.html?d=region05eu5.fusionsolar.huawei.com

So my first guess is that you are running Home Assistant on an outdated computer. Or there is something in your network that is causing this error.

tijsverkoyen commented 1 year ago

Thx to the efforts of @Joepiler11 and @bugoff in https://github.com/tijsverkoyen/HomeAssistant-FusionSolar/issues/104 it was found that the issue is with Huawei.

The certificate for region05eu5.fusionsolar.huawei.com is incomplete. It lacks the intermediate certificate. As can be seen on: https://www.ssllabs.com/ssltest/analyze.html?d=region05eu5.fusionsolar.huawei.com&hideResults=on

Additional Certificates (if supplied) Certificates provided | 1 (1756 bytes) Chain issues | Incomplete

I have reported this to eu_inverter_support@huawei.com. Feel free to do the same.

tijsverkoyen commented 1 year ago

It seems like the issue is resolved