olibos / Home-Assistant-FusionSolar-OpenApi

Integrate FusionSolar into your Home Assistant.
MIT License
10 stars 0 forks source link

Force charge/discharge? #4

Open ehegenberger opened 2 years ago

ehegenberger commented 2 years ago

Do you have any plans to integrate the chargeAndDischarge call in this? I'd really like to be able to force the battery to charge from the grid at night, for example, but I don't know much about the interface and can't seem to get that specific function call to respond, as I keep getting an Error: Not Found for url: https://intl.fusionsolar.huawei.com/thirdData/chargeAndDischarge even though it's in the API description.

olibos commented 2 years ago

Hello @ehegenberger ,

I haven't a battery for the moment (maybe one day šŸ˜‰). Have you try with https://eu5.fusionsolar.huawei.com/thirdData/chargeAndDischarge instead of intl?

If I look at the documentation, I found another type of URL: https://x.x.x.x:27200/rest/openapi/pvms/v1/vpp/chargeAndDischarge

ehegenberger commented 2 years ago

Thanks for the quick response. Iā€™ve been trying all sorts of combinations of URLs both in python and directly with Postman, but so far no response. Iā€™ll post if I get it to work, but my best programming skills are copy and paste, so donā€™t hold your breath. :)

Erich

From: Olivier Bossaer @. Sent: Thursday, October 20, 2022 2:27 PM To: olibos/Home-Assistant-FusionSolar-OpenApi @.> Cc: ehegenberger @.>; Mention @.> Subject: Re: [olibos/Home-Assistant-FusionSolar-OpenApi] Force charge/discharge? (Issue #4)

Hello @ehegenberger https://github.com/ehegenberger ,

I haven't a battery for the moment (maybe one day šŸ˜‰). Have you try with https://eu5.fusionsolar.huawei.com/thirdData/chargeAndDischarge instead of intl?

If I look at the documentation, I found another type of URL: https://x.x.x.x:27200/rest/openapi/pvms/v1/vpp/chargeAndDischarge

ā€” Reply to this email directly, view it on GitHub https://github.com/olibos/Home-Assistant-FusionSolar-OpenApi/issues/4#issuecomment-1285458555 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AOC7HWPVD4FGS4IYYVPXBDLWEE3CXANCNFSM6AAAAAARKBNQYU . You are receiving this because you were mentioned.Message ID: @.***>

ehegenberger commented 2 years ago

Well, I was actually able to log on to the other url once I figured out how to frame it:

https://eu5.fusionsolar.huawei.com:27200/rest/openapi/pvms/v1/login (or eu5 or intl I guess).

Evidently this is a different interface with different functions, for example ā€œgetStationListā€ is ā€œplantsā€ etc.

but I canā€™t even seem to phrase the request properly despite following the instructions. I think this will have to wait until someone else takes the time to sit down and make it work. Iā€™ll just email my provider with a list of times when I want them to charge the battery like everybody else seems to be doing.

From: Olivier Bossaer @. Sent: Thursday, October 20, 2022 2:27 PM To: olibos/Home-Assistant-FusionSolar-OpenApi @.> Cc: ehegenberger @.>; Mention @.> Subject: Re: [olibos/Home-Assistant-FusionSolar-OpenApi] Force charge/discharge? (Issue #4)

Hello @ehegenberger https://github.com/ehegenberger ,

I haven't a battery for the moment (maybe one day šŸ˜‰). Have you try with https://eu5.fusionsolar.huawei.com/thirdData/chargeAndDischarge instead of intl?

If I look at the documentation, I found another type of URL: https://x.x.x.x:27200/rest/openapi/pvms/v1/vpp/chargeAndDischarge

ā€” Reply to this email directly, view it on GitHub https://github.com/olibos/Home-Assistant-FusionSolar-OpenApi/issues/4#issuecomment-1285458555 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AOC7HWPVD4FGS4IYYVPXBDLWEE3CXANCNFSM6AAAAAARKBNQYU . You are receiving this because you were mentioned.Message ID: @.***>

ehegenberger commented 1 year ago

So I managed to get some parts of the other integration sort of working in python (especially the forced battery charge bits), and will eventually try and integrate it into HA. I find it strange that Huawei appears to provide two such widely different sets of features that can be accessed using the same API and password. Meanwhile, I'm looking at your integration and find that the "realtime power" and "Current day energy" seem to be rather obscure values from the Inverter page of the app that don't at all correspond to the data that are of more immediate interest (Yield today, Consumption today, Consumed from PV, Fed to grid, From grid, PV, Battery, Grid and Load) in the Overview page of the app. For example, right now I have 0.247 kW coming in from PV, 0.886 from the battery, 0 from the grid and a load of 1.133, with a PV yield of 0.01 kWh and a Consumption of 12.78 with 0.93 from PV and 11.85 from grid, all of which are believable, while the HA integration is showing a Realtime power of 1.132 kW (guessing this is my current load) and a Current day energy of 3.71 kWh (no idea where they got this from). Are there extra sensors or entities in your integration that I'm overlooking?

alainsmedts commented 9 months ago

@ehegenberger Would you mind sharing the forced battery charge python code? This would be greatly appreciated.