MagicMirror² v2.14.0 is available! For more information about this release, check out this topic.

Execute shell commands when AssistantMk2 starts or stops

  • Hello,

    I have the modules MMM-Hotword and MMM-AssistantMk2 installed. And it works that far.
    Now I want to execute a shell command when the wizard starts to speak and execute another shell command when the wizard is quit.
    How should I proceed?

  • Module Developer

    There is no usable point about “Response starting”, usually "ASSISTANT_UNDERSTOOD" notification or "ASSISTANT_ACTIVATED" notification could be used for that purpose, but not exactly same time with Starting audio response
    For ending, you can use "ASSISTANT_RESPONSE_END"
    With those notifications, you can make your own module to receive those notifications and to do your own job, Or,…
    You can use MMM-NotificationTrigger which be already built for translate and chain notifications among the modules. It can execute external shell script.

  • on linux you can replace the command being executed to play audio with a shell script of the same name (and rename the old file and call it from the script) and then add your own behavior.

  • @Sean said in Execute shell commands when AssistantMk2 starts or stops:


    thank you!
    MMM-NotificationTrigger did the trick.

      module: "MMM-NotificationTrigger",
      config: {
            trigger: "ASSISTANT_RESPONSE_END",
            fires: [{ fire:"MY_COMMAND1", exec: "sleep 1; ls -al" },],
            trigger: "ASSISTANT_UNDERSTOOD",
            fires: [{ fire:"MY_COMMAND2", exec: "sleep 1; ls -h" },],

Log in to reply