forked from platypush/platypush
An AssistantEvent
should not fail initialization if the assistant integration isn't found.
This commit is contained in:
parent
04b1dad6d8
commit
c690230930
2 changed files with 7 additions and 10 deletions
|
@ -17,15 +17,12 @@ class AssistantEvent(Event):
|
||||||
if assistant:
|
if assistant:
|
||||||
self._assistant = assistant
|
self._assistant = assistant
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
self._assistant = get_backend('assistant.google')
|
self._assistant = get_backend('assistant.google')
|
||||||
|
|
||||||
if not self._assistant:
|
if not self._assistant:
|
||||||
self._assistant = get_plugin('assistant.google.pushtotalk')
|
self._assistant = get_plugin('assistant.google.pushtotalk')
|
||||||
|
except Exception as e:
|
||||||
if not self._assistant:
|
self.logger.debug('Could not initialize the assistant component: %s', e)
|
||||||
self.logger.warning(
|
|
||||||
'Assistant plugin/backend not configured/initialized'
|
|
||||||
)
|
|
||||||
self._assistant = None
|
self._assistant = None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ def test_speech_recognized_event_parse():
|
||||||
assert 'answer' in result.parsed_args
|
assert 'answer' in result.parsed_args
|
||||||
assert result.parsed_args['answer'] == '42'
|
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)
|
result = event.matches_condition(condition)
|
||||||
assert not result.is_match
|
assert not result.is_match
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue