Skip to content
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.

Configuration

Seongnoh Sean Yi edited this page Sep 15, 2018 · 35 revisions

Configuration

config.js structure

{
	module: 'MMM-CalendarExt',
	position: "top_left", //anywhere. It is not related to real position of view
	config: { // Read below
	  system:{ ... },
	  defaultView: { ... },
	  views: {
	    daily: { ... },
	    upcoming: { ... },
	    ...
	  },
          defaultCalendar: { ... },
	  calendars: [
	    { ... },
            { ... },
	    ...
	  ],
	  profileConfigs: {
	    "Tom" : { ... },
            ...
	  }
	},
}

system

namespace type description
system {} global values of modules.

example and default values: These values will be used automatically when you have not described.

system: {
  show: ['daily'],
  locale: '', //when omitted, default value would be your system default locale by moment.js
  showEmptyView: 1,
  fullDayEventLocalize: 1,
  redrawInterval: 30*60*1000, //minimum 60000
  useProfileConfig: 0,
  startProfile: ''
},
name type description
show Array of String Which view to show.
daily, weekly, monthly, month, weeks, upcoming, current are available. You can use all or some of these values.
The order of view in array is important because it decide the order of stack when views are shown in same region with positionOrder.
e.g)['daily', 'upcoming']
locale String Language and locale setting for Calendar. This is related with your moment.js. I don't know entire locale codes which are exactly supported. But major locale codes might be supported.
e.g)en, en-gb, de, fr-ca...
showEmptyView 1 or 0 1 for showing view frames when there is no event to show.
0 for hiding with no event.
fullDayEventLocalize 1 or 0 This is related with different timezones. If you live in Germany and want to show US Holiday, the fullDay event could be shown with non-sensed time because it is based US timezone.
1 for fix to your timezone locale.
0 for using original time.
redrawInterval Integer (milliseconds) minimum values: 60000
Calendar is not a countdown timer or alternative clock. However, You can refresh calendar view with this interval.
useProfileConfig 1 or 0 1 to enable custom configs per each profile.
0 to disable.
startProfile String When you set useProfileConfig:1, this profile will be used on start until CURRENT_PROFILE notification being received. if ommited, default global config will be used.
e.g) 'daddy' or 'Party mode' or ''

defaultView

namespace type description
defaultView {} default common values of each views. You can describe common values here, and omit in each view section.

example and default values: These values will be used automatically when you have not described in your config.

defaultView: {
  position: 'bottom_bar',
  positionOrder: -1,
  overflowRolling: 0,
  overflowHeight: 0,
  overflowDuration: 2,
  onlyStartingTime: 0,
  timeFormat: 'HH:mm',
  dateFormat: "MMM Do",
  fullDayEventDateFormat: "MMM Do",
  ellipsis: 0,
  limit:0,
  oneLineEvent:0,
  replaceTitle:[],
  classPattern:[],
  classPatternWhere:["title"],
  symbolPattern:[],
  symbolPatternWhere:["title"]
},
name type description
position String Where do you want to display calendar views? If you don't describe this in each view section, this value will be the default position of views until you redefine in each view section.
positionOrder -1, 0 or Any Integer -1 for appending view into the target region. this view will be displayed last in that region.(recommended)
0 for prepending view into target region. this view will be displayed first in that region.
n over 0 for inserting view after nth module in the target region. However, it may cause problem because you cannot know how many modules in that region at runtime.
overflowRolling 0 or 1 enable events rolling.
1 for rolling,
0 for not.
overflowHeight Integer When overflowed events are rolling, set the height of rolling area.
Never append px or %.
When overflowRolling is set with 0, this value makes overflow:hidden without rolling.
overflowDuration Float or Integer (seconds) When overflowed events are rolling, set the speed of rolling items.
onlyStartingTime 0 or 1 When you want to display only starting time/date, set this as 1
timeFormat String formatter of event time display. See the moment.js .format() for this and all other format patterns.
https://momentjs.com/docs/#/displaying/format/
dateFormat String formatter of event date display.
fullDayEventDateFormat String formatter of fullday event date. See the ...
ellipsis 0 or Any number You can shorten the title with this value.
0 for not truncating
limit 0 or Any number 0 for showing all the unlimited events of that period slot.
Any number for limit the number of events shown.
oneLineEvent 1 or 0 If you set this value to 1, Your event will be shown with 1-lined title and time and location so you can save the space of view.
0 for normal view.
replaceTitle Array of replacing patterns You can change the title of events by this. A normal text string or RegExp is available. See this.
classPattern Array of class patterns You can also assign specific className to event by this value. See Manipulation of looks
classPatternWhere Array of pattern searching locations You can search classPattern in here. title, description and location are available
e.g)["title", "location"]
symbolPattern Array of symbol patterns You can also assign specific symbol to event by this value. This is similiar with classPattern, but unlike classPattern, the last matched symbolPattern will overwrite previous.
symbolPatternWhere Array of pattern searching locations You can search symbolPattern in here. title, description and location are available
e.g)["title", "location"]

