diff --git a/meshai/adapter_config/defaults.py b/meshai/adapter_config/defaults.py index 32678db..0947d0b 100644 --- a/meshai/adapter_config/defaults.py +++ b/meshai/adapter_config/defaults.py @@ -180,6 +180,11 @@ REGISTRY: dict[tuple[str, str], dict[str, Any]] = { "type": "bool", "description": "Drop envelopes whose time_validity != 'present'.", }, + ("tomtom_incidents", "min_magnitude"): { + "default": 4, + "type": "int", + "description": "Minimum TomTom magnitude_of_delay to broadcast (1=minor, 2=moderate, 3=major, 4=severe). Anything below this is silently dropped.", + }, # ================================================================= # STATE_511_ATIS -- 1 setting (states to skip in favor of itd_511) diff --git a/meshai/central/incident_handler.py b/meshai/central/incident_handler.py index d24d8f9..4e57928 100644 --- a/meshai/central/incident_handler.py +++ b/meshai/central/incident_handler.py @@ -272,10 +272,10 @@ def _parse_tomtom_incident(envelope: dict, now: int) -> Optional[dict]: inner = envelope.get("data") or {} d = inner.get("data") or {} - # FILTER §6: magnitude_of_delay == 0 -> drop at handler entrance. - # v0.6-3b: gated by adapter_config.tomtom_incidents.drop_zero_magnitude. + # Drop events below configured minimum magnitude. magnitude = d.get("magnitude_of_delay") - if magnitude == 0 and bool(adapter_config.tomtom_incidents.drop_zero_magnitude): + min_mag = int(adapter_config.tomtom_incidents.min_magnitude or 4) + if magnitude is not None and magnitude < min_mag: return None # FILTER §4: time_validity != 'present' -> drop past/future.