jgriss / FusionSolarPy

A basic client to the Huawei Fusion Solar cloud interface for solar power plants
MIT License
31 stars 12 forks source link

Failed to reset session and login again. #29

Closed JesusRosaB closed 2 months ago

JesusRosaB commented 3 months ago

I am obtaining this error after create the client, some idea?

animatrons commented 3 months ago

i get it when i call get_plant_ids or get_station_list , but not for get_station_list . There is a problem in: fusion_solar_py/client.py", line 551, in get_station_list obj_tree = r.json()

the response is an html not json.

JesusRosaB commented 3 months ago

i get it when i call get_plant_ids or get_station_list , but not for get_station_list . There is a problem in: fusion_solar_py/client.py", line 551, in get_station_list obj_tree = r.json()

the response is an html not json.

But you obtain same error? i thought was related with login process not with that methods

thematt87 commented 3 months ago

I'm having the same issue with the following code from the example:

from fusion_solar_py.client import FusionSolarClient

client = FusionSolarClient("xxx", "xxx", huawei_subdomain="uni002eu5")

plant_overview = client.get_station_list()
print(f"Current power production: { plant_overview[0]['currentPower'] }")

I think Huawei changed somehting in the authentication, because if I capture the REST call from the Fusion Solar Web Portal and execute it with the fake-cookie from Chrome, the API works.

Anyone an idea how to fix this?

JesusRosaB commented 3 months ago

I'm having the same issue with the following code from the example:

from fusion_solar_py.client import FusionSolarClient

client = FusionSolarClient("xxx", "xxx", huawei_subdomain="uni002eu5")

plant_overview = client.get_station_list()
print(f"Current power production: { plant_overview[0]['currentPower'] }")

I think Huawei changed somehting in the authentication, because if I capture the REST call from the Fusion Solar Web Portal and execute it with the fake-cookie from Chrome, the API works.

Anyone an idea how to fix this?

As said @animatrons the problem is "get_station_list()" method, if you try to avoid its use should work your code

Jongonzale commented 3 months ago

I'm having the same issue with the following code from the example:

from fusion_solar_py.client import FusionSolarClient

client = FusionSolarClient("xxx", "xxx", huawei_subdomain="uni002eu5")

plant_overview = client.get_station_list()
print(f"Current power production: { plant_overview[0]['currentPower'] }")

I think Huawei changed somehting in the authentication, because if I capture the REST call from the Fusion Solar Web Portal and execute it with the fake-cookie from Chrome, the API works. Anyone an idea how to fix this?

As said @animatrons the problem is "get_station_list()" method, if you try to avoid its use should work your code

And how do you know the plant_id without that method or the get_plant_ids?

JesusRosaB commented 3 months ago

I'm having the same issue with the following code from the example:

from fusion_solar_py.client import FusionSolarClient

client = FusionSolarClient("xxx", "xxx", huawei_subdomain="uni002eu5")

plant_overview = client.get_station_list()
print(f"Current power production: { plant_overview[0]['currentPower'] }")

I think Huawei changed somehting in the authentication, because if I capture the REST call from the Fusion Solar Web Portal and execute it with the fake-cookie from Chrome, the API works. Anyone an idea how to fix this?

As said @animatrons the problem is "get_station_list()" method, if you try to avoid its use should work your code

And how do you know the plant_id without that method or the get_plant_ids?

i had the IDs in my own DataBase, then i hardcoded the ids in the code until method its not working

thematt87 commented 3 months ago

I'm having the same issue with the following code from the example:

from fusion_solar_py.client import FusionSolarClient

client = FusionSolarClient("xxx", "xxx", huawei_subdomain="uni002eu5")

plant_overview = client.get_station_list()
print(f"Current power production: { plant_overview[0]['currentPower'] }")

I think Huawei changed somehting in the authentication, because if I capture the REST call from the Fusion Solar Web Portal and execute it with the fake-cookie from Chrome, the API works. Anyone an idea how to fix this?

As said @animatrons the problem is "get_station_list()" method, if you try to avoid its use should work your code

And how do you know the plant_id without that method or the get_plant_ids?

i had the IDs in my own DataBase, then i hardcoded the ids in the code until method its not working

That is not a solution for me. I don't know my IDs and I also don't find them in the Fusionsolar web portal :(

Jongonzale commented 3 months ago

I'm having the same issue with the following code from the example:

from fusion_solar_py.client import FusionSolarClient

client = FusionSolarClient("xxx", "xxx", huawei_subdomain="uni002eu5")

plant_overview = client.get_station_list()
print(f"Current power production: { plant_overview[0]['currentPower'] }")

I think Huawei changed somehting in the authentication, because if I capture the REST call from the Fusion Solar Web Portal and execute it with the fake-cookie from Chrome, the API works. Anyone an idea how to fix this?

As said @animatrons the problem is "get_station_list()" method, if you try to avoid its use should work your code

And how do you know the plant_id without that method or the get_plant_ids?

i had the IDs in my own DataBase, then i hardcoded the ids in the code until method its not working

That is not a solution for me. I don't know my IDs and I also don't find them in the Fusionsolar web portal :(

I see what's my ID. What I've done is this: -Go to the Fusion Solar portal to the 'Control' part. -There see with the DevTools (push the F12) the info of the web -Go to the Network part and refresh the web -You'll see in the left part one with the name 'energy-balance?stationDn...' -Click that and copy the Request URL in another internet page -You'll see the JSON it returns, and the ID is the 'stationDn' one.

If you have more than one, I suppose that you'd have to do the same for every one

I think that there would be an easier way, but that's the first way I find it and works :)

RRonGit commented 3 months ago

Hardcoding the ID into the code works for me.

thematt87 commented 2 months ago

Thanks @Jongonzale, the workaround does the job for me.

dogganos commented 2 months ago

Will there be a fix at sometime?

jgriss commented 2 months ago

Hello everyone!

Sorry about the late response!

The reason for this is that the v2 authentication method used by the library was apparently disabled. The new v3 version uses encrypted passwords. These depend on a public key together with a yet unknown salt.

I still need to identify the code for their new login procedure in order to update the tool.

jgriss commented 2 months ago

Hi everyone!

This is now fixed in the new version 0.0.25

In case you still experience any issues, please open a new issue.