CAP Alerts: an event-driven approach to severe weather and hazard alerts (v0.6.1)

cap_alerts v0.2.0 is out

v0.2.0 shipped on 30 July, the first feature release since 0.1.1. It’s also the first one I promoted on the strength of reports from other people’s installs rather than my own testing.

:link: Release v0.2.0 · seevee/cap_alerts · GitHub

ECCC alerts now arrive in real time

Canadian alerts are ingested over NAAD’s TCP streaming feed the moment they’re issued, instead of waiting up to five minutes for the next poll. The NAADS user guide names streaming as the intended channel for automated systems running around the clock.

It’s on by default for ECCC entries. GeoRSS polling is kept as startup and reconnect backfill, plus a 30-minute safety resync, with a heartbeat watchdog and exponential backoff. Reconnect backfills are floored at the old poll cadence, so a flapping socket can’t generate more traffic than plain polling did. A new diagnostic entity, binary_sensor.cap_alerts_eccc_real_time_stream, reports whether the socket is up. If you’d rather not stream, turning it off falls back to the old behaviour.

The sanctioned Canadian feed is dropping live alerts

While migrating ECCC to alertready.ca ahead of the legacy endpoint’s retirement, live soaking showed that host persistently omitting in-effect Actual/Public alerts that were present on the legacy Pelmorex host at the same moment. One of them was at severity=Extreme.

This isn’t propagation lag. Individual alerts stayed missing across hours of consecutive samples, and the set of missing alerts changed from one minute to the next.

I’ve had a sampler running since the release, and every sample so far has shown a gap. Dozens of distinct alerts are absent, mostly severe thunderstorm and heat or air quality warnings. Some of the missing ones are alerts that have ended, so affected users would miss the all-clear as well as the alert itself. It’s reported upstream and acknowledged, with no fix yet.

The mitigation is in 0.2.0. The default auto feed source now fetches both hosts and unions their entries by CAP OID, so neither host’s gaps can hide an alert from you. If you’re in Canada and running this, you’re already covered, and there’s nothing you need to do.

Also in this release

  • Ended alerts no longer linger. ECCC publishes one <info> block per area group, each with its own status. The provider was reading the wrong block and never saw the termination signal, so alerts hung around until their expiry time. Entities now clear when the alert actually ends.
  • Truncated feed downloads no longer lose a poll’s alerts. The ~7 MB chunked feed arrives without a Content-Length, so an early-terminated stream produced a partial body that failed to parse at a random offset. Incomplete documents are now detected and retried.
  • Device-tracker location for every provider. ECCC, MeteoAlarm and WMO gained the GPS-tracker mode NWS already had. MeteoAlarm also gets a fully mobile mode: a tracker for polygon narrowing plus a country-source entity, so crossing a border re-resolves which national feed to query.
  • MeteoFrance entity churn is fixed. It embeds the issue timestamp in its CAP identifier, so every re-issue of a warning was minting a new entity and orphaning a stale one.
  • A refresh button. button.cap_alerts_<provider>_refresh, diagnostic, forces an off-cycle fetch on any provider.
  • Opt-in marine filter and typed multi-scheme geocodes (geocodes["EMMA_ID"], ["NUTS3"], ["WARNCELLID"] and so on) for feeds that mix coding schemes across countries.

:warning: One breaking change

MeteoAlarm area codes have moved. EMMA_ID values were previously written into geocode_same, an NWS-scheme field they never belonged in. They now live under geocodes["EMMA_ID"]. If you have templates or card config reading geocode_same on MeteoAlarm entities, they need updating. NWS and ECCC entities are unaffected.

Otherwise no reconfiguration is required. Existing entries pick up streaming, the auto feed source and the fixes on restart, and the marine filter stays off unless you turn it on. New options are under Settings → Devices & Services → CAP Alerts → Configure.

@OvalZyre

Your missing NWS alert back in June never got a resolution, and I want to be straight that nothing in this release specifically targets an NWS-side gap. The coverage problem above is Canadian, and I have no evidence of an equivalent one on the NWS feed.

Two things should make the next occurrence easier to pin down, though. The refresh button lets you force an off-cycle fetch as soon as you notice something missing. If the alert shows up right after a manual refresh, that’s a very different bug from one where it never appears at all, and knowing which would tell me where to look. The truncated-download fix is also a plausible candidate for your symptom, since it produced polls that silently returned nothing usable, though I can’t confirm that’s what you hit.

Still looking for testers

The ask is the same as the original post, but I can be more specific about where it would help most. Canada is the obvious one, since the streaming work and the union fix were built for that specific case. Europe is the other, because the next release is a MeteoAlarm-focused pass and this is the point where your edge cases can still shape it. And if the WMO feed is your only coverage, that path gets the least live exercise of the four (though will also be getting some attention in the next release).

Bugs are better on GitHub than in the thread, since I watch issues much more reliably when I’m actively fixing things:

Thanks to everyone who’s been running this. The reports coming back are what made the 0.2.0 promotion decision possible.