Bug 425770 - Wrong icons displaying in weather widget based on time of day (time zone bug)
Summary: Wrong icons displaying in weather widget based on time of day (time zone bug)
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Weather widget (show other bugs)
Version: 5.19.4
Platform: openSUSE Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-25 07:30 UTC by David Goguen
Modified: 2025-02-25 17:47 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.3.3
Sentry Crash Report:


Attachments
Screenshot from 5.19.3, but issue occurs in 5.19.4 as well (1.21 MB, image/png)
2020-08-25 07:30 UTC, David Goguen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Goguen 2020-08-25 07:30:41 UTC
Created attachment 131163 [details]
Screenshot from 5.19.3, but issue occurs in 5.19.4 as well

SUMMARY

In the Plasma weather widget, the wrong weather icons are observed at the wrong times of day.

STEPS TO REPRODUCE
1. Add the default Plasma weather widget to a panel or your desktop.
2. Set the location to a Canadian city with the weather provider as Environment Canada.
3. Observe daytime icons at night, and nightime icons during the day.

OBSERVED RESULT

Moon and clouds at 2:30 in the afternoon. Bright and sunny at 2:30 in the morning.

EXPECTED RESULT

Icons should accurately reflect weather corresponding with the time of day.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE Tumbleweed
KDE Plasma Version: 5.19.4
KDE Frameworks Version: 5.73.0
Qt Version: 5.15.0
Comment 2 Chris Holland 2021-03-23 23:39:08 UTC
This bug was encountered again by a redditor:
https://www.reddit.com/r/kde/comments/mbqdee/how_to_fix_weather_widget_wrong_icon_at_night/

So this issue is really the "time" dataengine's solar calculations as there's reports of it affecting bbcomet, wettercom, and envcan.

We need to find out if the "weather" dataengine is entering the wrong solar "time" dataengine "source" name, or if the bug is really in the "time" dataengine's solar calculation code.

* https://invent.kde.org/plasma/plasma-workspace/-/blame/master/dataengines/weather/ions/envcan/ion_envcan.cpp#L733
* https://invent.kde.org/plasma/plasma-workspace/-/tree/master/dataengines/time

Install `plasma-sdk` to get the Plasma Engine Explorer app.

* Run `grep source= ~/.config/plasma-org.kde.plasma.desktop-appletsrc` to find out the weather "source name".
  * Eg: If grep says `source=envcan|weather|Toronto, ON` then your source name is `envcan|weather|Toronto, ON`.
* Select the "weather" dataengine.
* Enter your "Source name", then click "Request Source". The data should appear in the table at the bottom.
* Screenshot: https://i.imgur.com/yAyFdKi.png
* Copy the `Observation Timestamp`, `Latitude`, and `Longitude` values. You can select the "Value" cell and press `Ctrl+C`.
* The London timezone in the `Observation Timestamp=Tue Mar 23 23:00:00 2021 GMT` is the `GMT` at the end. For Toronto it was `Tue Mar 23 19:00:00 2021 UTC-04:00`, so the timezone code was `UTC-04:00`.

-----

Now we need to check the solar time data.

* Select the "time" dataengine.
* Enter something like this into the source name: `America/Toronto|Solar|Latitude=50|Longitude=50|DateTime=2021-03-23T19:06:00`
* https://i.imgur.com/19I0c8f.png
* Toronto: `UTC-04:00|Solar|Latitude=43.68|Longitude=79.63|DateTime=2021-03-23T19:00:00`
* https://i.imgur.com/uuLxib5.png
* Click "Request Source", then scroll down to the bottom to find the data.
* Jot down all that data.

Now we finally have all the data we need to solve the bug.
Comment 3 Bug Janitor Service 2025-02-25 14:21:05 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5260
Comment 4 Ismael Asensio 2025-02-25 15:51:15 UTC
Git commit a35caab675116c1154542266aebd7c2410570561 by Ismael Asensio.
Committed on 25/02/2025 at 14:08.
Pushed by iasensio into branch 'master'.

weather/envcan: Fix parsing of station coordinates

The station coordinates in the forecast xml results are in the form
of textual "64.52N", "105.23W". We were previously only using the
absolute value, which fails for most Canada points, as "W" has to be
interpreted as a negative longitude.

The station coordinates are not exposed currently in the applet, but
are used to calculate if the observation corresponds to day or night.
FIXED-IN: 6.3.3

M  +21   -3    dataengines/weather/ions/envcan/ion_envcan.cpp
M  +1    -0    dataengines/weather/ions/envcan/ion_envcan.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/a35caab675116c1154542266aebd7c2410570561
Comment 5 Ismael Asensio 2025-02-25 17:47:00 UTC
Git commit ced114433dfd4fd74728eef305013f342aeb91ae by Ismael Asensio.
Committed on 25/02/2025 at 17:22.
Pushed by iasensio into branch 'Plasma/6.3'.

weather/envcan: Fix parsing of station coordinates

The station coordinates in the forecast xml results are in the form
of textual "64.52N", "105.23W". We were previously only using the
absolute value, which fails for most Canada points, as "W" has to be
interpreted as a negative longitude.

The station coordinates are not exposed currently in the applet, but
are used to calculate if the observation corresponds to day or night.
FIXED-IN: 6.3.3

(cherry picked from commit a35caab675116c1154542266aebd7c2410570561)

M  +22   -3    dataengines/weather/ions/envcan/ion_envcan.cpp
M  +1    -0    dataengines/weather/ions/envcan/ion_envcan.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/ced114433dfd4fd74728eef305013f342aeb91ae