Skip to content

Commit

Permalink
Явная сортировка списка интентов
Browse files Browse the repository at this point in the history
  • Loading branch information
dext0r committed Apr 23, 2024
1 parent 845189c commit 27767af
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions custom_components/yandex_station_intents/yandex_intent.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,15 @@ def decode(cls, number: str) -> int:


class IntentManager:
def __init__(self, hass: HomeAssistant, intents_config: ConfigType | None) -> None:
def __init__(self, hass: HomeAssistant, intents_config: ConfigType) -> None:
self._hass = hass
self._last_command_at: datetime | None = None
self._command_execution_loop_count: int = 0

self.intents: list[Intent] = []

if not intents_config:
return

for idx, (name, config) in enumerate(intents_config.items(), 0):
for idx, name in enumerate(sorted(intents_config.keys(), key=lambda k: k.lower()), 0):
config = intents_config[name]
say_phrase = config.get(CONF_INTENT_SAY_PHRASE)
intent = Intent(
id=idx,
Expand Down

0 comments on commit 27767af

Please sign in to comment.