diff --git a/platypush/backend/assistant/google.py b/platypush/backend/assistant/google.py index 04023de5..1ac4075a 100644 --- a/platypush/backend/assistant/google.py +++ b/platypush/backend/assistant/google.py @@ -12,7 +12,7 @@ from platypush.message.event.assistant import \ ConversationStartEvent, ConversationEndEvent, ConversationTimeoutEvent, \ ResponseEvent, NoResponseEvent, SpeechRecognizedEvent, AlarmStartedEvent, \ AlarmEndEvent, TimerStartedEvent, TimerEndEvent, AlertStartedEvent, \ - AlertEndEvent + AlertEndEvent, MicMutedEvent, MicUnmutedEvent class AssistantGoogleBackend(AssistantBackend): @@ -50,6 +50,10 @@ class AssistantGoogleBackend(AssistantBackend): when a timer starts * :class:`platypush.message.event.assistant.TimerEndEvent` \ when a timer ends + * :class:`platypush.message.event.assistant.MicMutedEvent` \ + when the microphone is muted. + * :class:`platypush.message.event.assistant.MicUnmutedEvent` \ + when the microphone is un-muted. Requires: @@ -135,6 +139,10 @@ class AssistantGoogleBackend(AssistantBackend): self.logger.error('Fatal assistant error') else: self.logger.warning('Assistant error') + if event.type == EventType.ON_MUTED_CHANGED: + muted = event.args.get('is_muted') + event = MicMutedEvent() if muted else MicUnmutedEvent() + self.bus.post(event) def start_conversation(self): """ Starts an assistant conversation """ diff --git a/platypush/message/event/assistant/__init__.py b/platypush/message/event/assistant/__init__.py index 8b0affef..44b1f1cb 100644 --- a/platypush/message/event/assistant/__init__.py +++ b/platypush/message/event/assistant/__init__.py @@ -184,4 +184,18 @@ class TimerEndEvent(AlertEndEvent): super().__init__(*args, **kwargs) +class MicMutedEvent(AssistantEvent): + """ + Event triggered when the microphone is muted. + """ + pass + + +class MicUnmutedEvent(AssistantEvent): + """ + Event triggered when the microphone is muted. + """ + pass + + # vim:sw=4:ts=4:et: