Not seeing the "awoke" event on the message bus


#1

I’m trying to build a small daemon that monitors the message bus and performs certain tasks when mycroft does certain things. One of the events I was hoping to respond to was when mycroft hears the wake word, but this does not appear on the event bus at all. I’n not seeing either “recognizer_loop.awoke”, recognizer_loop:wake_up, mycroft.awoken or recognizer_loop:wakeword. Is there something I’m missing, like having to tell the message bus that I am interested in these before it will broadcast them?


#2

Unless there’s a request attached to the wake word, may not trigger an entry onto the message bus. You could scrape the voice.log instead perhaps?


#3

It should be available on the messagebus and I can successfully create an event handler using the MycroftSkill.add_event method eg:

from mycroft import MycroftSkill, intent_file_handler

class PingOnWake(MycroftSkill):
    def initialize(self):
        self.add_event('recognizer_loop:wakeword',
                       self.ping)

    def ping(self, message):
        self.log.info("PING")
        self.speak_dialog('awake.ping')

def create_skill():
    return PingOnWake()

Using your daemon, are you able to detect other message types like “speak” or “mycroft.stop”?

Presuming you’ve already seen this:


#4

Yes, I can see other events on the bus. However, the one difference I can see is that I am using the websockets to connect into the bus rather than doing it in python and subclassing MycroftSkill. Would that make a difference?


#5

I think the message that may be of interest here is recognizer_loop:record_begin

It’s issued when recording is triggered, this may however be both from the wakeword or other event triggering listening.

If you can see other events on the bus you should be fine…I think something’s wonky with how/when the recognizer_loop:wakeword is emitted. Up until now I didn’t actually know we had that message…


#6

Actually, I tried recognizer_loop:record_begin and that didn’t work. I was hoping to find an message that is triggered after the wakeword is found but before the tone from the speaker to indicate to the user to say the command so I can manipulate some GPIO pins based on this, but after digging through the code last night I saw that there wasn’t anything that does this. So I’ve ended up adding one of my own. I’ll probably put together a PR to add this in as it seems like it would be useful and I’m surprised that there isn’t anything there to do it.