fix(pskr): require both ends in CONUS for MQTT subscriptions
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.
This commit is contained in:
parent
b924cc2fc2
commit
a1f561dfb8
1 changed files with 9 additions and 12 deletions
|
|
@ -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/<band>/<mode>/<sc>/<rc>/<sl>/<rl>/<sa>/<ra>
|
||||
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 ----------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue