tijsverkoyen / HomeAssistant-FusionSolar

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

No more entities provided #150

Closed Cedric29 closed 3 months ago

Cedric29 commented 4 months ago

It has now been 2 days the integration does not provide entities anymore

Here is some logs from Home Assistant docker container :

2024-02-14 10:48:57.945 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up fusion_solar platform for sensor
Traceback (most recent call last):
  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 183, in _do_call
    raise FusionSolarOpenApiErrorInvalidAccessToCurrentInterfaceError(json_data[ATTR_MESSAGE])
custom_components.fusion_solar.fusion_solar.openapi.openapi_api.FusionSolarOpenApiErrorInvalidAccessToCurrentInterfaceError: Invalid access to current interface!
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/fusion_solar/sensor.py", line 802, in async_setup_entry
    stations = await hass.async_add_executor_job(api.get_station_list)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/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 58, in get_station_list
    return self.stations()
           ^^^^^^^^^^^^^^^
  File "/config/custom_components/fusion_solar/fusion_solar/openapi/openapi_api.py", line 83, in stations
    response = self._do_call(url, json)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/fusion_solar/fusion_solar/openapi/openapi_api.py", line 194, in _do_call
    raise FusionSolarOpenApiError(
custom_components.fusion_solar.fusion_solar.openapi.openapi_api.FusionSolarOpenApiError: Retrieving the data for https://eu5.fusionsolar.huawei.com/thirdData/stations failed with failCode: 20056, message: None
2024-02-14 10:49:29.888 ERROR (MainThread) [custom_components.hacs] Could not update template - Timeout of 60s reached
2024-02-14 10:49:29.888 ERROR (MainThread) [custom_components.hacs] Could not update integration - Timeout of 60s reached

image

tijsverkoyen commented 4 months ago

Can you check with your installer if your credentials have access to retrieve the stations. As I think you don't have access to /thirdData/getStationList or /thirdData/stations

CarloDeSutter commented 4 months ago

I think I am suffering from the same problem.

I am currently contacting my installer to see if they can find anything that's causing this.

When I make the call manually, I am getting an obscure error of which I cannot find much else on the web.

POST https://eu5.fusionsolar.huawei.com/thirdData/stations with body { "pageNo": 1 }

{
    "data": null,
    "failCode": 20056,
    "message": "exist resource that are not authorized by the owner.",
    "success": false
}
Cedric29 commented 4 months ago

Can you check with your installer if your credentials have access to retrieve the stations. As I think you don't have access to /thirdData/getStationList or /thirdData/stations

I had access 2 days agao, then all of a sudden no more entities provided.

The API call on that URL https://eu5.fusionsolar.huawei.com is giving me that response : { "data": null, "success": true, "failCode": 0, "params": {}, "message": null }

Edvliet commented 4 months ago

Same situation here. I am working with the openApi. Reinstalling and authorizing to the API is successful, but I do not see any entities. Prior entitities were not producing any results. The monitoring of Fusion Solar indicates that the information is send to Huawei

tijsverkoyen commented 4 months ago

Can 1 of you share their credentials with me. So I can debug it? You can mail them to fusionsolar-ha [at] verkoyen [dot] eu

Edvliet commented 4 months ago

Hoi Tijs, Bedankt dat je dit wilt uitzoeken.

REDACTED

Op 16 feb 2024, om 09:54 heeft Tijs Verkoyen @.***> het volgende geschreven:

Can 1 of you share their credentials with me. So I can debug it? You can mail them to fusionsolar-ha [at] verkoyen [dot] eu

— Reply to this email directly, view it on GitHub https://github.com/tijsverkoyen/HomeAssistant-FusionSolar/issues/150#issuecomment-1947986022, or unsubscribe https://github.com/notifications/unsubscribe-auth/A652LGRVJQBOCBV7CQQPVD3YT4NEPAVCNFSM6AAAAABDH7OMK2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBXHE4DMMBSGI. You are receiving this because you commented.

Cedric29 commented 4 months ago

Can 1 of you share their credentials with me. So I can debug it? You can mail them to fusionsolar-ha [at] verkoyen [dot] eu

Email sent !, check your spam maybe if not received.

tijsverkoyen commented 4 months ago

I will try to find time next week.

tijsverkoyen commented 4 months ago

@Cedric29 & @Edvliet

Fusion Solar API debug
======================

→ Testing /login: ✔
→ Testing /getStationList: ❌
 [ERROR] Invalid access to current interface!                                                                           

→ Testing /stations: ❌
 [ERROR] exist resource that are not authorized by the owner.                                                           

You will need to contact your installer, or Fusion Solar Support.

I think there is something misconfigured to your credentials as you don't have access to get a list of the stations. Not for the /getStationList (old endpoint) and not for the /stations endpoint.

tobyknobi commented 4 months ago

I am having the same issue here. It stopt during the night then in the morning it was good again. And then a couple of hours later it stopt again. I think the problem lies with Huawei. Maybe the adres changed or so. I see my credentials are good

3010Mark commented 4 months ago

@tijsverkoyen Een vraagje, welke kan de reden zijn dat er geen verbruik gegevens worden weergeven van de powermeter? Alle andere gegevens van de inverter en batterij worden wel correct weer gegeven. Meter-1 gegevens

ekurgan commented 4 months ago

I am having the same issue here. It stopt during the night then in the morning it was good again. And then a couple of hours later it stopt again. I think the problem lies with Huawei. Maybe the adres changed or so. I see my credentials are good

Same here, the credentials are all checked but having the same issue

Edvliet commented 4 months ago

It is a bit coincidence that multiple api’s went offline a the same time.When I look in the FusionSolar app, I notice that everything is working without any problems.Unwilling get in contact to ask whether they have made any modifications lately. Regards,

Cedric29 commented 4 months ago

@tijsverkoyen Could you maybe investigate at your side what's going wrong ? A bit of a coincidence that we all have the same issue with the integration ? Has maybe the url changed to get the stationList ? I always had the issue to get the station list on Postman with the tutorial they wrote. But with your integration, I had the values returned.

CarloDeSutter commented 4 months ago

If you do the call manually you will be hitting the same issue, so I don't think this is related to how the integration works. My installer will contact their contacts for this, I propose you all request to do the same.

My guess is that something got changed/updated at the far backend (huawei) as that would explain this sudden change.

tijsverkoyen commented 4 months ago

Could you maybe investigate at your side what's going wrong ? A bit of a coincidence that we all have the same issue with the integration ? Has maybe the url changed to get the stationList ? I always had the issue to get the station list on Postman with the tutorial they wrote. But with your integration, I had the values returned.

There are 2 calls getStationList, which is an older endpoint that is not available for newer installations. When this call fails with the Invalid access to current interface-error the stations endpoint is called to retrieve the list of stations. See https://github.com/tijsverkoyen/HomeAssistant-FusionSolar/blob/master/custom_components/fusion_solar/fusion_solar/openapi/openapi_api.py#L58

When the stations call also fails there is no data for the stations.

Feel free to contact Huawei / your installer. If something has changed. Or how exist resource that are not authorized by the owner. should be handled. At this moment I don't have the time to trying to debug it all, as to me the error exist resource that are not authorized by the owner. is something on Huawei their part.

Cedric29 commented 4 months ago

@tijsverkoyen I've contacted the API service of Huawei, here is what they send me without telling me what's the issue ... SmartPVMS V600R024C10 Northbound Interface Reference-V6 -API(FusionSolar SmartPVMS).pdf

Cedric29 commented 4 months ago

Has anyone found a solution ? Installer giving the ball to Huawei, Huawei only sending the documentation without explaining what's going wrong ...

Edvliet commented 4 months ago

In fact, that documentation is the ‘ old’ documentation wat is already active since 2023. I have not yet got the API working. As Tim said to me, based on the API results it seems that I do not have a station, while the Kiosk of Huawei is working normal..

Op 23 feb 2024, om 09:26 heeft Cédric Vandenberge @.***> het volgende geschreven:

Has anyone found a solution ? Installer giving the ball to Huawei, Huawei only sending the documentation without explaining what's going wrong ...

— Reply to this email directly, view it on GitHub https://github.com/tijsverkoyen/HomeAssistant-FusionSolar/issues/150#issuecomment-1960909058, or unsubscribe https://github.com/notifications/unsubscribe-auth/A652LGTSZQZZLYHHXKWGVHDYVBHCTAVCNFSM6AAAAABDH7OMK2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRQHEYDSMBVHA. You are receiving this because you were mentioned.

Cedric29 commented 4 months ago

In fact, that documentation is the ‘ old’ documentation wat is already active since 2023. I have not yet got the API working. As Tim said to me, based on the API results it seems that I do not have a station, while the Kiosk of Huawei is working normal.. Op 23 feb 2024, om 09:26 heeft Cédric Vandenberge @.***> het volgende geschreven: Has anyone found a solution ? Installer giving the ball to Huawei, Huawei only sending the documentation without explaining what's going wrong ... — Reply to this email directly, view it on GitHub <#150 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/A652LGTSZQZZLYHHXKWGVHDYVBHCTAVCNFSM6AAAAABDH7OMK2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRQHEYDSMBVHA. You are receiving this because you were mentioned.

Exact, Kiosk solution working, but not enough data provided ...

tobyknobi commented 4 months ago

Just a notice. I just saw that the battery data is flowing again

tobyknobi commented 4 months ago

Just a notice. I just saw that the battery data is flowing again

Unfortunately after an hour it stopt again. 😔

JohnMcLear commented 4 months ago

I'm getting successful auth but no entities, I'm going to attempt debug now and will come back w/ my findings.

Company and Plant are included in the "Company Management > Northbound" and the usernames are all correct.

I noticed under "Real-time device data" some things weren't selected, it might be that. The same was the case under "Daily device data". These have now been "checked" and I went to remove the hub and re-add it.

I still have "No devices or entities" being display. In the error log I get this

raceback (most recent call last):
  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 183, in _do_call
    raise FusionSolarOpenApiErrorInvalidAccessToCurrentInterfaceError(json_data[ATTR_MESSAGE])
custom_components.fusion_solar.fusion_solar.openapi.openapi_api.FusionSolarOpenApiErrorInvalidAccessToCurrentInterfaceError: Invalid access to current interface!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/fusion_solar/sensor.py", line 802, in async_setup_entry
    stations = await hass.async_add_executor_job(api.get_station_list)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/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 58, in get_station_list
    return self.stations()
           ^^^^^^^^^^^^^^^
  File "/config/custom_components/fusion_solar/fusion_solar/openapi/openapi_api.py", line 83, in stations
    response = self._do_call(url, json)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/fusion_solar/fusion_solar/openapi/openapi_api.py", line 194, in _do_call
    raise FusionSolarOpenApiError(
custom_components.fusion_solar.fusion_solar.openapi.openapi_api.FusionSolarOpenApiError: Retrieving the data for https://eu5.fusionsolar.huawei.com/thirdData/stations failed with failCode: 20056, message: None
Edvliet commented 4 months ago

I have looked in the Northbound Document iMaster NetEco V600R023C00 and found maybe something interesting. Page 7 indicating that interface PlantList is about to go offline (doc is created in 01-2023). Page 9 indicating that the interface PlantList is modified with mandatory pagination. Page 162 is the modified interface PlantList is indicating pageNo and pageSize is mandatory.

I cannot run the getStationList, but can previous mandatory change be the problem? When I execute https://eu5.fusionsolar.huawei.com/thirdData/getstationList I receive the exceptionInfo: can not find api, please check if the request url is valid or the api has published! url=/thirdData/getstationList"

Edvliet commented 4 months ago

Hmm, according to the documentation pag 162 the interface getStationList is version depending. I have version V600R023C00SPC210 and the documentation indicates that I have to use 'station' instead of getStationList. It seems that I am not authorized for the interface "station"

tijsverkoyen commented 4 months ago

Just a notice. I just saw that the battery data is flowing again

Unfortunately after an hour it stopt again. 😔

Can you enable debug mode for the integration. I would guess you are running into rate limiting.

Hmm, according to the documentation pag 162 the interface getStationList is version depending. I have version V600R023C00SPC210 and the documentation indicates that I have to use 'station' instead of getStationList. It seems that I am not authorized for the interface "station"

@Edvliet as told in https://github.com/tijsverkoyen/HomeAssistant-FusionSolar/issues/150#issuecomment-1953913320 there is already handling of the getStationList vs stations. But you will need the correct rights. Ask you installer or Huawei to give you access to list the stations.

tobyknobi commented 4 months ago

Just a notice. I just saw that the battery data is flowing again

Unfortunately after an hour it stopt again. 😔

Can you enable debug mode for the integration. I would guess you are running into rate limiting.

Hmm, according to the documentation pag 162 the interface getStationList is version depending. I have version V600R023C00SPC210 and the documentation indicates that I have to use 'station' instead of getStationList. It seems that I am not authorized for the interface "station"

@Edvliet as told in #150 (comment) there is already handling of the getStationList vs stations. But you will need the correct rights. Ask you installer or Huawei to give you access to list the stations.

2024-02-03 18:30:44.212 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up fusion_solar platform for sensor 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 802, in async_setup_entry await add_entities_for_stations(hass, async_add_entities, stations, api) File "/config/custom_components/fusion_solar/sensor.py", line 157, in add_entities_for_stations devices = await hass.async_add_executor_job(api.get_dev_list, station_codes) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 131, in get_dev_list response = self._do_call(url, json) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/fusion_solar/fusion_solar/openapi/openapi_api.py", line 194, in _do_call raise FusionSolarOpenApiError( custom_components.fusion_solar.fusion_solar.openapi.openapi_api.FusionSolarOpenApiError: Retrieving the data for https://eu5.fusionsolar.huawei.com/thirdData/getDevList failed with failCode: 20010, message: None

JohnMcLear commented 4 months ago

Just a notice. I just saw that the battery data is flowing again

Unfortunately after an hour it stopt again. 😔

Can you enable debug mode for the integration. I would guess you are running into rate limiting.

Hmm, according to the documentation pag 162 the interface getStationList is version depending. I have version V600R023C00SPC210 and the documentation indicates that I have to use 'station' instead of getStationList. It seems that I am not authorized for the interface "station"

@Edvliet as told in #150 (comment) there is already handling of the getStationList vs stations. But you will need the correct rights. Ask you installer or Huawei to give you access to list the stations.

FWIW and this is purely for my instance; I am the installer and the end user. I'm happy to make changes/test however in my instance I have gone through and given ALL permissions / access yet still get no entities and experience the error in my previous comment.

tijsverkoyen commented 4 months ago

@JohnMcLear can you enable debug mode and see what the error is?

JohnMcLear commented 4 months ago

@JohnMcLear can you enable debug mode and see what the error is?

Yes I'll grab it again and post again. Sorry but I thought I already did ;/

JohnMcLear commented 4 months ago

cc @tijsverkoyen

2024-02-24 17:52:22.741 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up fusion_solar platform for sensor
Traceback (most recent call last):
  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 183, in _do_call
    raise FusionSolarOpenApiErrorInvalidAccessToCurrentInterfaceError(json_data[ATTR_MESSAGE])
custom_components.fusion_solar.fusion_solar.openapi.openapi_api.FusionSolarOpenApiErrorInvalidAccessToCurrentInterfaceError: Invalid access to current interface!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/fusion_solar/sensor.py", line 802, in async_setup_entry
    stations = await hass.async_add_executor_job(api.get_station_list)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/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 58, in get_station_list
    return self.stations()
           ^^^^^^^^^^^^^^^
  File "/config/custom_components/fusion_solar/fusion_solar/openapi/openapi_api.py", line 83, in stations
    response = self._do_call(url, json)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/fusion_solar/fusion_solar/openapi/openapi_api.py", line 194, in _do_call
    raise FusionSolarOpenApiError(
custom_components.fusion_solar.fusion_solar.openapi.openapi_api.FusionSolarOpenApiError: Retrieving the data for https://eu5.fusionsolar.huawei.com/thirdData/stations failed with failCode: 20056, message: None
2024-02-25 11:56:34.597 DEBUG (SyncWorker_15) [custom_components.fusion_solar.fusion_solar.openapi.openapi_api] JSON data for https://eu5.fusionsolar.huawei.com/thirdData/getStationList: {'data': None, 'failCode': 401, 'message': 'Invalid access to current interface!', 'params': {}, 'success': False}
2024-02-25 11:56:34.597 DEBUG (SyncWorker_15) [custom_components.fusion_solar.fusion_solar.openapi.openapi_api] Could not use getStationList, trying stations: Invalid access to current interface!
2024-02-25 11:56:34.847 DEBUG (SyncWorker_15) [custom_components.fusion_solar.fusion_solar.openapi.openapi_api] JSON data for https://eu5.fusionsolar.huawei.com/thirdData/stations: {'data': None, 'failCode': 20056, 'message': 'exist resource that are not authorized by the owner.', 'success': False}
2024-02-25 11:56:34.847 DEBUG (SyncWorker_15) [custom_components.fusion_solar.fusion_solar.openapi.openapi_api] Error calling https://eu5.fusionsolar.huawei.com/thirdData/stations: None, failcode: 20056
tijsverkoyen commented 4 months ago
custom_components.fusion_solar.fusion_solar.openapi.openapi_api.FusionSolarOpenApiError: Retrieving the data for https://eu5.fusionsolar.huawei.com/thirdData/stations failed with failCode: 20056, message: None

The error indicates that you don't have any stations. Or you don't have access to any stations.

JohnMcLear commented 4 months ago

image

image

image

image

Can I provide any other screenshots that might help?

tijsverkoyen commented 4 months ago

I'm not an installer, and I don't have access to an installer interface. So I would not know what to look for.

But I remember a PR for https://github.com/tijsverkoyen/HomeAssistant-FusionSolar?tab=readme-ov-file#device-data. Where that person told that you need to click open the different items and give access on the subitems.

What happens if you click on the plus on the left side off "Plant list"?

JohnMcLear commented 4 months ago

I'm not an installer, and I don't have access to an installer interface. So I would not know what to look for.

But I remember a PR for https://github.com/tijsverkoyen/HomeAssistant-FusionSolar?tab=readme-ov-file#device-data. Where that person told that you need to click open the different items and give access on the subitems.

What happens if you click on the plus on the left side off "Plant list"?

You get "Selected company and Selected plant", both of which are populated as per this image:

image

This already tricked me once which is why I sent the screenshot initially ;)

The PR refers more to this selection item to ensure all sub items are selected as per the below image:

image

JohnMcLear commented 4 months ago

FWIW I'm happy to jump on a quick screen share via whatever mechanism if you want to have a look at my installer UI and see if we're missing something obvious? john splat mclear dot co dot uk if you want to contact me directly.

tijsverkoyen commented 4 months ago

In that case I don't see why the Api would return no stations. And I would think it is an issue in the Huawei API.

I don't know if you are able to work with curl? But could you try this:

curl --location 'https://eu5.fusionsolar.huawei.com/thirdData/login' 0i \
--header 'Content-Type: application/json' \
--data '{
    "userName": "XXX",
    "systemCode": "XXX"
}'

This will return output include a header xsrf-token, you will need that value for the next request.

curl --location 'https://eu5.fusionsolar.huawei.com/thirdData/getStationList' \
--header 'XSRF-TOKEN: XXX' \
--header 'Content-Type: application/json' \
--data '{}'

I would assume this fails.

curl --location 'https://eu5.fusionsolar.huawei.com/thirdData/stations' \
--header 'XSRF-TOKEN: XXX' \
--header 'Content-Type: application/json' \
--data '{
    "pageNo": 1,
    "pageSize": 100
}'

