Skip to content

Commit a5af88c

Browse files
authored
Enhancement - sorted location
1 parent 958453a commit a5af88c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

custom_components/malaysia_weather/config_flow.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,12 @@ async def _async_get_locations() -> dict[str, str]:
100100
locations[location_id] = location_name
101101
except Exception: # pylint: disable=broad-except
102102
_LOGGER.exception("Error fetching locations")
103-
104-
return locations
105-
103+
104+
# 5/1/25 - Sort locations alphabetically by name
105+
sorted_locations = dict(sorted(locations.items(), key=lambda x: x[1]))
106+
return sorted_locations
107+
# return locations
108+
106109
@staticmethod
107110
@callback
108111
def async_get_options_flow(
@@ -177,4 +180,4 @@ async def async_step_init(
177180

178181

179182
class InvalidLocation(HomeAssistantError):
180-
"""Error to indicate the location ID is invalid."""
183+
"""Error to indicate the location ID is invalid."""

0 commit comments

Comments
 (0)