From a1f561dfb856669586558e3a65cd8513a651f89e Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Mon, 4 May 2026 13:07:45 -0500 Subject: [PATCH] fix(pskr): require both ends in CONUS for MQTT subscriptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pin both the sender and receiver DXCC slots to 291 so the broker only forwards CONUS↔CONUS spots. The previous two-topic-per-band filter (sender_us OR receiver_us) was leaking US↔CA paths through the receiver-side wildcard, and the project doesn't have NWP coverage for the non-US end yet. When HRDPS lights up we'll add a Canada-anchored topic alongside. --- lib/microwaveprop/pskr/client.ex | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/microwaveprop/pskr/client.ex b/lib/microwaveprop/pskr/client.ex index e06d00cf..50bdd053 100644 --- a/lib/microwaveprop/pskr/client.ex +++ b/lib/microwaveprop/pskr/client.ex @@ -5,11 +5,11 @@ defmodule Microwaveprop.Pskr.Client do Connects to `mqtt.pskreporter.info:1883` over plain TCP (the broker doesn't expose TLS), subscribes to a curated set of topics, and forwards every PUBLISH payload to - `Pskr.Aggregator.ingest/2`. Each topic anchors on USA (DXCC 291) - on either the sender or receiver side so the broker pre-filters - out the bulk of the firehose before it reaches us — the - alternative would be subscribing to `pskr/filter/v2/#` and - dropping ~95% client-side. + `Pskr.Aggregator.ingest/2`. Each topic anchors **both** ends on + USA (DXCC 291) so we only ingest CONUS-to-CONUS paths — that's + the only path geometry where both endpoints sit inside HRRR + coverage. When HRDPS lights up we'll add a Canada-anchored + topic alongside. ## No external MQTT library @@ -238,18 +238,15 @@ defmodule Microwaveprop.Pskr.Client do end defp subscribe_packet(bands) do - topics = - Enum.flat_map(bands, fn band -> - [{topic_for(band, :sender_us), 0}, {topic_for(band, :receiver_us), 0}] - end) - + topics = Enum.map(bands, fn band -> {topic_for(band), 0} end) Mqtt.subscribe(1, topics) end # Topic order (from the broker's landing page): # pskr/filter/v2//////// - defp topic_for(band, :sender_us), do: "pskr/filter/v2/#{band}/+/+/+/+/+/#{@us_dxcc}/+" - defp topic_for(band, :receiver_us), do: "pskr/filter/v2/#{band}/+/+/+/+/+/+/#{@us_dxcc}" + # Both DXCC slots pinned to USA so the broker drops US↔CA, US↔EU, + # etc. before the spots ever reach us. + defp topic_for(band), do: "pskr/filter/v2/#{band}/+/+/+/+/+/#{@us_dxcc}/#{@us_dxcc}" # ---------- Inbound dispatch ----------