Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 54 additions & 29 deletions internal/api/daylog/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@
//
// # Taxonomy
//
// Every event carries {id, ts, type, layer, vehicle_id, ref_kind,
// ref_id, payload}. Timestamps are UTC (RFC3339); ts values are the
// source row's event time, never synthesised. Titles are NOT served
// by this API: the frontend localises by type so i18n stays complete.
// Every event carries {id, ts, type, layer, vehicle_id, source,
// ref_kind, ref_id, payload}. Timestamps are UTC (RFC3339); ts values
// are the source row's event time, never synthesised. Titles are NOT
// served by this API: the frontend localises by type so i18n stays
// complete. Transitions report previous → new in payload from/to;
// absent states are omitted, never invented.
//
// The default view is the COMPLETE history: an omitted ?layers=
// enables every optional layer. An explicit CSV narrows to a subset.
//
// Default layer (always on):
//
Expand All @@ -19,32 +24,48 @@
// charge_start charging_sessions started_at start_place, start_soc_pct /charging/:id
// charge_end charging_sessions ended_at energy_added_wh, duration_s, /charging/:id
// end_soc_pct
// parked fsm_transitions ts from_state —
// online fsm_transitions ts from_state —
// asleep fsm_transitions ts from_state —
// offline fsm_transitions ts from_state —
// state_change fsm_transitions ts from_state, to_state (unknown target) —
// locked security_events ts (locked=true) — —
// unlocked security_events ts (locked=false)— —
// lock_unknown security_events ts state (unparseable to_state) —
// sentry_on security_events ts state (proto token, e.g. Armed) —
// sentry_off security_events ts state (Off/Unknown token) —
// sentry_unknown security_events ts state (missing to_state) —
// remote_start_on signal_log ts — —
// remote_start_off signal_log ts — —
// parked fsm_transitions ts from, to —
// online fsm_transitions ts from, to —
// asleep fsm_transitions ts from, to —
// offline fsm_transitions ts from, to —
// state_change fsm_transitions ts from, to (unknown target) —
// locked security_events ts (locked=true) from, to (bool) —
// unlocked security_events ts (locked=false) from, to (bool) —
// lock_unknown security_events ts from, to (raw) —
// sentry_on security_events ts from, to (full proto tokens) —
// sentry_off security_events ts from, to (full proto tokens) —
// sentry_unknown security_events ts from, to (raw) —
// valet_on/off security_events ts from, to (bool) —
// security security_events ts event_type, from, to (unrecognized) —
// remote_start_on signal_log ts from, to (bool) —
// remote_start_off signal_log ts from, to (bool) —
// sw_update software_updates created_at version, status —
// sw_update_installed software_updates installed_at version —
//
// Optional layers (off by default, enabled via ?layers=):
// Optional layers (on by default; narrowed via ?layers=):
//
// layer type(s) signal field(s)
// turn_signals turn_signal {component, from, to, from/to_value} LightsTurnSignal (direction IS in the enum)
// lights hazards_on/off, high_beams_on/off {from, to} LightsHazardsActive, LightsHighBeams
// doors_windows door_open/closed {door, from, to}, DoorState* (bool), Fd/Fp/Rd/RpWindow
// window {window, from, to, from/to_value} (WindowState enum)
// hvac hvac_on/off {from, to, from/to_value} HvacPower (HvacPowerState enum, not watts)
// gear gear {from, to, from/to_raw} drive_telemetry.gear ("ShiftStateD"/"D")
// homelink homelink_nearby_on/off, arrived/left_{home, HomelinkNearby, LocatedAtHome,
// work,favorite} {from, to} LocatedAtWork, LocatedAtFavorite
//
// Unmapped signal fields surface as generic signal events
// {field, from, to} on the layer that queried them.
//
// # Enum display labels
//
// layer type(s) signal field(s)
// turn_signals turn_signal {value} LightsTurnSignal (enum number, no label map)
// lights hazards_on/off, high_beams_on/off LightsHazardsActive, LightsHighBeams
// doors_windows door_open/closed {door}, window {window, value} DoorState*, Fd/Fp/Rd/RpWindow
// hvac hvac_on {power_w} / hvac_off HvacPower (on = watts != 0)
// gear gear {gear} drive_telemetry.gear (P/R/N/D)
// homelink homelink_nearby_on/off, arrived/left_{home, HomelinkNearby, LocatedAtHome,
// work,favorite} LocatedAtWork, LocatedAtFavorite
// signal_log stores proto enum NUMBERS. The timeline labels them with
// read-side display maps (turnSignalShort, windowShort, hvacShort,
// gearShortForm) that cite their generated sources
// (internal/tesla/protomodel/enum_parsers_gen.go + the proto). These
// maps do not import proto bindings and do not re-run the codec's
// prefix-trim; the parity test asserts every entry against the
// generated String() output. Unknown numbers render raw, never guessed.
//
// # Source-of-truth decisions
//
Expand All @@ -65,10 +86,14 @@
// scope and intentionally not mapped.
// - Summary sums skip NULL measures; a sum with zero contributors is
// null (unknown), never a fake 0 — except that counts are exact.
// - Previous states come from stored data only: the prior row of the
// same series (in-window chain seeded by a pre-window lookup for
// security_events, whose writer leaves from_state NULL).
//
// # Bounds
//
// Output is hard-capped at dayLogEventCap events (truncated=true when
// over). signal_log and drive_telemetry inputs are fetched with LIMITs;
// hitting an input cap also sets truncated because edges may be lost.
// Events page with limit (default 500, max 2000) + offset;
// total_events counts every assembled event so callers page until
// complete. truncated=true reports data LOSS (a signal/gear input cap
// was hit), never paging: a partial page is not truncation.
package daylog
Loading
Loading