Page 1 of 1

Setting max charge via API

Posted: Fri Oct 04, 2024 9:03 am
by suited-martin
Hi,

I've been using the API to get general status out of the inverter to show on an in-home display ; this is working well so far. I use the charge scheduler to buy power at the cheap Octopus flux rate and sell it at the peak rate.

What I would like to do is hook up the charge scheduler to a weather forecast so I can decide if there is likely to be sunlight in the morning and if not, top the battery up. The level of battery would be related to how sunny it is likely to be.

I've discovered though that the max SoC parameter is not available in the API - this is what I get from a /op/v0/device/scheduler/get call:

{
"endHour": 5,
"fdPwr": 0,
"minSocOnGrid": 10,
"workMode": "ForceCharge",
"fdSoc": 30,
"enable": 1,
"startHour": 2,
"startMinute": 27,
"endMinute": 0
},

In the web interface I see 70% MaxSoC(%) and that appears to be honoured if I look at the charge stats in the morning.

Is this a bug or a deliberate design choice? The rate that it charges appears to be non-linear so I can't easily just charge for, for example 30 minutes at 5kw and expect it to be 50% charged.

Many thanks,

A.

Re: Setting max charge via API

Posted: Fri Oct 04, 2024 9:23 am
by Dave Foster
No the MaxSoC parameter is not provided through the OpenAPI, there are quite a few useful parameters that are not available, 'solar generation' being the most obvious.

The operation of MaxSoC is a complex subject, on the old charge periods and H1 inverter it was always respected when charging from grid, on the newer inverters it very much depends on your firmware version.

Using the scheduler it never used to respect the inverters MaxSoC setting (to be honest I haven't checked recently), which is why they added maxSoC to the parameters the V2 app and website are capable of sending - unfortunately this setting isn't passed through the OpenAPI which is probably a good thing as you have to have the latest firmware on your inverter and not all inverter types (KH, H3,H3 Pro) support this.

For now it might be best to calculate the amount of charge needed based on latest solar forecasts before you set the schedule and set the timing based on your nominal charge rate (with a small buffer), or alternatively poll the api every 5 minutes checking SoC and terminate the schedule when it reaches your target SoC.

Edit: Just swapped messages with Al and he's going to request it from their product team - fingers crossed.

Re: Setting max charge via API

Posted: Mon Oct 07, 2024 5:32 pm
by suited-martin
Thanks for your help and for messaging Al - for now I think I'll take a rough stab at how much energy I might need (eg, zero, half, full) and set a timer. But having it as part of the API would be really cool.

Thanks again,

A.

Re: Setting max charge via API

Posted: Mon Oct 14, 2024 10:59 pm
by tony.matthews1
Charging via Open API for inverters that support setting Max SoC via a schedule is broken at the moment and will return Write Failure.

Hopefully, when Fox updates Open API, they will also fix this. More info here: https://github.com/TonyM1958/FoxESS-Clo ... -schedules

Code to set charging dynamically using charge times or schedules is available here: https://github.com/TonyM1958/FoxESS-Clo ... r-Notebook