Hibernate on Approach

Protecting a battery-less SBC, powered from the same train inverter/socket circuit as the wifi router, from unclean power loss at GWML neutral sections (phase breaks), by proactively hibernating it before the train reaches a known dead zone. Grew out of an investigation into a stale Google Drive location export — see john/actions item 3 — which led to using the location-db database directly and discovering the train router's wifi power-loss pattern as a usable proxy signal.

Sub-pages

Design — the trigger loop, detection method, and self-tuning feedback loop

Data Sources — what data this relies on, and how good each source actually is

Findings — the 2026-07-13 return-journey analysis: confirmed matches, rejected candidates, and why

Considerations — uncertainty budget, why battery-less changes the requirement, disentangling outage-duration causes, the station-exclusion rule

Todo — next steps, ordered roughly by how much they'd reduce current uncertainty

Running — prerequisites, how to start, monitoring, stopping

Key facts

• Target device: battery-less SBC, no graceful low-power path — hibernate write must fully complete before power drops, not just start

• Position source: location-db locations table (PostgreSQL/PostGIS on gravlax), fed by OwnTracks via the loc endpoint

• Target coordinates: gazetteer table, source='gwml-neutral-sections' (5 documented points, web-sourced, approximate — currently ~2-3 km offset from observed evidence at the two points checked)

• Calibration/proxy signal: my own wifi router (SSID c13), powered from the train, loses power at neutral-section outages; the train's wifi itself does not drop. This router power-loss pattern is visible in the same locations table via the conn/ssid columns.

• Current status: two of five documented neutral sections confirmed against real evidence from a single trip; trigger radius provisionally set wide (~5 km) pending a real hibernate-write-time measurement and more trip data

Related

location-db — the underlying PostGIS database and gazetteer

OwnTracks — the HTTP receiver feeding location-db

john/actions — item 3, the stale Drive export investigation this project grew out of

Train-side validation: python3 -m unittest -q test_hibernate_on_approach.py passed (3 tests, OK). The live /home/john/bin/hibernate-on-approach.py is still the older hardcoded list and still contains Ruscombe / Twyford; the repo fix instead loads gazetteer rows and falls back to the Maidenhead candidate when the DB lookup fails. This is the current neutral-section protection status.

updated 2026-07-30