An AssistantEvent should not fail initialization if the assistant integration isn't found.

This commit is contained in:
Fabio Manganiello 2023-05-04 00:28:50 +02:00
parent 04b1dad6d8
commit c690230930
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 7 additions and 10 deletions

View file

@ -17,15 +17,12 @@ class AssistantEvent(Event):
if assistant:
self._assistant = assistant
else:
try:
self._assistant = get_backend('assistant.google')
if not self._assistant:
self._assistant = get_plugin('assistant.google.pushtotalk')
if not self._assistant:
self.logger.warning(
'Assistant plugin/backend not configured/initialized'
)
except Exception as e:
self.logger.debug('Could not initialize the assistant component: %s', e)
self._assistant = None

View file

@ -82,7 +82,7 @@ def test_speech_recognized_event_parse():
assert 'answer' in result.parsed_args
assert result.parsed_args['answer'] == '42'
event = PingEvent(phrase="what is not the answer? 43")
event = SpeechRecognizedEvent(phrase="what is not the answer? 43")
result = event.matches_condition(condition)
assert not result.is_match