MMM-GmailNotifier is a MagicMirror module that displays the user's Gmail profile picture and name, and checks for unread emails in the inbox.
Features
- Displays the profile name and profile picture from the Gmail account.
- Shows the number of unread emails.
- Automatically hides email notifications if there are no unread emails.
Follow these steps to install and configure MMM-GmailNotifier:
cd ~/MagicMirror/modules
git clone https://github.com/kurtern84/MMM-GmailNotifier.git
cd MMM-GmailNotifier
npm install
- Go to the Google Cloud Console.
- Create a new project or select an existing project.
- Navigate to "API & Services" > "Library" and enable the following APIs:
- Gmail API
- Google People API
- Go to "API & Services" > "Credentials" and click on "Create Credentials".
- Select "OAuth client ID".
- Configure the OAuth consent screen if you haven't already.
- Select "Desktop app" as the application type.
- Download the OAuth 2.0 Client ID JSON file and note down the client_id and client_secret.
{
module: "MMM-GmailNotifier",
position: "top_right", // Choose your desired position
config: {
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
userName: "Your Name"
}
},
- Start MagicMirror:
npm start
- Follow the instructions in the console to authorize the application. You will be prompted to visit a URL to grant permissions.
- Copy the authorization code from the browser and paste it into the console.
MMM-GmailNotifier/
├── node_helper.js
├── MMM-GmailNotifier.js
├── package.json
└── README.md
Keep the module up-to-date by pulling the latest changes:
cd ~/MagicMirror/modules/MMM-GmailNotifier
git pull
npm install
If you encounter issues while using MMM-GmailNotifier
, follow these steps to diagnose and resolve common problems:
invalid_grant
Error
- This error can occur for several reasons, including expired or revoked tokens, issues with OAuth2 configuration, or problems with the authorization code. Try the following steps to resolve it:
1.1 Delete token.json
File
- Delete the
token.json
file in theMMM-GmailNotifier
directory. This will force the application to generate a new authorization token on the next start.
cd ~/MagicMirror/modules/MMM-GmailNotifier
rm token.json
- Check OAuth Configuration
- Ensure that your
client_id
andclient_secret
are correct and up-to-date inconfig.js
. - If you have regenerated the client secret, update
config.js
with the new values.
- Reauthorize the Application
- Restart MagicMirror and follow the authorization process again to obtain a new authorization token.
npm start
- Follow the instructions in the console, visit the provided URL, and paste the authorization code.
To further diagnose issues, check the MagicMirror logs for error messages:
pm2 logs mm
For more details or questions, you can open an issue on the GitHub repository.
This project is licensed under the MIT License. See the LICENSE file for details.