tijsverkoyen / HomeAssistant-FusionSolar

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

Question: have you ever considered using APIs from the web portal? #162

Closed informagico closed 2 months ago

informagico commented 2 months ago

Hi @tijsverkoyen, I tried contacting my system installer for obtaining a Northbound account but with no luck, he is extremely non-collaborative and just a pain in the butt 😞 Right now I am stuck with the Kiosk mode because I don't want to loose all my data from several years.

I was then playing around with the web portal, on the browser, and looking to the network requests underneat, just wondering if you ever considered to use those API for fetching data. I made some experiments with Postman/Insomnia on these endpoints:

The "only" header required was the session cookie obtained from the login (dumped via devtools), I was able to fetch data and everything seems pretty complete to me. Of course I didn't spend too much time looking for limitations (time/device/IPs/...) so maybe there is some catch that will make all this unusable.

Let me know what you think about. In any case, great work with this integration! 👍

tijsverkoyen commented 2 months ago

Hi @informagico

These calls are (as far as I know) undocumented and therefor not supported by Huawei. Feel free to create PR's to add support for these calls.

informagico commented 2 months ago

Yes you are correct, there are totally "reverse engineered" without any docs. I am not very familiar with python but I'll surely take a look.

Also, if you have any tips on how to setup proper environment for developing/debugging is really appreciated.

Thanks!

tijsverkoyen commented 2 months ago

Personally I have a docker container with only this integration loaded as a custom component.

informagico commented 2 months ago

I made a repo just to play around with the APIs, if anyone wants to have a look https://github.com/informagico/FusionSolar-API-RE

tijsverkoyen commented 2 months ago

@informagico I will close this issues at this point. Feel free to create a PR when you are ready.