Hi Members,
I want to share my experience here using MMM-AssistantMk2.
My objective was to be able to control my Mirror with voice command eg: “Set volume to 5” to have it at 50%
Looking at the MMM-Assistantmk2.js code I saw the transcription hook and decided to use that.
With the help of @Sean who has developed this module, I have implemented some additional lines in the mentioned file. ( all coding credit goes to Sean ) Else the same working code would have been ugly if it was by me :)
First in the section: transcription hook
add
"VOL_HOOK": {
pattern: "set volume to ([0-9]+)",
command: "VOL_COMMAND"
},
then lower in section command
"VOL_COMMAND": {
shellExec: {
exec: "amixer sset -M 'PCM'",
options: (params, key) => {
return (params[1] * 10) + "%"
}
},
}
This allows me now to say “Jarvis” … “set volume to 5” then my volume will be set to 50%.
Note that you will need to pull the last update from git to get this works as we found a bug in the code with the ‘param’ while I tried to implement that. Sean fixed that very quickly and it’s now available.
Hope that will be useful for the community and thanks again to Sean for this great module.
You can find the full discussion on this topic here https://github.com/eouia/MMM-AssistantMk2/issues/89
Ej