eouia / MMM-CalendarExt

Calendar views for MagicMirror
MIT License
55 stars 18 forks source link

Cannot load module #4

Closed rohitsoni77 closed 7 years ago

rohitsoni77 commented 7 years ago

I have declared the following configuration:

{ module: 'MMM-CalendarExt', header: 'Calendar', position: "top_left", //anywhere. It is not related to real position of view config: { // Read below defaultView: { position: 'bottom_bar', positionOrder: -1, overflowRolling: 0, overflowHeight: 0, overflowDuration: 2, timeFormat: 'HH:mm', dateFormat: "MMM Do", fullDayEventDateFormat: "MMM Do", ellipsis: 0, limit:0, oneLineEvent:0, replaceTitle:[], classPattern:[], classPatternWhere:["title"] }, calendars: [ { url: "mycalendar.ics", view: ['month', 'upcoming'], styleName: "style1", symbol: 'us@fi', maxEntries: 50, maxDays:365, interval: 246060*1000, name: 'My calendar' } ] }

}

But when I try to start the magic mirror , it throws config error and when I change the name of the module from MMM-CalendarExt to CalendarExt or anything else , it starts, but even after starting it shows blank screen ,the error seen in the Chrome developer tools is :

loader.js:190 Error on loading script: modules/CalendarExt//CalendarExt.js

Not sure why its not loading with name MMM-CalendarExt , the error while starting is :

WARNING! Could not validate config file. Please correct syntax errors. Starting with default configuration. Loading module helpers ... Whoops! There was an uncaught exception... [SyntaxError: Unexpected token =]

eouia commented 7 years ago

Hi, @rohitsoni77 I tried your config, but the error is not found.

        {
module: 'MMM-CalendarExt',
header: 'Calendar',
position: "top_left", //anywhere. It is not related to real position of view
config: { // Read below
defaultView: {
position: 'bottom_bar',
positionOrder: -1,
overflowRolling: 0,
overflowHeight: 0,
overflowDuration: 2,
timeFormat: 'HH:mm',
dateFormat: "MMM Do",
fullDayEventDateFormat: "MMM Do",
ellipsis: 0,
limit:0,
oneLineEvent:0,
replaceTitle:[],
classPattern:[],
classPatternWhere:["title"]
},
calendars: [
{
url: "http://mlb.am/tix/mariners_schedule_full",
view: ['month', 'upcoming'],
styleName: "style1",
symbol: 'us@fi',
maxEntries: 50,
maxDays:365,
interval: 246060*1000,
name: 'My calendar'
}
]
}

}

I copied and pasted all your config code to my test machine, just filled url for sample(MLB Seattle Mariners)

You had some mistakes in config, but it is not related to your problem. Anyway, I cannot find any other suspicious about your issue. And the error message which you got means you have some misspelling in your config(I don't know where it might be, but only about your config for my module, it looks fine.)

Not related to your current issue, you need to fix some mistakes;

  1. this module is not shown where you declare in config like other modules. so, position on 3 lines is useless. The title will be shown in 'top_left' but, your real views are not there.
  2. on each calendar, views are right, not view
    calendars: [
    {
    url: "http://mlb.am/tix/mariners_schedule_full",
    views: ['month', 'upcoming'],
    styleName: "style1",
  3. you should declare which 'view' will be shown in system section. like this;
    config: {
    system: {
    show: ["month", "upcoming", "daily"] // default is 'daily'.
    },

Here is a simple sample config. you can start here.

{
    module: 'MMM-CalendarExt',
    position: "top_left",
    config: {
        system: {
        show: ["month"],
        },
        calendars: [
          {
            url: "http://mlb.am/tix/mariners_schedule_full",
            views: ['month'],
            styleName: "style1",
            symbol: 'us@fi',
            maxEntries: 50,
            maxDays:365,
            interval: 246060*1000,
            name: 'My calendar'
          }
        ]
      }
}
rohitsoni77 commented 7 years ago

I tried as you suggested , but still the same issue , pasting the full config.js content :

/ Magic Mirror Config Sample

var config = { port: 8080, ipWhitelist: ["127.0.0.1", "172.16.0.2","::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: "metric",

modules: [
{
    module: 'MMM-CalendarExt',
        position: "top_left", //anywhere. It is not related to real position of view
            config: { // Read below
                    system: {
                            show: ["month", "upcoming"],
                                    },
                                            calendars: [
                                                    {
                                                                url: "http://mlb.am/tix/mariners_schedule_full",
                                                                            views: ['month', 'upcoming'],
                                                                                        styleName: "style1",
                                                                                                    symbol: 'us@fi',
                                                                                                                maxEntries: 50,
                                                                                                                            maxDays:365,
                                                                                                                                        interval: 246060*1000,
                                                                                                                                                    name: 'My calendar'
                                                                                                                                                            }
                                                                                                                                                                  ]
                                                                                                                                                                      }
                                                                                                                                                                      }
]

}; / DO NOT EDIT THE LINE BELOW / if (typeof module !== "undefined") {module.exports = config;}

Renaming module name from MMM-CalendarExt to CalendarExt , I am able to start , but then the js is not loaded because of wrong name

eouia commented 7 years ago

Ok. I'll try. And give me more information.

eouia commented 7 years ago

I've tested your config. I didn't get any error. (on MacOSX, Raspberry Pi 3 model B, Asus Tinker Board tested. all with MagicMirror version 2.1.2) I think your error is not related to module itself, just configuration problem. But I cannot figure out what problem it is. MagicMirror configuration is so notorious.

The last thing I can suggest is, re-install your magic mirror and my module. I hope you get a good luck.

eouia commented 7 years ago

Have you still problem? I will close this issue.