views

namespace type description
views {} 7 views of this calendar module. Each view should be configured before using. However, it was already preset with default defaultView values.

example and default values: These values will be used automatically when you have not described in your config.

views: {
	month: { ... },
        weeks: { ... },
	daily: { ... },
	weekly: { ... },
	monthly: { ... },
	current: { ... },
	upcoming: { ... },
},

views.month & views.weeks

name type description
month {} Month calendar view. (I don't know the exact name of this view. sorry. I'm not English user.).
From 4 to 6 weeks in a view. The looks of calendar depends on current locale setting.
weeks {} Unlike Month view, weeks view is not related with specific month. It shows several weeks including this week.

example and default values: These values will be used automatically when you have not described in your config.

views: {
	...
	month: {
		showWeeks: 1,
		weeksTitle: 'weeks',
		weeksFormat: 'wo',
		weekdayFormat: 'dd',
		titleFormat : 'D',
		overTitleFormat : 'MMM D',
		monthTitleFormat: "MMMM",
	},
        weeks: {
		showWeeks: 1,
		weeksTitle: 'weeks',
		weeksFormat: 'wo',
		weekdayFormat: 'dd',
		titleFormat : 'MMM D',
		overTitleFormat : 'MMM D',
		counts: 4,
	},
	...
},
name type description
showWeeks Integer 1 for showing weeks column
0 for not.
Warning: Weeks might be different by locale. In some cases, The start day of week would be Monday or Sunday by which locale you use. If you are a German who lives in U.S. currently, and you set the locale to 'de', the weeks could be different with those of U.S. This is not a bug but might be uncomfortable to use. I'll fix this someday by adding value of real life timezone.
weeksTitle String You can set the title of column with this.
weeksFormat String wo may be the best value. See moment.js formatter
weekdayFormat String dd or ddd or ...
titleFormat String title of day cell of this calendar.
overTitleFormat String Use this for last month or next month day cell.
monthTitleFormat String name of Month. or, anything you want.
counts Integer How much weeks you want to show. 4 means 4 weeks from this week.
(any fields of defaultView section) You can use any value of defaultView section to set specific configuration. This value will be used instead of defaultView value on this view.

views.daily, views.weekly, view.monthly

namespace type description
daily {} show events per day.
weekly {} show events per weeks.
Weeks could be different by locale.
monthly {} show events per month.

example and default values: These values will be used automatically when you have not described in your config.

views: {
	...
  daily: {
    direction: 'row',
    counts: 5,
    titleFormat: "D",
    overTitleFormat: "MMM D",
    subtitleFormat: "ddd",
  },
  weekly: {
    direction: 'row',
    counts: 4,
    titleFormat: "wo",
    overTitleFormat: "gggg wo",
    subtitleFormat: "MMM Do",
  },
  monthly: {
    direction: 'row',
    counts: 3,
    titleFormat: "MMMM",
    overTitleFormat: "YYYY MMM",
    subtitleFormat: "YYYY",
  },
	...
},
name type description
direction String available values: row, row-reverse, column, column-reverse
You can control the event slots direction.
row and row-reverse are good for horizontal region. column and column-reverse are good for vertical region. This value is meaningless in upcoming, current and month views.
counts Integer How much slots to show events.
e.g) counts : 3 for monthly will display 3 monthly slots and each slot has events of that month.
titleFormat String Title of Slot.
overTitleFormat String You can use this format when date of events is out of current range scope;
- in dialy view : the slots belong to next month.
- in weekly view : the slots belong to next year.
- in monthly view : the slots belong to next year.
It means you can display different title for next month slot in daily view.
subtitleFormat String You can add an additional subtitle into slot.
(any fields of defaultView section) You can use any value of defaultView section to set specific configuration. This value will be used instead of defaultView value on this view.

views.current, views.upcoming

namespace type description
current {} show events which be going currently.
upcoming {} show upcoming events from now.
Events already started are not included in this view.

example and default values: These values will be used automatically when you have not described in your config.

views: {
	...
  current: {
    title: 'Current',
    useRelative: 1
  },
  upcoming: {
    title: 'Upcoming',
    useRelative: 1
  },
  
	...
},
name type description
title String Title for this slot. It is not the formatter but just fixed text.
useRelative Integer 1 for using relative time. (See the .fromNow() of moment.js)
0 for using normal time.
(any fields of defaultView section) You can use any value of defaultView section to set specific configuration. This value will be used instead of defaultView value on this view.

