tijsverkoyen / HomeAssistant-FusionSolar

Integrate FusionSolar into your Home Assistant.
MIT License
133 stars 25 forks source link

Data from API #128

Closed Saulus92 closed 5 months ago

Saulus92 commented 6 months ago

Everything worked fine for the last year but now the data from API comes in every 10 minutes as usual, gets displayed as usual until after ~2minutes when there was no update of the entity it becomes not available. The problem with this is that the energy dashboard cant use the solar energy data and no rest-energy-usage. Maybe this is a change in Home assistant in general but i would apreciate your help. Thanks Update: today, one day later the entitys dont update anymore. The first value received stays there

tijsverkoyen commented 5 months ago

Are you using Kiosk mode? Or OpenAPI have you checked: https://github.com/tijsverkoyen/HomeAssistant-FusionSolar#disabling-devices--plants--stations

RobertDeserranno commented 5 months ago

Since this night (after an internet problem?) all fusionSolar entities are also "unavailable" for me. Yesterday I also received an update from Home Assistant

tijsverkoyen commented 5 months ago

Are you using Kiosk mode? Or OpenAPI? Have you checked: https://github.com/tijsverkoyen/HomeAssistant-FusionSolar#disabling-devices--plants--stations

RobertDeserranno commented 5 months ago

I am using OpenAPI

RobertDeserranno commented 5 months ago

all 4 devices are enabled

tijsverkoyen commented 5 months ago

Anything in the logs? Please enable debug level first.

RobertDeserranno commented 5 months ago

home-assistant_fusion_solar_2024-01-08T10-34-41.587Z.log This is my log file for fusionsolar. I think around 00:30 I had internet connection problems

Saulus92 commented 5 months ago

OpenAPI for me too, my guess is there was a change from fusion solar part because there were different symptoms every day.

tijsverkoyen commented 5 months ago

home-assistant_fusion_solar_2024-01-08T10-34-41.587Z.log This is my log file for fusionsolar. I think around 00:30 I had internet connection problems

Yeah that are over 5000 lines of log. Where most of them are not related to this integration. If I just search for "fusion_solar" then there are a lot less entries:

2024-01-08` 01:54:50.814 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration fusion_solar > which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you > experience issues with Home Assistant

This is an expected entry, and can be safely ignored.

2024-01-08 02:01:22.636 WARNING (MainThread) [homeassistant.const] IRRADIATION_WATTS_PER_SQUARE_METER was used from fusion_solar, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfIrradiance.WATTS_PER_SQUARE_METER instead, please create a bug report at https://github.com/tijsverkoyen/HomeAssistant-FusionSolar/issues

This will be fixed in the next release. See https://github.com/tijsverkoyen/HomeAssistant-FusionSolar/commit/ea2b245018686dca68553983e4333db6c6ac4f9d

2024-01-08 02:01:32.659 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up fusion_solar platform for sensor
Traceback (most recent call last):
...  

Traceback (most recent call last):
  File "/config/custom_components/fusion_solar/fusion_solar/openapi/openapi_api.py", line 40, in login
    response = post(url, headers=headers, json=json)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 115, in post
    return request("post", url, data=data, json=json, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='eu5.fusionsolar.huawei.com', port=443): Max retries > exceeded with url: /thirdData/login (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at > 0xffff6f486550>: Failed to establish a new connection: [Errno -3] Try again'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 360, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/fusion_solar/sensor.py", line 793, in async_setup_entry
    stations = await hass.async_add_executor_job(api.get_station_list)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/fusion_solar/fusion_solar/openapi/openapi_api.py", line 55, in get_station_list
    response = self._do_call(url, json)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/fusion_solar/fusion_solar/openapi/openapi_api.py", line 163, in _do_call
    self.login()
  File "/config/custom_components/fusion_solar/fusion_solar/openapi/openapi_api.py", line 49, in login
    raise FusionSolarOpenApiError(f'Could not login with given credentials')
custom_components.fusion_solar.fusion_solar.openapi.openapi_api.FusionSolarOpenApiError: Could not login with given credentials

This is the culprit: Could not login with given credentials Please check if your credentials are correct. See https://github.com/tijsverkoyen/HomeAssistant-FusionSolar#how-can-i-verify-my-northbound-api--openapi-credentials

Make sure your Home Assistant has connection to the internet and can access eu5.fusionsolar.huawei.com

Saulus92 commented 5 months ago

Here is some data i received grafik seems that the problems started at 01.03.24 and since there was no update in any kind from the part of HomeAssistant my guess would be there are some problems coming from northbound management. I re-checked the API settings on fusion-solar webpage Maybe worth mantioning that all devices have the same problem even though the battery f.e. seems to receive data more reliably grafik

as mentioned before i receive the data but after ca. 2minutes without refresh the entity becomes unavailable grafik in the last picture you can see the difference in the entity after i re-checked the northbound settings

my log: home-assistant_2024-01-08T18-27-38.923Z.log

Thanks for all your time and effort!

RobertDeserranno commented 5 months ago

My problem is solved by reboot ? after uptdate. Thanks

tijsverkoyen commented 5 months ago

@Saulus92 just to be sure: you are on the latest version of Home Assistant, and this integration? I suspect you have a lot of devices?

Saulus92 commented 5 months ago

My HA core version is 2024.1.2, supervisor 2023.12.0 But i recently updated my core version from 2023.12.? to 2024.1.2 because of this error so im excluding that part of HomeAssistant from beeing the cause of it. Today i updated my fusionsolar costum integration from 2.5 to 3.0.1 so that might help. I guess were gonna see tomorrow after sunrise... Im gonna keep you updated on this tread

Saulus92 commented 5 months ago

After the latest update of the fusionsolar integration there were no changes in behaviour. I do receive data every 4 minutes so i dont think theres any communication problem with the northbound api. Still my entitys become unknown after more or less two minutes like in the screenshots above. Dont know where to start the search here...

Saulus92 commented 5 months ago

Update: Solved!!! The problem was coming from fusionsolar or northbound API. The solution was to create a new "system" and add it to The fusionsolar integration. Until now it works as before so no problems. Thanks for the time, i hope someone can benefit from this tread in future!