jgriss / FusionSolarPy

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

Failed to login into FusionSolarAPI: Incorrect verification code #5

Closed MichelRabozee closed 1 year ago

MichelRabozee commented 1 year ago

Hello !

It seems Huawei changed something to their system. Everything was working till 22:00 (European Time) yesterday 23-Sep-2022. From then, when calling client = FusionSolarClient(, , huawei_subdomain="region01eu5"), I get:

  File "/usr/local/lib/python3.9/site-packages/fusion_solar_py/client.py", line 82, in __init__
    self._login()
  File "/usr/local/lib/python3.9/site-packages/fusion_solar_py/client.py", line 118, in _login
    raise AuthenticationException(
fusion_solar_py.exceptions.AuthenticationException: Failed to login into FusionSolarAPI: Incorrect verification code. 

They seem to have added (for a better client service !!) a Captcha to the authentication scheme :-(

Is it game over ?

Have a nice day,

Michel

jgriss commented 1 year ago

Hi @MichelRabozee,

Thanks a lot for your feedback!

No, this feature has always been there. Luckily, the validation code is only required if they (seem to) assume some misuse. In my setup, the system has been running for nearly 1 year without an issue. But I keep the session open for many days.

In my experience, the authentication captcha was only requested when I used the wrong password too often (during testing).

Kind regards, Johannes

MichelRabozee commented 1 year ago

OK, thank you for the explanations.

So I guess, the Captcha will disappear after a while ? Or do I have to do something ?

Best regards, Michel

jgriss commented 1 year ago

Hi @MichelRabozee,

Yes exactly! In my case, the captcha always disappeared again on its own.

Kind regards, Johannes

Spiritreader commented 1 year ago

@FunnyPocketBook and I have made modifications to the log in flow of the library.

It now supports re-using sessions, which reduces the number of login calls that are made if you use the script without a loop (for example as a telegraf plugin).

In addition, we've added a neural network based captcha solver (that we trained ourselves) which is automatically used as soon as a captcha is required.

This is available on our fork https://github.com/Walzen-Group/FusionSolarPy

If desired, we can open a PR.

jgriss commented 1 year ago

Hi @Spiritreader

A PR would be great! Thanks a lot!

FunnyPocketBook commented 1 year ago

Great, thanks for the positive response! We'll do a clean up of the code and write some documentation for the new parameters before submitting the PR.