summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorWolfgang Müller2024-10-19 20:02:26 +0200
committerWolfgang Müller2024-10-19 20:02:26 +0200
commit25c1160413904c433a11ded395810eeb75685cfe (patch)
tree3997a391394c0924bc016d2874cb7758f36b983b
parentb3a4d3a564511b64cb90aecbe939a53aac1b8171 (diff)
downloadzunzuncito-25c1160413904c433a11ded395810eeb75685cfe.tar.gz
content: Add post: "Night-time icons for Plasma's DWD backend"
-rw-r--r--content/26/icon-day.pngbin0 -> 31082 bytes
-rw-r--r--content/26/icon-night.pngbin0 -> 25542 bytes
-rw-r--r--content/26/index.md67
3 files changed, 67 insertions, 0 deletions
diff --git a/content/26/icon-day.png b/content/26/icon-day.png
new file mode 100644
index 0000000..494e5b2
--- /dev/null
+++ b/content/26/icon-day.png
Binary files differ
diff --git a/content/26/icon-night.png b/content/26/icon-night.png
new file mode 100644
index 0000000..ffd6d35
--- /dev/null
+++ b/content/26/icon-night.png
Binary files differ
diff --git a/content/26/index.md b/content/26/index.md
new file mode 100644
index 0000000..8e44308
--- /dev/null
+++ b/content/26/index.md
@@ -0,0 +1,67 @@
++++
+date = 2024-10-19T20:02:17+02:00
+title = "Night-time icons for Plasma's DWD backend"
+
+[taxonomies]
+tags = ["kde"]
+
+[extra]
+related = []
++++
+
+For a couple of weeks now I have been using Plasma's built-in weather report
+system. It supports various different sources for weather observations and
+forecasts, one of which is my preferred service, [Deutscher
+Wetterdienst](https://www.dwd.de) (DWD). Once the report location is set up, Plasma
+displays the current conditions in the tray - clicking on it gives you an
+overview of the next 7 days.
+
+I've been quite pleased with this; a quick glance at the icon tells you
+everything you need to know and the forecast is only one click away. It even
+supports DWD's official warning system. There is one small problem with the tray
+icon, however. See if you can spot it:
+
+{{ img(path="icon-day.png", format="png", alt="A screenshot of Plasma's tray
+showing a clipboard icon, a media control icon, and a weather icon. The weather
+icon is displaying a sun with few clouds in front. The tray is also showing the
+time. It is 23:57.", caption="Something's not quite right...") }}
+
+That's right, I couldn't have possibly taken this image given this post's
+timestamp is before 23:57! Good catch. More importantly, however, the icon is
+showing the sun when realistically it's going to be dark outside. This has been
+annoying me to no end, so a couple of days ago I decided to fix it.
+
+Since Plasma already comes with weather icons suited for night-time use, I
+really only needed a reliable way to tell when to switch to those. After some
+spelunking in DWD's [two](https://dwd.api.bund.dev/)
+[APIs](https://listed.to/@DieSieben/7851/api-des-deutschen-wetterdienstes), I
+found that the latter contains sunrise and sunset times for its forecast
+endpoint. The weather report system was already using this endpoint to fetch
+forecast data, so it was a rather simple lookup of two values in the API and
+then comparing the current observation time to those.
+
+So, after some preparatory work to make date parsing more robust, I sent a
+[merge
+request](https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4848)
+upstream which was promptly approved and merged. Finally I could rest easy after
+dusk, not having to worry about a sun chasing me around.
+
+{{ img(path="icon-night.png", format="png", alt="A screenshot of Plasma's tray
+showing a clipboard icon, a media control icon, and a weather icon. The weather
+icon is displaying a crescent moon with few clouds in front. The tray is also
+showing the time. It is 18:57.", caption="... much better!") }}
+
+There's some more stuff that could be improved in the DWD backend, like station
+availability. As far as I can tell, when using the open API, DWD limits access
+to weather data depending on whether or not they have the full rights to it. The
+API might therefore simply deny access to a station even though it is listed in
+in [the official index](https://www.dwd.de/DE/leistungen/klimadatendeutschland/statliste/statlex_html.html?view=nasPublication&nn=16102).
+There's no way to find out which station is accessible except to try them all.
+To get around this, the DWD backend uses a [very simple
+heuristic](https://invent.kde.org/plasma/plasma-workspace/-/blob/69a52cd6fbde80b087f59a633b4ff216c27ddff0/dataengines/weather/ions/dwd/ion_dwd.cpp#L396-403)
+based on the first digit of the station ID, since all stations starting with 0
+or 1 seem to work. However, this ignores a number of other, still accessible,
+stations.
+
+I'm planning to look into this further, hopefully finding a better solution so
+that users of the DWD backend have access to as many stations as possible.