penguin-teal / gnome-openweather

A GNOME Shell extension to show the weather of any location on Earth.
GNU General Public License v3.0
52 stars 17 forks source link

Visual Crossing Gets Night/Day Icons and Sunrise/Sunset Wrong #72

Closed dsheeler closed 1 month ago

dsheeler commented 2 months ago

Description

When I use Visual Crossing weather provider, the night time icons are displayed in daytime and vice versa, and the sunrise time and icon is shown during the daytime (and possibly at night, too when it is correct). I don't have this issue with any other provider.

System

I use archlinux, btw

Settings

{"app-version":"138","git-version":"138.r0.g6367a11","gnome-version":"46.3.1","user-locale":"en","unit":"'fahrenheit'","custom-keys":["","","<REDACTED>"],"appid":"<REDACTED>","actual-city":"0","prefs-default-width":"1361","weather-provider":"'visualcrossing'","hi-contrast":"'none'","sun-in-panel-first":"true","has-run":"true","days-forecast":"3","refresh-interval-current":"960","prefs-default-height":"600","locs":[{},{}],"center-forecast":"true","expand-forecast":"false","show-sunsetrise-in-panel":"true","last-init-error":"'(2024/05/11) TypeError: settings.set_value is not a function'","my-loc-prov":"'geoclue'","weatherapidotcom-key":"<REDACTED>","simplify-degrees":"true","position-index":"1","show-comment-in-forecast":"true","use-system-icons":"true","wind-direction":"true","geolocation-appid-mapquest":"<REDACTED>","pressure-unit":"'inHg'","disable-forecast":"false","clock-format":"'24h'","refresh-interval-forecast":"3600","loc-refresh-interval":"10.0","menu-alignment":"71.0","position-in-panel":"'center'","wind-speed-unit":"'mph'","show-comment-in-panel":"true"}
MaranhaoTRT22 commented 2 months ago

I have the same problem. I'm on Ubuntu 24.04 LTS and using Visual Crossing as a provider!

DerekfraeEdinburgh commented 2 months ago

Same problem here (also on Ubuntu 24.04).

I've contacted Visual Crossing, who require more information on the API query before they can ascertain if the problem lies with them...

visualcrossing commented 2 months ago

Hi there

We did a quick code review to see if we could help. The one item we did see is the following - 'isnight' appears to be reversed in //src/getweather.js line 1083 getIconName(WeatherProvider.VISUALCROSSING, h.icon, !h.icon.endsWith("-night"), true),

'getIconName' appears to expect the third parameter to be true if the icon is detected to be night. The above code suggests that isNight will be true when the icon name does not include night rather then when it does.

For more information on the Visual Crossing icons, please see https://www.visualcrossing.com/resources/documentation/weather-api/defining-icon-set-in-the-weather-api/ Note that there is an optional parameter to return an expanded list of icons. We are also currently intending to include an optional 'isNight' property in the response in a future release.

Regards Visual Crossing Support

dsheeler commented 2 months ago

There's another call that needs the same fix at 1106. I'm working on a patch rn.

I'm not sure why the sunrise / sunset thing is off, yet.

dsheeler commented 2 months ago

I submitted a pull request with the fix for the day/night flip. The fix is available here on my fork https://github.com/dsheeler/gnome-openweather on this branch https://github.com/dsheeler/gnome-openweather/tree/fix-day-night-weather-icons-visual-crossing.

penguin-teal commented 1 month ago

Fixed in #73 by dsheeler