Skip to content

Comments

Handle PHEV ignore codes for target SOC and scheduled charging#401

Merged
nanomad merged 1 commit intoSAIC-iSmart-API:developfrom
nanomad:fix/phev-ignore-codes
Feb 17, 2026
Merged

Handle PHEV ignore codes for target SOC and scheduled charging#401
nanomad merged 1 commit intoSAIC-iSmart-API:developfrom
nanomad:fix/phev-ignore-codes

Conversation

@nanomad
Copy link
Contributor

@nanomad nanomad commented Feb 17, 2026

Summary

  • PHEV vehicles (e.g. MG EHS) send 0 for target SOC (TargetBatteryCode.P_IGNORE) and scheduled charging mode (bmsReserCtrlDspCmd), which are not valid operational values
  • Filter out these zero values early in ChrgMgmtDataPublisher, consistent with how ChargeCurrentLimitCode.C_IGNORE is already handled for charge current limit
  • This prevents ValueError: Unknown target battery code: TargetBatteryCode.P_IGNORE crash and ValueError: 0 is not a valid ScheduledChargingMode error

Test plan

  • Added test for PHEV ignore values (target SOC = 0, scheduled charging mode = 0)
  • Verify with an actual MG EHS PHEV that charge status updates no longer crash

Fixes #379

PHEV vehicles (e.g. MG EHS) send 0 for target SOC (P_IGNORE) and
scheduled charging mode, which are not valid values. Filter these
out early, consistent with how C_IGNORE is already handled for
charge current limit.

Fixes SAIC-iSmart-API#379
@nanomad nanomad merged commit 5a38134 into SAIC-iSmart-API:develop Feb 17, 2026
2 checks passed
@nanomad nanomad deleted the fix/phev-ignore-codes branch February 17, 2026 22:49
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.

1 participant