Skip to content
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

Closed
5 tasks done
crazybob1215 opened this issue Mar 10, 2023 · 3 comments
Closed
5 tasks done

[BUG] Weather API Location Issue #1142

crazybob1215 opened this issue Mar 10, 2023 · 3 comments
Assignees
Labels
🐛 Bug [ISSUE] Ticket describing something that isn't working

Comments

@crazybob1215
Copy link

crazybob1215 commented Mar 10, 2023

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

@crazybob1215 crazybob1215 added the 🐛 Bug [ISSUE] Ticket describing something that isn't working label Mar 10, 2023
@liss-bot
Copy link
Collaborator

If you're enjoying Dashy, consider dropping us a ⭐
🤖 I'm a bot, and this message was automated

@crazybob1215 crazybob1215 changed the title [BUG] <title> [BUG] Weather API Location Issue Mar 10, 2023
@liss-bot
Copy link
Collaborator

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.

@liss-bot liss-bot added the ⚰️ Stale [ISSUE] [PR] No activity for over 1 month label Apr 10, 2023
@liss-bot
Copy link
Collaborator

This issue was automatically closed because it has been stalled for over 6 weeks with no activity.

@liss-bot liss-bot removed the ⚰️ Stale [ISSUE] [PR] No activity for over 1 month label Apr 15, 2023
@Lissy93 Lissy93 reopened this Dec 31, 2023
@Lissy93 Lissy93 mentioned this issue Dec 31, 2023
6 tasks
@Lissy93 Lissy93 closed this as completed Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug [ISSUE] Ticket describing something that isn't working
Projects
Status: Done
Development

No branches or pull requests

3 participants