Setting max charge via API

Post Reply
suited-martin
Posts: 2
Joined: Fri Oct 04, 2024 8:57 am

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.
Dave Foster
Posts: 1246
Joined: Thu Oct 13, 2022 7:21 pm

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.
suited-martin
Posts: 2
Joined: Fri Oct 04, 2024 8:57 am

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.
tony.matthews1
Posts: 14
Joined: Sun Mar 19, 2023 4:37 pm

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
H1-6.0-E hybrid inverter
6 x HV2600 v2 batteries
16 x JA Solar 405w panels
7 x Tigo TS4-A-O optimisers
Post Reply