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

getStationList deprecated? #68

Closed
arohl opened this issue Feb 26, 2023 · 24 comments · Fixed by #71 or #78
Closed

getStationList deprecated? #68

arohl opened this issue Feb 26, 2023 · 24 comments · Fixed by #71 or #78
Assignees
Labels
Huawei Issue Issue with Huawei, contact Huawei waiting for feedback Further information is requested

Comments

@arohl
Copy link
Contributor

arohl commented Feb 26, 2023

I am in Australia and using the API at https://au5.fusionsolar.huawei.com/thirdData/

The integration authenticates fine but fails when it calls getStationList. The log says

Retrieving the data for https://au5.fusionsolar.huawei.com/thirdData/getStationList failed with failCode: 401, message: None

I have a document from Huawei titled Northbound Interface Reference- V6(SmartPVMS) and dated 19th January 2023 which says:

https://Domain name of the management system/thirdData/getStationList is about to go offline

and that the new function is

https://Domain name of the management system/thirdData/stations

Using Postman, I can confirm that getStationList doesn't work (with not surprisingly the same error code as the integration reports) and that stations does return a plantCode.

Is this a uniquely Australian situation? Or are they perhaps trying the updated API on us first?

@tijsverkoyen
Copy link
Owner

I don't know of this is something specific for the Australian market or not.
Would you be so kind to contact the support and ask them? You can put me in cc (fusionsolar [at] verkoyen.eu).

@tijsverkoyen tijsverkoyen added the Huawei Issue Issue with Huawei, contact Huawei label Feb 27, 2023
@tijsverkoyen tijsverkoyen self-assigned this Feb 27, 2023
@tijsverkoyen
Copy link
Owner

@arohl Is you would be so kind to email (fusionsolar [at] verkoyen.eu) me your OpenAPI credentials then I will try to make it work with the new endpoint.

@tijsverkoyen tijsverkoyen added the waiting for feedback Further information is requested label Feb 28, 2023
@arohl
Copy link
Contributor Author

arohl commented Feb 28, 2023

Done!

@tijsverkoyen
Copy link
Owner

tijsverkoyen commented Feb 28, 2023

@arohl From what I can see the documentation is completely different. The calls also return data in a completely different format. So I don't think it will be a simple fix.

I also get an empty list of stations if I call `/thirdData/stations`, with your credentials:
{
    "data": {
        "list": [],
        "pageCount": 1,
        "pageNo": 100,
        "pageSize": 100,
        "total": 1
    },
    "failCode": 0,
    "message": "get plant list success",
    "success": true
}
Could it be that no stations are linked to your account?

@tijsverkoyen
Copy link
Owner

Nm. I should use pageNo: 1

@arohl
Copy link
Contributor Author

arohl commented Feb 28, 2023

Interesting - I thought pageNo was mandatory and so would give an error if you didn't include it.

@tijsverkoyen
Copy link
Owner

Do you have a batter and power sensor installed?
I don't get any data back for these devices. This is probably because they are not installed, or you don't have access

tijsverkoyen added a commit that referenced this issue Feb 28, 2023
It seems like getStationList is deprecated for certain devices.

I don't know if the check is any good. Probably it would be better to have some
sort of selector in the config flow that let the user decide if
`thirdData/stations` or `thirdData/getStationList` should be used...

This should fix #68
@arohl
Copy link
Contributor Author

arohl commented Feb 28, 2023 via email

@tijsverkoyen
Copy link
Owner

I will tag a release which should fix the issue.
But the empty data for some of your devices should be checked by Huawei.

@arohl
Copy link
Contributor Author

arohl commented Feb 28, 2023

Are there simple instructions for how I install a tagged release so I can test?

@tijsverkoyen
Copy link
Owner

I just tagged the new release, So you can update the repository through HACS, or just wait a few hours until the version pops up in Home Assistant.

@tijsverkoyen
Copy link
Owner

Thx! Really appreciated!

@tijsverkoyen
Copy link
Owner

tijsverkoyen commented Feb 28, 2023

@arohl about the empty data for the Battery:

curl --location 'https://au5.fusionsolar.huawei.com/thirdData/getDevRealKpi' \
--header 'XSRF-TOKEN: x-REDACTED' \
--header 'Content-Type: application/json' \
--data '{
  "devIds": "1000000033759325",
  "devTypeId": "39"
}'

It responds with empty data:

{
    "data": [
        {
            "devId": 1000000033759325,
            "dataItemMap": {},
            "sn": "null"
        }
    ],
    "failCode": 0,
    "message": null,
    "params": {
        "currentTime": 1677590785939,
        "devIds": "1000000033759325",
        "devTypeId": 39
    },
    "success": true
}

For the Inverter it gets data:

curl --location 'https://au5.fusionsolar.huawei.com/thirdData/getDevRealKpi' \
--header 'XSRF-TOKEN: x-REDACTED' \
--header 'Content-Type: application/json' \
--data '{
  "devIds": "1000000033759324",
  "devTypeId": "1"
}'

@arohl
Copy link
Contributor Author

arohl commented Feb 28, 2023

Thx! Really appreciated!

Hope its enough for a G&T in Europe!

Its getting late here, so I'll update the easy way in the morning and get in touch with Huawei

@tijsverkoyen
Copy link
Owner

I will enjoy it for sure!
Let me know if there is still something wrong.

@Argosy87
Copy link

Hi, if the response is empty just ask your installer to set correct permissions. Had the same issue and installer forgot to set the rigth permissions. After that all the data will show.

@aretokas
Copy link
Contributor

aretokas commented Mar 1, 2023

This doesn't affect just AU, it is likely to affect all endpoints (Can confirm on intl. as well) - In fact, I wrote almost the same code as you to fix it, but have now pulled across your changes.

The reference is here: https://support.huawei.com/enterprise/en/doc/EDOC1100261860/e2cc6ca3/to-be-offline-interfaces

Basically, my understanding is this:

  • If your Northbound user was created after June 30, 2022 - You'll need to use the new /stations and /getDevHistoryKpi (Not in use in the component as far as I can see).
  • If your Northbound user was created before June 30, 2022 - You'll still have access to the old interface until the estimated offline dates. Note: I'm not sure if the new interfaces are available for old users prior to depreciation as I do not have a user that old to test

If this was C# I could fix it in a flash :). However, I'm willing to test/poke my own code in there for review as nobody judges too harshly. I'd probably attack it in such a way that if /getStationList returns the error, attempt /stations. It's a little more work, but it ensures the result works for everyone.

Alternatively, a toggle in the settings to "Use the new interfaces" or something.

@tijsverkoyen tijsverkoyen reopened this Mar 2, 2023
@tijsverkoyen
Copy link
Owner

@aretokas thx! I have contacted Huawei to see if there is way to programmatically decide which endpoint to use. Or how the user can check which endpoint to use.
I will look into it further and probably implement a toggle or something like that.

@arohl
Copy link
Contributor Author

arohl commented Mar 2, 2023

Hi, if the response is empty just ask your installer to set correct permissions. Had the same issue and installer forgot to set the rigth permissions. After that all the data will show.

I emailed them and all sorted. Now just need to figure out what all the numbers mean!

@tijsverkoyen
Copy link
Owner

@arohl The integration is programmed against the docs you can find in https://github.com/tijsverkoyen/HomeAssistant-FusionSolar/tree/master/docs. All names for the entities are the ones used in the documentation.

@aretokas
Copy link
Contributor

aretokas commented Mar 2, 2023

@tijsverkoyen here is the error it returns if you try to access it if you haven't seen it:

{ "data": null, "failCode": 401, "message": "Invalid access to current interface!", "params": {}, "success": false }

I feel like the easiest flow would be, try the original endpoint, and if you receive this error, try the new one. If that then works, flip a toggle in the background for the user so you skip the first check from that point onwards.

I certainly couldn't find any other way of identifying whether it was going to work or not. Not in their documentation and not with my stuffing around with the API and permissions etc. I'll be curious to know what they say.

@tijsverkoyen
Copy link
Owner

That would probably the way to go, or a setting. But if they can tell me how to decide it programmatically it would mean less useless calls

@tijsverkoyen
Copy link
Owner

Just an update: They're not really helpful at Huawei / Fusion Solar.
So it will be probably a setting, or multiple calls. I will wait just till the weekend to see of I get a decent answer from Huawei / Fusion Solar. If not I will develop the setting / multiple calls.

@Edvliet
Copy link

Edvliet commented Feb 28, 2024

I received a response from my provider:
Het is mij bekend dat er onderhoud gepleegd wordt op het FusionSolar platform en dat daarbij deze functie even niet beschikbaar is. Daarop heeft Youen verder geen invloed.

Translated: I am aware that maintenance is being carried out on the FusionSolar platform and that this function is temporarily unavailable. The provider has no further influence on this.

So it seems that we have to wait until the maintenance is resolved...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Huawei Issue Issue with Huawei, contact Huawei waiting for feedback Further information is requested
Projects
None yet
5 participants