Read the statement by Michael Teeuw here.
MMM-Carousel config.js Help Please
-
Hello. I’ve been trying to program one of my MM projects with a small screen. After a long process, and lots of help on this forum, I’ve finally got my project working with the LCD I’m using. I’ve been researching about the MMM-Carousel module and I am a bit confused with the configuration. I’ve had a look around and don’t seem to have an answer for my question. I apologise in advance if I’m being really thick or missed the answer.
Having a look at the config for the Global setting, it’s my understanding that my
config.js
file should look something like this:var config = { modules: [ { module: 'MMM-Carousel', config: { transitionInterval: 10000, ignoreModules: ['clock'], mode: 'global' } } ] }
I guess I’m having trouble getting the code to work with the configuration of the other modules I’m using, still being in my
config.js
. When I try to add the above to my existingconfig.js
I get an error and it tells my my config is wrong. I have tried adding just this to my config just undervar config = {
and still got an error:{ module: 'MMM-Carousel', config: { transitionInterval: 10000, ignoreModules: ['clock'], mode: 'global' } }
Can someone please help me with this? Below is my working
config.js
with the API Keys redacted. How do I integrate these with the MMM-Carousel config? I essentially want each module to show full screen for a certain duration before flipping to the next, making them much more readable on my 4 inch display. Any help is greatly appreciated./* Magic Mirror Config Sample * * By Michael Teeuw http://michaelteeuw.nl * MIT Licensed. * * For more information how you can configurate this file * See https://github.com/MichMich/MagicMirror#configuration * */ var config = { address: "localhost", // 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, is "localhost" port: 8080, ipWhitelist: ["::fff:0.0.0.0/1", "::fff:128.0.0.0/2", "::fff:192.0.0.0/3", "::fff:224.0.0.0/4", "127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses // or add a specific IPv4 of 192.168.1.5 : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"], // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"], language: "en", timeFormat: 24, units: "imperial", modules: [ { module: "alert", }, { module: "clock", position: "top_left" }, { module: "calendar", header: "What are we doing?", position: "top_left", config: { calendars: [ { symbol: "calendar-check-o ", url: "webcal://my.secret.link.to.shared.calendar" } ] } }, { module: 'MMM-TFL', position: 'bottom_right', // This can be any of the regions but works best on either side of the display config: { updateTime: 600000, modes: ['tube', 'overground', 'national-rail'], lines: ['c2c', 'bakerloo', 'central', 'district', 'hammersmith-city', 'jubilee', 'metropolitan', 'northern', 'piccadilly', 'victoria', 'waterloo-city'], } }, { units: "imperial", module: "currentweather", position: "top_right", config: { location: "*****", locationID: "*******", //ID from http://www.openweathermap.org/help/city_list.txt appid: "********************************", roundTemp: 'true', degreeLabel: 'true', showPeriod: 'fasle', onlyTemp: false, iconTable: { '01d': 'wi-day-sunny', '02d': 'wi-day-cloudy', '03d': 'wi-cloudy', '04d': 'wi-cloudy-windy', '09d': 'wi-showers', '10d': 'wi-rain', '11d': 'wi-thunderstorm', '13d': 'wi-snow', '50d': 'wi-fog', '01n': 'wi-night', '02n': 'wi-night-cloudy', '03n': 'wi-night-cloudy', '04n': 'wi-night-cloudy', '09n': 'wi-night-showers', '10n': 'wi-night-rain', '11n': 'wi-night-thunderstorm', '13n': 'wi-night-snow', '50n': 'wi-night-alt-cloudy-windy' } } }, { units: "imperial", module: "weatherforecast", position: "top_right", header: "Weather Forecast", config: { location: "******", locationID: "*******", //ID from http://www.openweathermap.org/help/city_list.txt appid: "********************************" } }, { module: 'MMM-UKNationalRail', position: 'bottom_left', header: 'Departures', //Optional - delete this line to turn OFF the header completely config: { stationCode: '***', // CRS code for station app_id: '*********', // TransportAPI App ID app_key: '********************', // TransportAPI App Key maxResults: 5, //Optional - Maximum results to display. showOrigin: false //Optional - Show the origin of the train in the table } }, ] }; /*************** DO NOT EDIT THE LINE BELOW ***************/ if (typeof module !== "undefined") {module.exports = config;}
-
@aecandroid from the ~/MagicMirror folder, run
npm config:check
to check the syntax of the config file.
find and fix errors, repeat til none
-
@sdetweil Thanks for your help. Unfortunately that doesn’t seem to be working for me. I can’t post what it’s telling me as the reply keeps getting flagged for spam? Essentially it’s telling me the proper usage of npm and asking if I meant
npm config
. Maybe I’m doing something wrong? I’m doingcd MagicMirror
thennpm config:check
. Sorry, it would be much easier if I could copy / paste but for whatever reason, it won’t let me. -
@aecandroid ok try
npm run config:check -
@sdetweil thanks, that worked. Looks like I’ve got some clean up to do in my initial code before moving on. I’ll clean this up tonight and implement the new module tomorrow. Thanks again for your help.
-
@sdetweil Thanks for the
npm run config:check
That has helped me to clean up myconfig.js
to not have any errors. After fixing all the issues (mainly with the use of ( ’ ) as opposed to ( " ), which is confusing when most of the code already written uses the single quote instead of the double?) I then went to add the Carousel to the top of my code as below:/* Magic Mirror Config Sample * * By Michael Teeuw http://michaelteeuw.nl * MIT Licensed. * * For more information how you can configurate this file * See https://github.com/MichMich/MagicMirror#configuration * */ var config = { address: "localhost", // 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, is "localhost" port: 8080, ipWhitelist: ["::fff:0.0.0.0/1", "::fff:128.0.0.0/2", "::fff:192.0.0.0/3", "::fff:224.0.0.0/4", "127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses // or add a specific IPv4 of 192.168.1.5 : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"], // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"], language: "en", timeFormat: 24, units: "imperial", modules: [ { module: "MMM-Carousel", config: { transitionInterval: 10000, mode: "global" } } { module: "alert", }, { module: "clock", position: "top_left" }, { module: "calendar", header: "What are we doing?", position: "top_left", config: { calendars: [ { symbol: "calendar-check-o ", url: "webcal://it's-still-my-secret.ical" } ] } }, { module: "MMM-TFL", position: "bottom_right", // This can be any of the regions but works best on either side of the display config: { updateTime: 600000, modes: ["tube", "overground", "national-rail"], lines: ["c2c", "bakerloo", "central", "district", "hammersmith-city", "jubilee", "metropolitan", "northern", "piccadilly", "victoria", "waterloo-city"], } }, { units: "imperial", module: "currentweather", position: "top_right", config: { location: "*****", locationID: "********", //ID from http://www.openweathermap.org/help/city_list.txt appid: "********************************", roundTemp: "true", degreeLabel: "true", showPeriod: "fasle", onlyTemp: false, iconTable: { "01d": "wi-day-sunny", "02d": "wi-day-cloudy", "03d": "wi-cloudy", "04d": "wi-cloudy-windy", "09d": "wi-showers", "10d": "wi-rain", "11d": "wi-thunderstorm", "13d": "wi-snow", "50d": "wi-fog", "01n": "wi-night", "02n": "wi-night-cloudy", "03n": "wi-night-cloudy", "04n": "wi-night-cloudy", "09n": "wi-night-showers", "10n": "wi-night-rain", "11n": "wi-night-thunderstorm", "13n": "wi-night-snow", "50n": "wi-night-alt-cloudy-windy" } } }, { units: "imperial", module: "weatherforecast", position: "top_right", header: "Weather Forecast", config: { location: "London", locationID: "*******", //ID from http://www.openweathermap.org/help/city_list.txt appid: "********************************" } }, { module: "MMM-UKNationalRail", position: "bottom_left", header: "Departures", //Optional - delete this line to turn OFF the header completely config: { stationCode: "***", // CRS code for station app_id: "********", // TransportAPI App ID app_key: "*********************************", // TransportAPI App Key maxResults: 5, //Optional - Maximum results to display. showOrigin: false //Optional - Show the origin of the train in the table } }, ] }; /*************** DO NOT EDIT THE LINE BELOW ***************/ if (typeof module !== "undefined") {module.exports = config;}
With the code implemented at the top, I ran
npm run config:check
and it now comes back that it doesn’t like the{
before "module: "alert"
, referring to it as an Unexpected token. When I’ve taken that out, it says the Unexpected token is nowmodule
. I’m thinking I’m missing something that should be there as opposed to something that shouldn’t but I’m not sure what the token it’s expecting is? -
@aecandroid said in MMM-Carousel config.js Help Please:
} { module: "alert",
yes,
each module is
{ module: name, config: { } }, //< ---- note the trailing comma
there is a missing comma before the module alert {
-
@sdetweil right you are!! “Your configuration file doesn’t contain syntax errors :)” is now what I’m seeing. Thank you for all your help.
-
@sdetweil right, feeling pretty stupid at the moment. I’ve added the code with global setting but it doesn’t appear to have changed anything. No errors are coming up. Do I need to add or change any code of the existing modules in my config? I was a bit confused as most modules need an
npm install
but this one doesn’t appear to need that according to the readme. Sorry to be a continuous pain. Your help is greatly appreciated. -
@aecandroid no idea. haven’t used this module.
a module needs an npm install ONLY IF is contains a package.json file