Add wind and short-term forecast to the SMHI weather command - #91
Open
mosbth wants to merge 15 commits into
Open
Add wind and short-term forecast to the SMHI weather command#91mosbth wants to merge 15 commits into
mosbth wants to merge 15 commits into
Conversation
Fetches wind direction/speed (SMHI metobs parameters 3/4) alongside the existing temperature and present-weather observation, and appends a short forecast for the coming hours using SMHI's new snow1g point forecast API (the old pmp3g forecast API was shut down 2026-03-31). Also drops the "Inget signifikant väder observerat" sentence from the output since it never added information - the observation sentence is now only shown when there's an actual, meaningful observation.
Each forecast step now shows a local (Europe/Stockholm) clock time and wind direction/speed, instead of just temperature and weather symbol. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
Drop "vind"/"från" from each step ("2.6 m/s N" instead of "vind 2.6
m/s från N") to reduce the length of an already data-dense line.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
Trim redundant words ("regnskurar" -> "skurar", "molnighet" ->
"molnväxling", drop trailing "regn" from sleet terms) so forecast
lines take up less space.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
The current weather line already only ever shows a single-moment observation, so "just nu" was redundant. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
Two well-spaced points give a better overview than three consecutive hours. Also drop "vind"/"från" from the current weather line's wind text, matching the shorter format already used in the forecast steps. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
A "→" between the current conditions and the forecast signals that what follows is upcoming weather, replacing the plain "." there. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
The commas between temperature/wind and symbol/wind didn't add anything, so drop them and rely on spacing alone. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
Drop the colon after "Karlskrona", the space before the degree sign, and the "C" in "°C" (Celsius is implied for a Swedish audience). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
N/NO/O/... become ↑/↗/→/... — a compact compass-rose arrow instead of a two-letter abbreviation. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
The "→" separator clashed visually with the compass arrows now used for wind direction (e.g. an actual east wind renders as "→" too), so switch back to the plain dash already used between forecast steps. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
A middle dot reads more cleanly than a plain dash and avoids any resemblance to a minus sign. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
Rename hours_ahead to step_indices since these are positions in the timeSeries list, not literal hour offsets. Build the Europe/Stockholm ZoneInfo once outside the loop instead of on every iteration. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
Owner
Author
|
Ser ut så här: |
The metobs "rådande väder" code only reports active precipitation/fog/ thunder, not general sky/cloud condition, so "klart"/"molnigt" etc. never showed up in the current-weather line. Reuse the forecast API's symbol for the nearest hour (time_series[0]) to fill that gap. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
uv run pytest— 61 passeduv run pylint irc2phpbb— 10.00/10Karlskrona 15.8° 1.0 m/s ↑ · 04:00 13.5° nästan klart 2.7 m/s ↖ · 08:00 14.7° klart 2.1 m/s ↖.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC