Detect trip start/end in GPS handler, not just watchdog #249
Merged
Conversation
The GPS handler updated _last_derived_is_moving on state changes but did not trigger _end_driving_session or _anchor_driving_session. The watchdog (every 30s) had that logic but never saw the transition because the GPS handler already consumed it by updating the cache. This caused merged trips when the MQTT GPS burst arrived after 2+ min of parking (True->False caught by GPS handler, watchdog saw False==False). Now both paths trigger trip start/end, and the watchdog remains as fallback for GPS-stale transitions between data updates.
3 tasks
avgAuxPower is unreliable (static value, only via API polls, never during drives), so aux subtraction always contributed zero energy. Simplifies learning and prediction to pure distance-based consumption. Charging path aux tracking in soc_prediction.py is unaffected.
Contributor
Author
|
Last commit remove the useless auxpower which never seems to be right. |
Extract SOC wiring, device info, and housekeeping into separate files. Coordinator keeps thin delegates to preserve its public API. New files: - soc_wiring.py: SOC/charging/driving prediction wiring (~675 lines) - device_info.py: metadata building, BEV detection, state restoration (~214 lines) - coordinator_housekeeping.py: diagnostics, cleanup, connection events (~269 lines)
Add module table showing the codebase structure after the coordinator refactoring. Fix "Extrapolated SOC" references to "Predicted SOC".
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.
The GPS handler updated _last_derived_is_moving on state changes but
did not trigger _end_driving_session or _anchor_driving_session. The
watchdog (every 30s) had that logic but never saw the transition because
the GPS handler already consumed it by updating the cache. This caused
merged trips when the MQTT GPS burst arrived after 2+ min of parking
(True->False caught by GPS handler, watchdog saw False==False).
Now both paths trigger trip start/end, and the watchdog remains as
fallback for GPS-stale transitions between data updates.