assistant-sdk-python
assistant-sdk-python copied to clipboard
start_conversation() - confusing documentation
Hi there,
following scenario is given:
- Somebody wants to try the Google Assistant Library with Python
- But he/she want's not to activate it by the hotword detection
So the person will go to the documentation and will find following description:
-
set_mic_mute -> This gives the impression (regarding reading in the description of that method) that
set_mic_mute(True)will just disable the hotword detection. -
Great, so let's trigger the assistant manually after it was started with: start_conversation -> but wait, the documentation say:
This method is a no-op if the Assistant is not started or has been muted.
So.. is it just me or does it not work to just disable the hotword detection but keep the manual trigger with the python library?
Best regards, Jan
There is no way to disable the hotword other than muting the assistant. If you are running a manual trigger, the first event should be assistant.set_mic_mute(False) and the susequent event should be assistant.start_conversation(). Upon completion of the conversation, you should mute your assistant back again to disable/stop the assistant from listening to the hotword.
PS: if you want some example for how to, may be you can take a look at this https://github.com/shivasiddharth/GassistPi/blob/master/src/main.py
Hi @JanLoebel , I agree, the documentation is confusing. I got send_text_query() to work through trial and error:
for event in events:
print("\n* * Got an event")
#if event.type == EventType.ON_START_FINISHED and args.query:
if event.type == EventType.ON_START_FINISHED:
#assistant.send_text_query(args.query)
print("* * in on_start_finished")
assistant.set_mic_mute(True)
time.sleep(0.5)
assistant.start_conversation()
time.sleep(0.5)
assistant.send_text_query('what is the weather forecast today')
process_event(event)
I noticed that I was getting intermittent success with some combinations of commands/values so I added delays between commands, which solved the problem . You'll need to import time. The commented lines are from the original hotword.py code.
this so terrible
i also can't work, need help