I would assume this also fails, or gives an empty data attribute.

JohnMcLear commented 4 months ago

Yeah I'm comfortable with curl and postman. I'll get on with this tonight and report back. One hour or so.

JohnMcLear commented 4 months ago
jose@ryzin:~$ curl --location 'https://eu5.fusionsolar.huawei.com/thirdData/login' 0i --header 'Content-Type: application/json' --data '{
    "userName": "XXX",
    "systemCode": "XXX"
}'
{"data":null,"success":true,"failCode":0,"params":{},"message":null}curl: (6) Could not resolve host: 0i
jose@ryzin:~$ 

Note that the message is null...

This curl command doesn't output headers, I took some digging in headers and found the token..

jose@ryzin:~$ curl --location 'https://eu5.fusionsolar.huawei.com/thirdData/getStationList' \
--header 'XSRF-TOKEN: XXX' \
--header 'Content-Type: application/json' \
--data '{}'
{"data":null,"failCode":401,"message":"Invalid access to current interface!","params":{},"success":false}

https://github.com/tijsverkoyen/HomeAssistant-FusionSolar/issues/68#issuecomment-1451621843 feels useful

tijsverkoyen commented 4 months ago

The 0i should be -i

eyk107 commented 4 months ago

I had the same issue but in "Kiosk"-mode. I had to grep a new kiosk-url from the website and everything is working again.

