-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Weather API Location Issue #1142
Labels
🐛 Bug
[ISSUE] Ticket describing something that isn't working
Comments
If you're enjoying Dashy, consider dropping us a ⭐ |
This issue has gone 6 weeks without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. Otherwise it will be closed in 5 working days. |
This issue was automatically closed because it has been stalled for over 6 weeks with no activity. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
Self-Hosted (Docker)
System
No response
Version
2.1.1
Describe the problem
The api call to OpenWeather does not use the correct syntax to supply the location. For me, this causes an issue because apparently my town name is common to the United States and the correct weather data isn't returned by OpenWeather with the current query used in the weather widget code.
Looking at the OpenWeather api doc here, the expected syntax of a weather call is:
https://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={API key}
Instead, the current widget code uses:
{widgetApiEndpoints.weather}?q=${city}&appid=${apiKey}&units=${this.units}
, which effectively ends up looking like this:https://api.openweathermap.org/data/2.5/weather?q={City}&appid={API key}
The key difference between the two being how the city information is supplied. The current widget code supplies it as a place name, where the official api doc requires the city latitude & longitude. The call still technically works as the widget code currently implements it, but it does not always return the expected location.
In the "city" field of the widget options I've tried listing just the city (ex. New York), city + country (ex. New York, US), city + state + country (ex. New York, NY, US), and even the city code used by OpenWeather (note: I'm just using New York city as an example to show the formatting I'm using to enter the city name). In the end, it doesn't appear to matter how I list it, I still end up with a different result each time.
Can the widget be updated to give the user the option to supply the location lat & lon instead of just a city name? If not, it seems that the appropriate usage of the OpenWeather APIs requires that, if a city name is supplied, a call is first made using the geocode api which would then return the lat & lon for use with the weather data api call.
Additional info
No response
Please tick the boxes
The text was updated successfully, but these errors were encountered: