From c201d725b70ca4c98f7db9f188859020d7545561 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 26 Dec 2017 15:06:59 +0100 Subject: [PATCH] Google Assistant plugin to programmatically start/stop conversation --- platypush/backend/assistant/google/__init__.py | 4 ++++ platypush/plugins/assistant/google/__init__.py | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 platypush/plugins/assistant/google/__init__.py diff --git a/platypush/backend/assistant/google/__init__.py b/platypush/backend/assistant/google/__init__.py index e432fef33..43cbc20a0 100644 --- a/platypush/backend/assistant/google/__init__.py +++ b/platypush/backend/assistant/google/__init__.py @@ -48,6 +48,10 @@ class AssistantGoogleBackend(Backend): self.bus.post(SpeechRecognizedEvent(phrase=phrase)) + def start_conversation(self): + if self.assistant: self.assistant.start_conversation() + + def stop_conversation(self): if self.assistant: self.assistant.stop_conversation() diff --git a/platypush/plugins/assistant/google/__init__.py b/platypush/plugins/assistant/google/__init__.py new file mode 100644 index 000000000..a3589284d --- /dev/null +++ b/platypush/plugins/assistant/google/__init__.py @@ -0,0 +1,18 @@ +from platypush.context import get_backend +from platypush.message.response import Response + +from platypush.plugins import Plugin + +class AssistantGooglePlugin(Plugin): + def start_conversation(self): + assistant = get_backend('assistant.google') + assistant.start_conversation() + return Response(output='', errors=[]) + + def stop_conversation(self): + assistant = get_backend('assistant.google') + assistant.stop_conversation() + return Response(output='', errors=[]) + +# vim:sw=4:ts=4:et: +