JohnMcLear commented 4 months ago

I had the same issue but in "Kiosk"-mode. I had to grep a new kiosk-url from the website and everything is working again.

I'm not using the kiosk URL tho @eyk107 - I'll give it a go but I'm not sure how it could make a difference

eyk107 commented 4 months ago

It was just an information. It seems to me that Huawei changed something so I need to update the Kiosk-url. Maybe you also need to update any urls in the API-method

tijsverkoyen commented 4 months ago

It was just an information. It seems to me that Huawei changed something so I need to update the Kiosk-url. Maybe you also need to update any urls in the API-method

Kiosk and Northbound API are 2 completely different things and not related at all. Kiosk urls also expire after a year. See: https://github.com/tijsverkoyen/HomeAssistant-FusionSolar?tab=readme-ov-file#i-am-using-the-kiosk-mode-but-the-data-is-not-updating

jose@ryzin:~$ curl --location 'https://eu5.fusionsolar.huawei.com/thirdData/login' 0i --header 'Content-Type: application/json' --data '{
    "userName": "XXX",
    "systemCode": "XXX"
}'
{"data":null,"success":true,"failCode":0,"params":{},"message":null}curl: (6) Could not resolve host: 0i
jose@ryzin:~$ 

Note that the message is null...

That is correct. In this login call the "success": true is the most important part. And the token off course.