defaultCalendar

namespace type description
defaultCalendar {} Default configuration values for each calendar. Values of this section will be applied in each calendar until you define value in specific calendar section.

example and default values: These values will be used automatically when you have not described in your config.

defaultCalendar: {
  profiles: [],
  views: [],
  symbol: "",
  styleName: "",
  replaceTitle:[],
  classPattern: [],
  classPatternWhere: ["title"],
  symbolPattern: [],
  symbolPatternWhere: ["title"],
  maxEntries:50,
  maxDays:180,
  interval: 1800000,
},
name type description
profiles Array of String You can use this array for assignment to profiles.
[] for all profiles.
[ ... ] for specific profiles.
e.g)['daddy', 'John'] for daddy and John.
views Array of String You can also assign calendar events to specific views.
[] for showing this calendar events in all views.
['daily', 'upcoming'] for showing this calendar events only in daily and upcoming views.
symbol String 'symbolname@symboltype' will show the event symbol.
These symboltypes are supported.
- '@fa' or omitted(default) : font-awesome
- '@md': Google Material Design
- '@fi' : flag-icon CSS
- '@em': emoji CSS
e.g)'trash-o','calendar@fa', 'pin@md', 'au@fi', '--1@em', ...
styleName String If you set this, this event will have class name selector with this value. You can customize the looks of events with this selector in CSS. There are 20 pre-defined styles in preset.css.(style1 - style20)
replaceTitle Array of replacing patterns You can also change the title of events here. view.replaceTitle will be applied to all events of that view, but this calendar.replaceTitle will be applied to only specific calendar
classPattern Array of class patterns See views.classPattern.
classPatternWhere Array of searching pattern locations See views.classPatternWhere.
symbolPattern Array of symbol patterns See views.symbolPattern.
symbolPatternWhere Array of searching pattern locations See views.symbolPatternWhere.
maxEntries Integer How many events will be fetched from this calendar,
maxDays Integer ... until this.
interval Integer (milliseconds)
Interval for fetching schedule.

calendars

namespace type description
calendars [] You can describe your configuration for calendars here.

example. Undescribed values could be defined in defaultCalendar.

calendars: [
  {
    name: "Schooldays of John",
    url: "https://school.com/schedule.ics",
    auth: {
      user:'john',
      pass:'abcd1234',
      method:'bearer'
    }
  },
  {
    name: "US Holiday",
    url: "webcal://www.calendarlabs.com/templates/ical/US-Holidays.ics",
    profile: ['daddy'],
    views: ['month', 'upcoming'],
    styleName: "style1",
    symbol: 'us@fi',
    maxEntries: 50,
    maxDays:365,
    interval: 24*60*60*1000,
  }
],
name type description
url String Required
webcal://, http://, https:// all of these are supported.
Warning: This module never check validation of this URL. You should put the valid URL of calendar.
name String Not Required, but Recommeded
Name of calendar.
It could be used in instant events or broadcasting events. It may not be unique value.
auth {} for authentification of calendar.
user, pass, method fields supported.
(any fields of defaultCalendar section) You can use any values of 'defaultCalendar` section to set specific configuration.

profileConfig

namespace type description
profileConfig {} You can use this config for specific profile with system.useProfileConfig:1

Warning: Use of profileConfig may cause uninteded recursive or referential configuration issues. use it carefully.

profileConfig: {
  "John": {
    ... // all configurations above could be here.
  },
  "daddy": {
    ...
  },
  ...
},

If useProfieConfig is set to 1 and here profileConfig is defined, you can change configuration by CURRENT_PROFILE notification. It will initialize all current configuration with this value.

Too difficult?

{
  module: 'MMM-CalendarExt',
  position: "top_left",
  config: {
    calendars: [
      {
        url: "http://mlb.am/tix/mariners_schedule_full"
      }
    ]
  }
},

You can start here. Don't be afraid.

Or here is slightly complexed but easy version.

    {
      //disabled:true,
      module: 'MMM-CalendarExt',
      position: "top_center",
      config: {
        system: {
          show: ["daily", "upcoming"],
          locale: 'en',
          redrawInterval:60000,
        },
        views: {
          daily: {
            position:'bottom_bar',
            counts:7,
          },
          upcoming: {
            position:'top_left',
            limit:5
          },
        },
        defaultCalendar: {
          maxEntries:50,
          maxDays:180,
          interval: 1000*60*5,
        },
        calendars :[
          {
            name: "deutschland",
            symbol: "calendar-o",
            styleName: "style1",
            url: "http://www.kayaposoft.com/enrico/ics/v1.0?country=deu&fromDate=01-01-2017&toDate=31-12-2017&region=Hesse"
          },
        ],
      }
    },