Read the statement by Michael Teeuw here.
MMM-AlexaControl Configuration Issue
-
Hi Everyone.
I’m trying to setup the MMM-AlexaControl module and I keep getting an config syntax error when I save my Magic Mirror config.js after adding the Notifications.
When I run ‘npm run config:check’, it shows a syntax error, stating “Line 101 column 4: Parsing error: Unexpected token notifications”. I’ve attempted to place the notifications section for the MMM-AlexaControl module in different locations within my MM config.js file, but nothing seems to work. The MMM-AlexaControl module worked before adding the notification sections. The module’s Wiki does not state where to add the notifications within the config file.
The notifications that I am trying to setup are for the MMM-Pages module. Below is my config. Any assistance is greatly appreciated. Thanks!
/* Magic Mirror Config * * By Michael Teeuw https://michaelteeuw.nl * MIT Licensed. * * For more information on how you can configure this file * see https://docs.magicmirror.builders/getting-started/configuration.html#general * and https://docs.magicmirror.builders/modules/configuration.html */ let config = { address: "0.0.0.0", // Address to listen on, can be: // - "localhost", "127.0.0.1", "::1" to listen on loopback interface // - another specific IPv4/6 to listen on a specific interface // - "0.0.0.0", "::" to listen on any interface // Default, when address config is left out or empty, is "localhost" port: 8080, basePath: "/", // The URL path where MagicMirror is hosted. If you are using a Reverse proxy // you must set the sub path here. basePath must end with a / ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1","0.0.0.0"], useHttps: false, // Support HTTPS or not, default "false" will use HTTP httpsPrivateKey: "", // HTTPS private key path, only require when useHttps is true httpsCertificate: "", // HTTPS Certificate path, only require when useHttps is true language: "en", locale: "en-US", logLevel: ["INFO", "LOG", "WARN", "ERROR"], // Add "DEBUG" for even more logging timeFormat: 12, units: "imperial", // serverOnly: true/false/"local" , // local for armv6l processors, default // starts serveronly and then starts chrome browser // false, default for all NON-armv6l devices // true, force serveronly mode, because you want to.. no UI on this device modules: [ { module: "alert", }, { module: "updatenotification", position: "top_bar" }, { module: "clock", position: "top_left" }, { module: "calendar", header: "US Holidays", position: "top_left", config: { calendars: [ { symbol: "calendar-check", url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics" } ] } }, // { // module: "compliments", // position: "lower_third" // }, { module: "weather", position: "top_right", config: { weatherProvider: "openweathermap", type: "current", location: "Navarre", locationID: "4165637", apiKey: "Key Removed from this post" } }, { module: "weather", position: "top_right", header: "Weather Forecast", config: { weatherProvider: "openweathermap", type: "forecast", location: "Navarre", locationID: "4165637", apiKey: "Key Removed from this post" } }, { module: 'MMM-AlexaControl', position: 'bottom_right', config:{ image: true, height: 75, width: 75, pages: 25, pm2ProcessName: "MagicMirror", vcgencmd: "vcgencmd" } notifications: [ { name: 'Next page', port: 11100, OnOff: false, notification: ["PAGE_INCREMENT", "payload"] } { name: 'Previous page', port: 11101, OnOff: false, notification: ["PAGE_DECREMENT", "payload"] } ] }, { module: "newsfeed", position: "bottom_bar", config: { feeds: [ { title: "New York Times", url: "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml" } ], showSourceTitle: true, showPublishDate: true, broadcastNewsFeeds: true, broadcastNewsUpdates: true } }, { module: 'MMM-page-indicator', position: 'bottom_bar', config: { pages: 3, } }, ] }; /*************** DO NOT EDIT THE LINE BELOW ***************/ if (typeof module !== "undefined") {module.exports = config;}
-
@jsn0327 the rules
things to the left of : do not need quotes
things to the right of : do not need quotes if they are numbers or true/false, otherwise they need quotesif the thing on a line is NOT } or ]
then the line above it must have a trailing comma, aka, more to follow.if u get an unexpected token error, look to the line before, and check for the trailing comma
in this case
vcgencmd: "vcgencmd" notifications: [
-
@jsn0327 and then after starting mm u do Alexa discover devices
u need one of the older echo or dot.
Amazon removed the built-in support for wemo devices in the show, and newer echo devices
-
@jsn0327 all the module config stuff has to be inside the config:{}
{ module: 'name', config:{ ... ... } }
u have notifications and other stuff outside the config section
-
@sdetweil Thank for the reply. I tried it the other way and received the same syntax error when running the config check. This is how I have it now, and am receiving the following error: [ERROR] Line 101 column 4: Parsing error: Unexpected token notifications
Before I added the notification section, I was able to discover devices with my Echo Spot and control the Magic Mirror through Alexa by turning the virtual switches off and on. I am now trying to expand the devices that I can control. I’m sure that I’m missing something simple, but I’ve gone through the installation and configuration instructions on Github and while they are pretty detailed with the basic installation and configuration of the built-in options, they aren’t as detailed when it comes to integrating other modules.
module: 'MMM-AlexaControl', position: 'bottom_right', config:{ image: true, height: 75, width: 75, pages: 25, pm2ProcessName: "MagicMirror", vcgencmd: "vcgencmd" notifications: [ { name: 'Next page', port: 11100, OnOff: false, notification: ["PAGE_INCREMENT", "payload"] } ] }
-
@jsn0327 the rules
things to the left of : do not need quotes
things to the right of : do not need quotes if they are numbers or true/false, otherwise they need quotesif the thing on a line is NOT } or ]
then the line above it must have a trailing comma, aka, more to follow.if u get an unexpected token error, look to the line before, and check for the trailing comma
in this case
vcgencmd: "vcgencmd" notifications: [
-
@sdetweil The comma fixed it! Thanks! I figured that it had to be something simple that I was overlooking.