This curl command doesn't output headers, I took some digging in headers and found the token..

I know, my fault. 0i should be -i

jose@ryzin:~$ curl --location 'https://eu5.fusionsolar.huawei.com/thirdData/getStationList' \
--header 'XSRF-TOKEN: XXX' \
--header 'Content-Type: application/json' \
--data '{}'
{"data":null,"failCode":401,"message":"Invalid access to current interface!","params":{},"success":false}

Ok, and what did the third curl call gave as output?

curl --location 'https://eu5.fusionsolar.huawei.com/thirdData/stations' \
--header 'XSRF-TOKEN: XXX' \
--header 'Content-Type: application/json' \
--data '{
    "pageNo": 1,
    "pageSize": 100
}'

#68 (comment) feels useful

Yeah, that is implemented. And that is the third call.

JohnMcLear commented 4 months ago

second request

{"data":null,"failCode":401,"message":"Invalid access to current interface!","params":{},"success":false}jose@ryzin:~$ 

third request

{"data":null,"failCode":20056,"message":"exist resource that are not authorized by the owner.","success":false}

One thing I did notice is this message "Before providing the northbound account, ensure that the northbound user has been authorized by the owner".. I'm the installer and not seeing any request to authorize the user...

The Developer Guide for northbound link doesn't work for me: https://support.huawei.com/enterprise/en/doc/EDOC1100339287 -- this is from the fusion solar page... FML

I've bumped Huawei via email.

Also I found this: https://forum.huawei.com/enterprise/en/API-user-error-on-Northbound/thread/760952027177500672-667213868771979264

Same problem dated 4 days ago.....

tobyknobi commented 4 months ago

Huawei I just received this from Huawei.

Cedric29 commented 4 months ago

Huawei I just received this from Huawei.

I also received it I don't have an installer account, so can't modify those settings...

tijsverkoyen commented 4 months ago

@Cedric29 try to contact your installer?

tijsverkoyen commented 4 months ago

@JohnMcLear maybe you can check it based on those screenshot from Huawei

Cedric29 commented 4 months ago

@Cedric29 try to contact your installer?

As already mentionned, they're are giving the ball to Huawei, which is giving the ball to installer ... So noone can solve that issue ...