Need functionality that calls a script to execute something pre- and post-"Hey Mycroft"

I have an Intel NUC and there is a project called Intel NUC7i[x]BN and NUC6CAY LED Control for Linux. I would like to add some code somewhere in the project that would allow the core or python script to call a script when “Hey MyCroft” is called by the user, and another when the voice instruction is complete.

Specifically, I want to turn the LEDs on the front of the machine one color when “Hey MyCroft” is called, then turn it back to the original color when listening is complete.

I have no idea where to insert the code to add the script calling. Can anybody help me with this request?

I think the speech client is what you want to look at.

If you just want to hack it, I think you could just jam in whatever you want to the begin and end functions there.

Slightly better would be to watch the messagebus for those begin and end messages (you can do this with a completely separate process, so you wouldn’t have to change any Mycroft code).

If you’re more ambitious, you could look into creating a custom enclosure, similar to what you can find here: https://github.com/MycroftAI/mycroft-core/tree/dev/mycroft/client/enclosure. This may be overkill for just changing the lights, though.

2 Likes

Take a look at the google-picroft-aiy-voicekit - that does turn on the led when wakeword is trikered.

You could make a skil simalar, and just do whatever you want. Dooing it in a skill is a great way so you can share it with others, and not change the core mycroft.

1 Like

“google-picroft-aiy-voicekit” looks like just what I need to do this and without source code modifications to MyCroft and/or supporting packages! Thanks!

1 Like