diff --git a/meshai/adapter_config/defaults.py b/meshai/adapter_config/defaults.py index e5ada38..4157a0d 100644 --- a/meshai/adapter_config/defaults.py +++ b/meshai/adapter_config/defaults.py @@ -571,6 +571,11 @@ REGISTRY: dict[tuple[str, str], dict[str, Any]] = { "type": "int", "description": "Allow re-broadcast of the same CAP id after this many seconds (the nws_handler relaxes its dedup gate past this point and uses an Active: prefix).", }, + ("nws", "locations_max_chars"): { + "default": 120, + "type": "int", + "description": "Maximum characters for the locations field on line 4 of NWS wire. Truncates at word boundary.", + }, # ================================================================= # AVALANCHE -- 1 setting (min danger level broadcast floor) diff --git a/meshai/central/nws_handler.py b/meshai/central/nws_handler.py index e541327..6fbd956 100644 --- a/meshai/central/nws_handler.py +++ b/meshai/central/nws_handler.py @@ -384,8 +384,12 @@ def _render(*, event_type, area_desc, geocoder_city, county, state, compass, speed_mph = _parse_motion(params) motion = f"Moving {compass} {speed_mph} mph" if compass and speed_mph else "" locations = (desc.get("locations") or "").rstrip("., ") - if len(locations) > 40: - locations = locations[:37] + "..." + _loc_limit = int(adapter_config.nws.locations_max_chars) + if len(locations) > _loc_limit: + cut = locations[:_loc_limit].rsplit(" ", 1)[0] + if not cut: + cut = locations[:_loc_limit] + locations = cut + "\u2026" if motion and locations: line4 = f"{motion} — {locations}" elif motion: