Skip to content
A simple voice command module for MagicMirror² that is highly configurable
JavaScript
Branch: master
Clone or download
Veldrovive Made it more clear which browsers must be used
The selection of browsers that may be used is now more specific.
Latest commit 2a35157 Mar 5, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
js Initial Commit Jul 2, 2018
.gitignore Initial Commit Jul 2, 2018
MMM-Voice-Commands.js Added autoStart, activateCommand, deactivateCommand, and alertHeard c… Jul 3, 2018
README.md Made it more clear which browsers must be used Mar 6, 2019
package-lock.json
package.json Initial Commit Jul 2, 2018

README.md

MMM-Voice-Commands

Demo
Voice Commands is a voice commands module that is designed to be bare bones and allow the user to do whatever they want on their MagicMirror². The voice recognition is built off of annyang so it uses a command based structure. However, it does not use an activation phrase and instead just opts for direct use of statements.

IMPORTANT NOTE - Read before installing:

annyang does not work when Magic Mirror is run using some browsers. In order to ensure that it works, use chrome or firefox if possible. This also means that electron cannot be used since it is a chromium wrapper. The serveronly mode must be used for this module to function.

Installation

Navigate to the modules folder of your Magic Mirror installation.

cd ~/MagicMirror/modules

Clone the repository.

git clone https://github.com/Veldrovive/MMM-Voice-Commands.git

Navigate into the installation and Install Dependencies.

cd MMM-Voice-Commands && npm i

Usage

modules[
    ...
    {
        module: "MMM-Voice-Commands",
        config: {
            debug: false, //Displays end results and errors from annyang in the Log
            autoStart: true, //Adds annyang commands when it first starts
            activateCommand: "hello mirror", //Command to active all other commands
            deactivateCommand: "goodbye mirror", //Command to deactivate all other commands
            alertHeard: false, //Whether an alert should be shown when annyang hears a phrase (mostly for debug)
            commands: {
                "command statement :variable (optional statement)": "SOCKET_NOTIFICATION_NAME",
                //The payload of the socket notification will be whatever is said in the :variable
                "command statement *variable": function(param){
                    alert("Whatever is said in the *variable space is given as the "+param);
                    //These function's 'this' are bound to the module's 'this' so you can do stuff like:
                    this.sendNotification("PAGE_SELECT", "2");
                }
            }
        }
    },
  ...
]
  • If a string is provided as the property in a command, the module will send out a notification with the socket name given by the property and the payload given by the variable in the annyang command.
  • If a function is provided as the property in a command, the module will simply run the function when the command is hear. The argument of the command is given by the variable and this refers to the module's this.

For more information on the command stucure look to the annyang documentation

Usage with external modules

  • Voice Commands communicates with other modules through the notification system.
  • The alert module is automatically utilized if it is present.
  • Voice Commands was developed in conjunction with MMM-Page-Selector. Two use the two together simply use a command in the following format:
    "switch to (the) :page (page)": "PAGE_SELECT" or "go to (page) :number": "PAGE_SELECT"
You can’t perform that action at this time.