Google Assistant plugin to programmatically start/stop conversation

This commit is contained in:
Fabio Manganiello 2017-12-26 15:06:59 +01:00
parent 720ab38673
commit c201d725b7
2 changed files with 22 additions and 0 deletions

View file

@ -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()

View file

@ -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: