0

After a long research without any results, I'm trying my luck here. I recently got the GA SDK sample to work on my Raspberry Pi 3.

Now I would like to light my connected LED when the Assistant is listening. I know how to do this, but I don't know where to add the code for the LED in the Assistant sample code. The documentation on their website says it's in the grpc code, but I don't know any more than that.

Any advice on where to add the LED code?

bouteillebleu
  • 2,456
  • 23
  • 32
Jan
  • 123
  • 1
  • 2
  • 8

1 Answers1

1

Look at the hotword sample here https://github.com/googlesamples/assistant-sdk-python/blob/master/google-assistant-sdk/googlesamples/assistant/library/hotword.py

You can use the events to write your GPIO logic to turn on/off the LED. Something like this -

`def process_event(event):
    if event.type == EventType.ON_CONVERSATION_TURN_STARTED:
        print()
        GPIO.output(25,True)
    if (event.type == EventType.ON_CONVERSATION_TURN_FINISHED and
            event.args and not event.args['with_follow_on_turn']):
        print()
        GPIO.output(25,False)
    if (event.type == EventType.ON_RECOGNIZING_SPEECH_FINISHED and
            event.args and not event.args['with_follow_on_turn']):
        print()`

here's the documentation on the library- https://developers.google.com/assistant/sdk/reference/library/python/

Gaurav
  • 840
  • 4
  • 16
  • which assistant.py are you referring to? – Gaurav Jun 10 '17 at 22:45
  • ok, found the solution by myself and with help from other threads. I'll mark your answer as correct since you solved my original question. – Jan Jun 11 '17 at 17:05