Skip to content

Comments

fix: filter unsupported SoC options for vehicles without target SoC#403

Merged
nanomad merged 1 commit intoSAIC-iSmart-API:developfrom
nanomad:fix/399-filter-unsupported-soc-options
Feb 19, 2026
Merged

fix: filter unsupported SoC options for vehicles without target SoC#403
nanomad merged 1 commit intoSAIC-iSmart-API:developfrom
nanomad:fix/399-filter-unsupported-soc-options

Conversation

@nanomad
Copy link
Contributor

@nanomad nanomad commented Feb 17, 2026

Summary

Fixes #399. Vehicles like MG4 Standard (LFP battery) support scheduled charging but not target SoC control. Previously the gateway offered UNTIL_CONFIGURED_SOC as a charging schedule mode and showed a disabled Target SoC slider that users could manually enable, leading to unsupported API calls.

Two-layer defense:

  • HA Discovery: Don't publish the Target SoC number entity at all (unpublish it) when the vehicle doesn't support target SoC; filter UNTIL_CONFIGURED_SOC from the scheduled charging mode options
  • Command handler guards: Reject target SoC changes and UNTIL_CONFIGURED_SOC schedule mode with RESULT_DO_NOTHING when unsupported

Test plan

  • All 73 existing + 6 new tests pass
  • ruff lint clean
  • Verify on a vehicle with supports_target_soc=True (NMC battery): Target SoC slider and all scheduled charging modes still available
  • Verify on a vehicle with supports_target_soc=False (LFP battery): Target SoC entity removed from HA, UNTIL_CONFIGURED_SOC not offered

🤖 Generated with Claude Code

…AIC-iSmart-API#399)

Vehicles like MG4 Standard (LFP battery) support scheduled charging but
not target SoC control. Previously the gateway offered UNTIL_CONFIGURED_SOC
as a charging schedule mode and showed a disabled Target SoC slider that
users could manually enable, leading to unsupported API calls.

Layer 1 — HA discovery:
- Don't publish the Target SoC number entity at all (unpublish it) when
  the vehicle doesn't support target SoC
- Filter UNTIL_CONFIGURED_SOC from the scheduled charging mode options

Layer 2 — Command handler guards:
- Reject target SoC changes with RESULT_DO_NOTHING
- Reject UNTIL_CONFIGURED_SOC schedule mode with RESULT_DO_NOTHING
@nanomad nanomad merged commit a5ef7dd into SAIC-iSmart-API:develop Feb 19, 2026
2 checks passed
@nanomad nanomad deleted the fix/399-filter-unsupported-soc-options branch February 19, 2026 16:21
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