Skip to content

Comments

fix: preserve meaningful stop reasons for battery heating and charging#404

Merged
nanomad merged 1 commit intoSAIC-iSmart-API:developfrom
nanomad:fix/396-preserve-stop-reasons
Feb 19, 2026
Merged

fix: preserve meaningful stop reasons for battery heating and charging#404
nanomad merged 1 commit intoSAIC-iSmart-API:developfrom
nanomad:fix/396-preserve-stop-reasons

Conversation

@nanomad
Copy link
Contributor

@nanomad nanomad commented Feb 17, 2026

Summary

Fixes #396. The API resets bmsPTCHeatResp and bmsChrgSpRsn back to 0 (NO_REASON) quickly after heating/charging stops. Since the gateway polls periodically, the next poll overwrites the meaningful stop reason (e.g. REACHED_STOP_TIME, UNNECESSARY) with NO_REASON.

Adds a validator to skip publishing when the stop reason is NO_REASON, so the last meaningful value is preserved as a retained MQTT message. Applies to both:

  • drivetrain/batteryHeatingStopReason (HeatingStopReason.NO_REASON)
  • drivetrain/chargingStopReason (ChargingStopReason.NO_REASON)

The binary sensors for battery heating and charging status already indicate whether the process is currently active, so NO_REASON carries no useful information.

Test plan

  • All 67 tests pass
  • ruff lint clean
  • Verify that a meaningful stop reason (e.g. REACHED_STOP_TIME) survives across subsequent polls
  • Verify that stop reasons from command responses (ChrgPtcHeatResp) are still published correctly (separate code path, unchanged)

🤖 Generated with Claude Code

SAIC-iSmart-API#396)

The API resets bmsPTCHeatResp and bmsChrgSpRsn back to 0 (NO_REASON)
quickly after heating/charging stops. Since the gateway polls periodically,
the next poll overwrites the meaningful stop reason with NO_REASON.

Skip publishing when the stop reason is NO_REASON so the last meaningful
value is preserved as a retained MQTT message. The binary sensors for
battery heating and charging status already indicate whether the process
is currently active.
@nanomad nanomad merged commit 4b2f552 into SAIC-iSmart-API:develop Feb 19, 2026
2 checks passed
@nanomad nanomad deleted the fix/396-preserve-stop-reasons branch February 19, 2026 16:25
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