This module is a customization from MagicMirror's default calendar module to display your Google calendars (including the Google Family calendar) without needing to make calendars public or using iCals. Inspired by the GoogleTask module.
- The Google Node.js client library: For authentication and Google Calendar API (v3). See Installation for instructions
To install the module, use your terminal to:
- Navigate to your MagicMirror's modules folder. If you are using the default installation directory, use the command:
cd ~/MagicMirror/modules
- Clone the module:
git clone https://github.com/randomBrainstormer/MMM-GoogleCalendar.git
- Install Google API:
npm install googleapis
Before you can add your calendar you need to setup the Google Calendar API and OAuth2 client from the Google Cloud Platform:
- Go here, and follow the instructions found in the
prerequisites
to create the Google Cloud project (you could also use an existing project if you wish). - Once you have enabled setup the project and created your OAuth ID client, download the client ID as
json
(look for the download option) and rename itcredentials.json
. - Move
credentials.json
to your MMM-GoogleCalendar directory (MagicMirror/modules/MMM-GoogleCalendar/) - Enable Google Calendar API. Select the same project as in step 1.
- Run this command from the MMM-GoogleCalendar directory:
node authorize.js
and follow the instructions that will display in the console. - Follow the instructions shown after you run the command, it should print your calendar. Copy the ID of the calendar you want to the config.
To use this module, add the following configuration block to the modules array in the config/config.js
file:
var config = {
modules: [
...
{
module: 'MMM-GoogleCalendar',
header: "My Google Private Cal",
position: "top_left",
config: {
calendars: [
{
symbol: "calendar-week",
calendarID: "GoogleCalendarID" //mail id
},
{
symbol: "calendar-alt",
calendarID: "MyOtherGoogleCalID"
// other "calendar" options
},
],
...
// other "configuration" options
}
},
...
]
}
Although this module works with Google calendars only, most of the options from the original calendar module are supported, please check the MagicMirror² documentation. PRs with latest changes are always welcome.
Can this module display .ICS
calendars or any other format?
No, this module will only work with google calendar directly, the reason is that information in google calendars is stored in different format, thus no support for other calendar types. You could, however, use the default calendar module to view ICS.
Can't seem to get this working, what should I do?
Check out the troubleshooting guide below, if you don't find a solution for your problem feel free to open an issue here.
Error | Solution |
---|---|
While installing the module I get Error: Cannot find module... |
You're probably trying to execute the command in the wrong directory. Use the ls command to list the items in your current directory and navigate to where you've installed this module, by default the path is usually /home/pi/MagicMirror/modules/MMM-GoogleCalendar |
When installing the module I get TypeError: Cannot destructure property 'client_secret'.. |
The credentials file from Google Cloud is of the wrong type, make sure to create a credential for TV and unlimited input |
I restarted my raspberry, my calendars suddenly don't show anymore | Most likely the token expired and you have to reauthenticate with Google again. Just run node authorize.js as done in step 5. |