Skip to content

History

Parsing of history ring-buffer records (C.O. 24569 / 24567). Controller.read_history() calls this internally.

pycomap.history.HistoryRecord dataclass

HistoryRecord(
    index: int,
    timestamp: datetime | None,
    engine_hours: timedelta | None,
    tenth_seconds: int,
    reason: str,
    prefix: str,
    level: int,
    is_text: bool,
    text: str,
    data: bytes,
)

One entry from the controller's history ring buffer (YOUNGEST_HISTORY_RECORD / OLDER_HISTORY_RECORD, C.O. 24569/24567).

For alarm events: reason is the value name that triggered the event (e.g. "Generator Voltage L1-N"), prefix is the protection type ("Wrn", "Sd", etc.), level encodes severity (1-3) or transition type (4=Start, 5=Stop).

For configuration-change events (is_text=True): text holds the human-readable description (e.g. "T=ETH CA1 A CON(24554)=21:25:08"); reason and prefix are usually empty.

timestamp is the controller's local time at the event (see read_datetime note about Summer Time Mode). engine_hours is set instead when the controller uses run-hours as the time reference (rare; RTC is the norm for IL3).

pycomap.history.parse_history_record

parse_history_record(
    config_data: bytes, record_data: bytes
) -> HistoryRecord | None

Parse one history record blob returned by YOUNGEST_HISTORY_RECORD / OLDER_HISTORY_RECORD (C.O. 24569/24567).

Returns None for invalid records (prefix_index=31 or unparseable timestamp). Pass the full raw ConfigurationTable blob as config_data — it is used to resolve reason and prefix names from the unified names heap.