glance icon indicating copy to clipboard operation
glance copied to clipboard

Get weather based on id rather then name

Open a-waider opened this issue 10 months ago • 3 comments

Hey, the weather widget is lacking a feature for my specific case. The location property in the configuration only supports to query for the first found item of open-meteo.com. However I didn't find a search query which lists my location as the first result.

I would propose to also support location ids which open-meteo.com also provides. The app could first check if the location property is an integer and query by the location id, otherwise query by name.

a-waider avatar Jan 05 '25 19:01 a-waider

Hey, the location parameter accepts up to 3 comma separated values, where the second value is matched against admin1 in the JSON response. Here's what that would look like for a bunch of US places with the same name:

Greenville, North Carolina, United States
Greenville, South Carolina, United States
Greenville, Mississippi, United States

If admin1 isn't populated for the results you're seeing, please let me know, otherwise I believe this should resolve your issue.

svilenmarkov avatar Jan 05 '25 22:01 svilenmarkov

Alright, thanks for your help. I updated it accordingly and it seems to give me plausible values. Honestly I'm still not really sure it's using the correct location. Is there a way to verify which location e.g. by lat/lon or id is used?

a-waider avatar Jan 08 '25 18:01 a-waider

I've found an edge case in which the name, admin1 and country are the same, but admin3 contains different values. This concerns places in Italy; even though these places are fairly close to one another, they might have different weather.

https://open-meteo.com/en/docs/geocoding-api?name=Breda&countryCode=IT#geocoding_search

aaldering avatar Apr 29 '25 21:04 aaldering