izacus / hass-swissweather

HomeAssistant module for MeteoSwiss
Apache License 2.0
14 stars 3 forks source link

Configuration flow: Sort stations by distance #8

Closed Luatan closed 2 months ago

Luatan commented 2 months ago

Hi,

I think it would make sense to sort the stations in the configuration flow to list the closest one first. This will make it faster to find the right one, since we do have all the data needed already. What do you think?

If this is desired, I can create a pull request with a change.

izacus commented 2 months ago

The config flow is already attempting to do that:

https://github.com/izacus/hass-swissweather/blob/master/custom_components/swissweather/config_flow.py#L96

but you do need location setup in HASS configuration - is there a better way?

Luatan commented 2 months ago

Yes I saw that, but it only shows you the distance in the text. You still need to look for it in the list, which is sorted by A-Z. What I mean is to also sort the list. So the nearest one is shown at the top. Location setup would be needed, true, but as far as I see it the setup of your location is required. I don't think you can skip it. https://www.home-assistant.io/getting-started/onboarding/

and if we do not have a location, we can leave the list as is.