Skip to content

Commit

Permalink
Fixed alphabetical sorting of resources in options
Browse files Browse the repository at this point in the history
	ändrad:        custom_components/skodaconnect/config_flow.py
  • Loading branch information
Farfar committed Sep 5, 2021
1 parent 19873ea commit c34442e
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions custom_components/skodaconnect/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,17 @@ async def async_step_user(self, user_input=None):
if convert == None:
convert = "no_conversion"

instruments_dict = dict(sorted(
self._config_entry.data.get(
CONF_INSTRUMENTS,
self._config_entry.options.get(CONF_RESOURCES, {})).items(),
key=lambda item: item[1]))

self._config_entry.data.get(
CONF_INSTRUMENTS,
self._config_entry.options.get(CONF_RESOURCES, {})
)

return self.async_show_form(
step_id="user",
data_schema=vol.Schema(
Expand Down Expand Up @@ -461,12 +472,12 @@ async def async_step_user(self, user_input=None):
default=self._config_entry.options.get(CONF_RESOURCES,
self._config_entry.data.get(CONF_RESOURCES, [])
)
): cv.multi_select(
self._config_entry.data.get(
CONF_INSTRUMENTS,
self._config_entry.options.get(CONF_RESOURCES, {})
)
),
): cv.multi_select(instruments_dict),
# self._config_entry.data.get(
# CONF_INSTRUMENTS,
# self._config_entry.options.get(CONF_RESOURCES, {})
# )
#),
vol.Required(
CONF_CONVERT,
default=convert
Expand Down

0 comments on commit c34442e

Please sign in to comment.