Skip to content

fix(execute): leave the discharge rate alone while charging during a car hold (#5419) - #5470

Open
chalfontchubby wants to merge 1 commit into
mainfrom
fix/car-hold-charging-discharge-rate-5419
Open

chalfontchubby wants to merge 1 commit into
mainfrom
fix/car-hold-charging-discharge-rate-5419

Conversation

@chalfontchubby

Copy link
Copy Markdown
Collaborator

Posted by Claude on behalf of @chalfontchubby.

Closes #5419. Also fixes the house-battery half of #5467, which is the same fault on a GivEnergy Hybrid Gen 1.

What users see

On a night when the car charges, the house battery stays at its reserve for the whole cheap window. Predbat's status reads Charging, Hold for car, and the inverter has accepted every write: charge slot enabled, target 100%, charge rate 2600 W. The battery starts charging only after the car hold ends.

Cause

On an inverter without timed pause, "Hold for car" sets the battery discharge rate to 0 for the whole car slot (execute.py, the car-hold block in execute_plan). It does this even while the house battery is charging in a charge window. A charging battery cannot feed the car, so the write achieves nothing. On these GivEnergy hybrids, a discharge rate of 0 with the SoC on the reserve stops grid charging altogether.

The evidence comes from two installs:

Fix

While the inverter's own status is Charging, the hold now skips the rate write. It already skipped the reserve bump in this state (#3899). Instead it logs that the hold is deferred. Once charging stops (Hold charging, Demand), the rate and reserve hold apply as before.

The condition reads this inverter's status (status_per_inverter), not the fleet-wide status, which can carry over from an inverter processed earlier.

Inverters with timed pause are deliberately unchanged and still pause discharge during the charge. The pause is one latched write that blocks only discharge. It also covers the moments when the inverter reaches its target before Predbat sees it, and no report ties it to the charging fault.

Known limits (deliberately out of scope)

  • set_discharge_during_charge off (default on): on these inverters it still sets the rate to 0 for every charge window, so the same quirk could bite with no car involved. I have no report of that, so I've left it alone.
  • "Charging" is plan-derived:
    • With set_soc_enable off, the status stays "Charging" even after the inverter reaches its own target.
    • With it on, there is a gap of up to one execute cycle after the target is reached.
    • In both cases a battery above reserve can now feed the car until Predbat notices. Before this change, the rate of 0 covered those moments.
    • At the reserve (the reported case), the reserve floor still blocks discharge.
  • The , Hold for car status annotation stays while the hold is deferred, because the hold comes back as soon as charging stops. I'm happy to drop it if you'd rather the status show only holds actually applied.

How to check

  • ./run_all --test execute:
    • car_charge_no_reserve_ratchet now expects the maximum discharge rate while charging. On main it fails with Discharge rate should be 1000 got 0.
    • The new car_charge2_no_pause pins the rate hold still applying under Hold charging on an inverter without timed pause. It fails if the skip is widened to cover "Hold charging".
  • ./run_all --quick passes, and pre-commit passes.

🤖 Generated with Claude Code

…car hold (#5419)

"Hold for car" on an inverter without timed pause set the battery discharge
rate to 0 for the whole car slot, even while the house battery was charging
in a charge window. A charging battery cannot feed the car, so the write did
nothing useful - and some GivEnergy hybrids (GIV-HY3.6 / Gen 1 via GivTCP)
will not grid-charge at all with the discharge rate at 0 and the SoC on the
reserve. The battery then sat at reserve for the whole cheap window while
the status read "Charging, Hold for car" (#5419, #5467).

While the inverter's own status is "Charging", the hold now skips the rate
write, as it already skipped the reserve bump (#3899), and logs that it has
deferred. Once charging stops (Hold charging, Demand), both apply as before.
The test now reads this inverter's status rather than the fleet-wide one,
which can carry over from an earlier inverter. Inverters with timed pause
still pause discharge during the charge: it is one latched write that
blocks only discharge, and no report ties it to the charging fault.

Tests: car_charge_no_reserve_ratchet now expects the maximum rate while
charging (it failed on main with "Discharge rate should be 1000 got 0"), and
car_charge2_no_pause pins the rate hold still applying under Hold charging.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GivEnergy battery does not charge during "Charging, Hold for car" when SoC is at reserve (discharge rate 0)

1 participant