Community. Driven. Weather. Data.Always Ad-FreeDeveloper FriendlyChecking statusDiscord
Become a supporter
Sign in
DocsDevelopersHow-to guide

Merge lightning history with the live feed

Load recent strikes from the REST route, then carry on from your MQTT feed without drawing any flash twice.


Your MQTT lightning feed keeps nothing and replays nothing, so a client that has just connected has no strikes from before it did. GET /lightning/flashes reads the last hours back. The time to the millisecond and the position to four decimals identify a flash in both, so one heard live and the same one read from the route match exactly.

  1. Start your MQTT client and subscribe first, so nothing falls in the gap.
  2. Load the history from the REST route for the box you care about.
  3. Key a set on t_ms,lat,lon (for a live strike, t as epoch milliseconds with its lat and lon) and put every historical flash in it.
  4. For each live strike, skip it if its key is already in the set, and add it if not.
  5. Fade flashes on t_ms, not on when you received them.

View this page as Markdown

May we use Microsoft Clarity to see how pages are used (clicks, scrolling and replays of a visit, with anything you type hidden), plus a random ID linking that to crash reports? Only to find bugs and confusing screens. Never advertising, never sold.