Add a Working Timer to the AIYProject.

Another post about my AIYProject box, I’m having great fun this week playing with this.

I noticed that if you try to set a timer on the box it responds with “Sure, I’ll set a timer for..”, then nothing happens. So I’ve written my own action for this. It’s basic, only does minutes OR seconds, plus it isn’t exactly accurate as it takes a few seconds for the box to respond and set the timer, but it’s better than nothing.

To add this edit ~voice-recognizer-raspi/src/actions.py
Add to the imports:

import time
import threading

Then add this class to the actions:

Under voice commands add this:

actor.add_keyword(_('set timer'), setTimer(say,_('set timer for ')))
actor.add_keyword(_('set a timer'), setTimer(say,_('set a timer for ')))

Restart the voice recognition service:
sudo systemctl restart voice-recognizer.service

Now you should be able to set a timer. This could be modified to add a more noticeable alert when it finishes!

Add a Comment

Your email address will not be published. Required fields are marked *