MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. Ghost2000
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    G
    Offline
    • Profile
    • Following 1
    • Followers 0
    • Topics 4
    • Posts 47
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: MMM-awesome-alexa

      can you send me ?

      posted in Utilities
      G
      Ghost2000
    • RE: MMM-awesome-alexa

      @Ghost2000 said in MMM-awesome-alexa:

      > magicmirror@2.13.0 config:check /home/pi/MagicMirror
      > node js/check_config.js
      
      [2020-10-10 00:52:40.394] [INFO]   Checking file...  /home/pi/MagicMirror/config/config.js
      [2020-10-10 00:52:40.490] [INFO]   Your configuration file doesn't contain syntax errors :)
      
      
      pi@MagicMirror:~ $ cd ~/MagicMirror/
      pi@MagicMirror:~/MagicMirror $ pm2 log mm
      [TAILING] Tailing last 15 lines for [mm] process (change the value with --lines option)
      /home/pi/.pm2/logs/mm-error.log last 15 lines:
      0|mm       |     at Module._compile (internal/modules/cjs/loader.js:786:30)
      0|mm       |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:798:10)
      0|mm       |     at Module.load (internal/modules/cjs/loader.js:645:32) {
      0|mm       |   code: 'MODULE_NOT_FOUND',
      0|mm       |   requireStack: [
      0|mm       |     '/home/pi/MagicMirror/modules/MMM-awesome-alexa/node_modules/snowboy/lib/node/index.js',
      0|mm       |     '/home/pi/MagicMirror/modules/MMM-awesome-alexa/node_helper.js',
      0|mm       |     '/home/pi/MagicMirror/js/app.js',
      0|mm       |     '/home/pi/MagicMirror/js/electron.js',
      0|mm       |     '/home/pi/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js',
      0|mm       |     undefined
      0|mm       |   ]
      0|mm       | }
      0|mm       | [2020-10-10 00:55:35.178] [ERROR]  MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
      0|mm       | [2020-10-10 00:55:35.178] [ERROR]  If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
      
      /home/pi/.pm2/logs/mm-out.log last 15 lines:
      0|mm       | [2020-10-10 00:55:34.267] [LOG]    Initializing new module helper ...
      0|mm       | [2020-10-10 00:55:34.268] [LOG]    Module helper loaded: mmpm
      0|mm       | [2020-10-10 00:55:34.304] [LOG]    Initializing new module helper ...
      0|mm       | [2020-10-10 00:55:34.305] [LOG]    Module helper loaded: updatenotification
      0|mm       | [2020-10-10 00:55:34.306] [LOG]    No helper found for module: MMM-Carousel.
      0|mm       | [2020-10-10 00:55:34.306] [LOG]    No helper found for module: clock.
      0|mm       | [2020-10-10 00:55:35.154] [LOG]    Loading module helpers ...
      0|mm       | [2020-10-10 00:55:35.156] [LOG]    No helper found for module: alert.
      0|mm       | [2020-10-10 00:55:35.159] [LOG]    Initializing new module helper ...
      0|mm       | [2020-10-10 00:55:35.160] [LOG]    Module helper loaded: mmpm
      0|mm       | [2020-10-10 00:55:35.161] [LOG]    Initializing new module helper ...
      0|mm       | [2020-10-10 00:55:35.161] [LOG]    Module helper loaded: updatenotification
      0|mm       | [2020-10-10 00:55:35.162] [LOG]    No helper found for module: MMM-Carousel.
      0|mm       | [2020-10-10 00:55:35.163] [LOG]    No helper found for module: clock.
      0|mm       | [2020-10-10 00:55:35.253] [LOG]    Launching application.
      
      
      
      posted in Utilities
      G
      Ghost2000
    • RE: MMM-awesome-alexa
      > magicmirror@2.13.0 config:check /home/pi/MagicMirror
      > node js/check_config.js
      
      [2020-10-10 00:52:40.394] [INFO]   Checking file...  /home/pi/MagicMirror/config/config.js
      [2020-10-10 00:52:40.490] [INFO]   Your configuration file doesn't contain syntax errors :)
      
      

      Screen black… no Error

      posted in Utilities
      G
      Ghost2000
    • RE: MMM-awesome-alexa

      it works with your settings.

      http: // localhost: 3000 /? code = ANMcPyM …

      DANKE DANKE DANKE DANKE DANKE ! LOVE YOU!

      posted in Utilities
      G
      Ghost2000
    • RE: MMM-awesome-alexa

      http: // localhost: 3000 / oder http: // localhost: 3000 / authresponse

      which one is correct?

      posted in Utilities
      G
      Ghost2000
    • RE: MMM-awesome-alexa
      pi@MagicMirror:~/MagicMirror/modules/MMM-awesome-alexa $ node config_helper.js
      internal/modules/cjs/loader.js:638
          throw err;
          ^
      
      Error: Cannot find module '/home/pi/MagicMirror/modules/MMM-awesome-alexa/config_helper.js'
          at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
          at Function.Module._load (internal/modules/cjs/loader.js:562:25)
          at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
          at startup (internal/bootstrap/node.js:283:19)
          at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
      pi@MagicMirror:~/MagicMirror/modules/MMM-awesome-alexa $
      
      
      posted in Utilities
      G
      Ghost2000
    • RE: MMM-awesome-alexa
      const chalk = require("chalk");
      const clear = require("clear");
      const figlet = require("figlet");
      const inquirer = require("inquirer");
      const request = require("request-promise");
      const CLI = require("clui");
      
      const spinner = new CLI.Spinner("Getting response from Amazon...");
      
      const questions = [
          {
              name: "clientId",
              type: "input",
              message: "Enter your Client ID from Alexa Voice Service (AVS):",
              validate: value => {
                  if (value.length) {
                      return true;
                  } else {
                      return "Please enter your Client ID.";
                  }
              },
          },
          {
              name: "clientSecret",
              type: "input",
              message: "Enter your Client Secret from Alexa Voice Service (AVS):",
              validate: function(value) {
                  if (value.length) {
                      return true;
                  } else {
                      return "Please enter your Client Secret.";
                  }
              },
          },
          {
              name: "productId",
              type: "input",
              message: "Enter your Product ID from Alexa Voice Service (AVS):",
              validate: function(value) {
                  if (value.length) {
                      return true;
                  } else {
                      return "Please enter your Product ID.";
                  }
              },
          },
          {
              name: "redirectUri",
              type: "input",
              message: "Enter your Redirect URI (allowed return URL) from Alexa Voice Service (AVS):",
              validate: function(value) {
                  const pattern = new RegExp(
                      "^(https?:\\/\\/)?" + // protocol
                      "((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|" + // domain name
                      "((\\d{1,3}\\.){3}\\d{1,3}))" + // OR ip (v4) address
                      "(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + // port and path
                      "(\\?[;&a-z\\d%_.~+=-]*)?" + // query string
                          "(\\#[-a-z\\d_]*)?$",
                      "i", // fragment locator
                  );
      
                  if (!!pattern.test(value)) {
                      return true;
                  } else {
                      return true;
                  }
              },
          },
      ];
      
      const authCodeQuestion = [
          {
              name: "authCode",
              type: "input",
              message: "Enter your Authorization code (from previous step):",
              validate: value => {
                  if (value.length) {
                      return true;
                  } else {
                      return "Please enter your Authorization Code.";
                  }
              },
          },
      ];
      
      const continueQuestion = [
          {
              name: "continue",
              type: "confirm",
              message: "Do you wish to continue to generate the MagicMirror config?",
              default: true,
          },
      ];
      
      const configQuestions = [
          {
              name: "wakeWord",
              type: "list",
              message: "What do you want your Wake Word to be? (The phrase used to activate this module)",
              choices: ["Alexa", "Smart Mirror", "Snowboy"],
          },
          {
              name: "liteMode",
              type: "confirm",
              message: "Do you want to use lite mode?",
              default: false,
          },
          {
              name: "useVisualization",
              type: "confirm",
              message: "Do you want to use visulization?",
              default: true,
          },
      ];
      
      const generateQuery = params =>
          Object.keys(params)
              .map(key => key + "=" + params[key])
              .join("&");
      
      clear();
      
      console.log(chalk.yellow(figlet.textSync("Awesome Alexa", { horizontalLayout: "full" })));
      
      console.log(chalk.underline("Welcome to the Config Helper tool!"));
      console.log("This tool will help you get the Refresh Token needed to run MMM-awesome-alexa.");
      console.log(
          "It will optionally generate your config for you, if you wish. If not, you can still create it manually after.",
      );
      console.log("Go to https://developer.amazon.com/alexa/console/avs/products to get the details.\n");
      
      const run = async () => {
          const output = await inquirer.prompt(questions);
      
          const scopeData = {
              "alexa:all": {
                  productID: output.productId,
                  productInstanceAttributes: {
                      deviceSerialNumber: 123, // Can be anything
                  },
              },
          };
      
          const queryParams = generateQuery({
              client_id: output.clientId,
              scope: "alexa:all",
              scope_data: JSON.stringify(scopeData),
              response_type: "code",
              redirect_uri: output.redirectUri,
          });
      
          console.log(
              chalk.blue("Hooray! Link is generated. Part 1 is done. Please go on the link below.\n"),
          );
          console.log(
              chalk.yellow("Please be aware that at the end,"),
              chalk.bgRed("THERE WILL BE AN ERROR!"),
              chalk.green("This is normal.\n"),
          );
      
          console.log(`https://www.amazon.com/ap/oa?${queryParams}`);
      
          console.log("\n^^^ Copy and paste the above in your Browser ^^^, follow the instructions.");
          console.log(
              "The authorization code you want is in the address bar in the final screen: https://imgur.com/a/6DbYlKA",
          );
      
          const authOutput = await inquirer.prompt(authCodeQuestion);
      
          spinner.start();
      
          const amazonTokenReponse = await request.post("https://api.amazon.com/auth/o2/token", {
              form: {
                  grant_type: "authorization_code",
                  code: authOutput.authCode,
                  client_id: output.clientId,
                  client_secret: output.clientSecret,
                  redirect_uri: output.redirectUri,
              },
              json: true,
          });
      
          spinner.stop();
          console.log(
              chalk.bgGreen(
                  "\nComplete! Your refresh token should be in the Amazon response below. If not raise an issue:\n",
              ),
          );
          console.dir(amazonTokenReponse, { colors: true });
      
          const continueOutput = await inquirer.prompt(continueQuestion);
      
          if (!continueOutput.continue) {
              process.exit();
          }
      
          const configOutput = await inquirer.prompt(configQuestions);
      
          console.log(chalk.green("\nCongrats! Here is the full config:\n"));
          console.dir(
              {
                  module: "MMM-awesome-alexa",
                  position: "bottom_bar",
                  config: {
                      wakeWord: configOutput.wakeWord,
                      clientId: output.clientId,
                      clientSecret: output.clientSecret,
                      deviceId: output.productId,
                      refreshToken: amazonTokenReponse.refresh_token,
                      lite: configOutput.liteMode,
                      isSpeechVisualizationEnabled: configOutput.useVisualization,
                  },
              },
              { colors: true },
          );
      };
      
      run();
      
      
      posted in Utilities
      G
      Ghost2000
    • RE: MMM-awesome-alexa

      @sdetweil NO

      const chalk = require("chalk");
      const clear = require("clear");
      const figlet = require("figlet");
      const inquirer = require("inquirer");
      const request = require("request-promise");
      const CLI = require("clui");
      
      const spinner = new CLI.Spinner("Getting response from Amazon...");
      
      const questions = [
          {
              name: "clientId",
              type: "input",
              message: "Enter your Client ID from Alexa Voice Service (AVS):",
              validate: value => {
                  if (value.length) {
                      return true;
                  } else {
                      return "Please enter your Client ID.";
                  }
              },
          },
          {
              name: "clientSecret",
              type: "input",
              message: "Enter your Client Secret from Alexa Voice Service (AVS):",
              validate: function(value) {
                  if (value.length) {
                      return true;
                  } else {
                      return "Please enter your Client Secret.";
                  }
              },
          },
          {
              name: "productId",
              type: "input",
              message: "Enter your Product ID from Alexa Voice Service (AVS):",
              validate: function(value) {
                  if (value.length) {
                      return true;
                  } else {
                      return "Please enter your Product ID.";
                  }
              },
          },
          {
              name: "redirectUri",
              type: "input",
              message: "Enter your Redirect URI (allowed return URL) from Alexa Voice Service (AVS):",
              validate: function(value) {
                  const pattern = new RegExp(
                      "^(https?:\\/\\/)?" + // protocol
                      "((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|" + // domain name
                      "((\\d{1,3}\\.){3}\\d{1,3}))" + // OR ip (v4) address
                      "(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + // port and path
                      "(\\?[;&a-z\\d%_.~+=-]*)?" + // query string
                          "(\\#[-a-z\\d_]*)?$",
                      "i", // fragment locator
                  );
      
                  if (!!pattern.test(value)) {
                      return true;
                  } else {
                      return "Invalid. Please enter your Redirect URI.";
                  }
              },
          },
      ];
      
      const authCodeQuestion = [
          {
              name: "authCode",
              type: "input",
              message: "Enter your Authorization code (from previous step):",
              validate: value => {
                  if (value.length) {
                      return true;
                  } else {
                      return "Please enter your Authorization Code.";
                  }
              },
          },
      ];
      
      const continueQuestion = [
          {
              name: "continue",
              type: "confirm",
              message: "Do you wish to continue to generate the MagicMirror config?",
              default: true,
          },
      ];
      
      const configQuestions = [
          {
              name: "wakeWord",
              type: "list",
              message: "What do you want your Wake Word to be? (The phrase used to activate this module)",
              choices: ["Alexa", "Smart Mirror", "Snowboy"],
          },
          {
              name: "liteMode",
              type: "confirm",
              message: "Do you want to use lite mode?",
              default: false,
          },
          {
              name: "useVisualization",
              type: "confirm",
              message: "Do you want to use visulization?",
              default: true,
          },
      ];
      
      const generateQuery = params =>
          Object.keys(params)
              .map(key => key + "=" + params[key])
              .join("&");
      
      clear();
      
      console.log(chalk.yellow(figlet.textSync("Awesome Alexa", { horizontalLayout: "full" })));
      
      console.log(chalk.underline("Welcome to the Config Helper tool!"));
      console.log("This tool will help you get the Refresh Token needed to run MMM-awesome-alexa.");
      console.log(
          "It will optionally generate your config for you, if you wish. If not, you can still create it manually after.",
      );
      console.log("Go to https://developer.amazon.com/alexa/console/avs/products to get the details.\n");
      
      const run = async () => {
          const output = await inquirer.prompt(questions);
      
          const scopeData = {
              "alexa:all": {
                  productID: output.productId,
                  productInstanceAttributes: {
                      deviceSerialNumber: 123, // Can be anything
                  },
              },
          };
      
          const queryParams = generateQuery({
              client_id: output.clientId,
              scope: "alexa:all",
              scope_data: JSON.stringify(scopeData),
              response_type: "code",
              redirect_uri: output.redirectUri,
          });
      
          console.log(
              chalk.blue("Hooray! Link is generated. Part 1 is done. Please go on the link below.\n"),
          );
          console.log(
              chalk.yellow("Please be aware that at the end,"),
              chalk.bgRed("THERE WILL BE AN ERROR!"),
              chalk.green("This is normal.\n"),
          );
      
          console.log(`https://www.amazon.com/ap/oa?${queryParams}`);
      
          console.log("\n^^^ Copy and paste the above in your Browser ^^^, follow the instructions.");
          console.log(
              "The authorization code you want is in the address bar in the final screen: https://imgur.com/a/6DbYlKA",
          );
      
          const authOutput = await inquirer.prompt(authCodeQuestion);
      
          spinner.start();
      
          const amazonTokenReponse = await request.post("https://api.amazon.com/auth/o2/token", {
              form: {
                  grant_type: "authorization_code",
                  code: authOutput.authCode,
                  client_id: output.clientId,
                  client_secret: output.clientSecret,
                  redirect_uri: output.redirectUri,
              },
              json: true,
          });
      
          spinner.stop();
          console.log(
              chalk.bgGreen(
                  "\nComplete! Your refresh token should be in the Amazon response below. If not raise an issue:\n",
              ),
          );
          console.dir(amazonTokenReponse, { colors: true });
      
          const continueOutput = await inquirer.prompt(continueQuestion);
      
          if (!continueOutput.continue) {
              process.exit();
          }
      
          const configOutput = await inquirer.prompt(configQuestions);
      
          console.log(chalk.green("\nCongrats! Here is the full config:\n"));
          console.dir(
              {
                  module: "MMM-awesome-alexa",
                  position: "bottom_bar",
                  config: {
                      wakeWord: configOutput.wakeWord,
                      clientId: output.clientId,
                      clientSecret: output.clientSecret,
                      deviceId: output.productId,
                      refreshToken: amazonTokenReponse.refresh_token,
                      lite: configOutput.liteMode,
                      isSpeechVisualizationEnabled: configOutput.useVisualization,
                  },
              },
              { colors: true },
          );
      };
      
      run();
      
      

      Have You Teamview ? You can help :D

      posted in Utilities
      G
      Ghost2000
    • 1
    • 2
    • 3
    • 4
    • 5
    • 4 / 5