phanmemkhoinghiep / MagicMirror

This is my config for MagicMirror

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MagicMirror

This is my config for MagicMirror (Original source from Magic Miror Offcial Website: https://magicmirror.builders/)

STEP1. Installing a Magic Mirror

Install the Magic Mirror using a script on the Internet

sudo apt-get install npm
sudo npm install -g npm@latest
bash -c "$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror_scripts/master/raspberry.sh)"

After that, using automatic installation method

STEP2. Installing WWW Hotword

cd ~/MagicMirror/modules
git clone https://github.com/bugsounet/MMM-Hotword.git
cd MMM-Hotword
npm install

After that, using automatic installation method

STEP3. Installing MMM MK2 Version 3.1.0-2

cd ~/MagicMirror/modules/
cd modules
git clone https://github.com/bugsounet/MMM-AssistantMk2
cd MMM-AssistantMk2
npm install

After that, using automatic installation method

STEP4. Configure Google Account

  1. Go to Google Action Console and create a new project
https://console.actions.google.com
  1. Open the Google Cloud Platform Console and select the generated project
https://console.cloud.google.com
  1. Search for the Google Assistant API and click Enable.
  2. Click CONFIGURE ... of Credentials and put the name and e-mail.
  3. Generate Other credentials with the OAuth Client ID in Create Credentials
  4. Download generated OAuth client ID in json format
  5. Move the downloaded OAuth client ID to MagicMirror and rename it to credentials.json /module/MMM-AssistantMk2/
mv ~/Download/cre.... credentials.json
  1. From the local command line in Hardware, run auth_and_test.js to verify the generated client ID
cd /MagicMirror/modules/MMM-AssistantMk2
node auth_and_test.js
  1. The local browser will display follow it to accept the client verification process to generate the key
  2. Copy the key and paste to the local command line
  3. Move the generated token.json
mv token.json ./profiles/default.json

STEP5. Configure MMM Mk2 and MMM Hotwork to work togehter

  1. From the remote or local access to the MagicMirorr config file at /MagicMirror/config/config.js
  2. Edit the config.js
{
	module: "MMM-Hotword",
	position: "top_right",
	config: {
		useDisplay: false,
    chimeOnFinish: null,
    recipes: ["with-AMk2v3_smart-mirror.js"],
		mic: {
			recordProgram: "arecord",
			device: "plughw:1,0"
		},
		models: [
			{
				hotwords    : "smart_mirror",
				file        : "smart_mirror.umdl",
				sensitivity : "0.5",
			},
		],
		commands: {

		}
	}
},
{
	module: "MMM-AssistantMk2",
	position: "top_right",
	  config: {
    debug: false,
    ui: "Fullscreen", // Classic2 or Classic
    // if you want Google Home ui style
    // set Fullscreen ui AND fullscreen_above position
    assistantConfig: {
      projectId: "", // Required to use gaction.
      modelId: "", // (OPTIONAL for gaction)
      instanceId: "", // (OPTIONAL for gaction)
      latitude: your_lat, // -90.0 - +90.0
      longitude: your_long, // -180.0 - +180.0
    },
    responseConfig: {
      useHTML5: true, // sound render by HTML5
      useScreenOutput: true,
      useAudioOutput: true,
      useChime: true,
      timer: 5000,
      myMagicWord: false,
      //Your prefer sound play program.
      //By example, if you are running this on OSX, `afplay` could be available.
      //by default mpg321 play program is enabled
      //if audio output cutting try with mpg123 or cvlc program
      playProgram: "mpg321",
      chime: {
        beep: "beep.mp3",
        error: "error.mp3",
        continue: "continue.mp3",
        open: "Google_beep_open.mp3",
        close: "Google_beep_close.mp3",
      },
      // false - animated icons, 'standby' - static icons only for standby state, true - all static icons
      useStaticIcons: false
    },
    micConfig: { // put there configuration generated by auto-installer
      recorder: "arecord",
      device: "plughw:1,0",
    },
    customActionConfig: {
      autoMakeAction: false,
      autoUpdateAction: false, // in RPI, gaction CLI might have some trouble.(current version should be 2.2.4, but for linux-arm, Google haven't updated) so leave this as false in RPI. I don't know it is solved or not.
      actionLocale: "en-US", // At this moment, multi-languages are not supported, sorry. Someday I'll work.
    },
    recipes: [ "with-MMM-Hotword.js", "with-MMM-TelegramBot.js" ],
    profiles: {
      "default": {
        profileFile: "default.json",
        lang: "vi"
      }
    },
    useA2D: false,
  },
},
           ]
};

STEP6. Run and Test

  1. From the remote or local access to the command line of the box
cd /MagicMirror/
DISPLAY=:0 npm start
  1. Using Hotword "smart-mirror" to wakeup MM MK2 and test

About

This is my config for MagicMirror

License:GNU General Public License v3.0


Languages

Language:JavaScript 100.0%