fix: reset shutdown grace period when significant charging stops#431
Merged
nanomad merged 2 commits intoSAIC-iSmart-API:developfrom Mar 13, 2026
Merged
Conversation
…C-iSmart-API#315) When is_charging transitions True→False, reset last_car_shutdown so the gateway enters the after_shutdown grace period and polls frequently to detect charger reconnection (e.g. after a 3-phase to 1-phase switch). Only trigger the reset if significant charging power (>1kW) was observed, to avoid oscillation from OBC trickle/maintenance draws that could keep the gateway polling indefinitely and drain the 12V battery. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When charging with insignificant power (<1kW, e.g. OBC trickle), set refresh_period_charging to at least refresh_period_after_shutdown (120s) to prevent falling through to the active polling rate (30s) indefinitely. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
58cbe2f to
4a6c27e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #315
is_chargingto a property that detects True→False transitions and resetslast_car_shutdown, triggering the after_shutdown grace period (~120s polling for ~600s)is_chargingtransition behavior, polling phase publishing, and the end-to-end charging-stop-to-grace-period flowRoot cause: When charging stopped (e.g. 3p→1p phase switch),
hv_battery_active_from_carwas already False (car parked), solast_car_shutdownwas never updated. The gateway skipped the after_shutdown grace period and fell straight to inactive (24h polling), missing the charger reconnection.Test plan
is_chargingTrue→False with significant power resetslast_car_shutdownis_chargingTrue→False without significant power does NOT resetafter_shutdownpolling phase🤖 Generated with Claude Code