Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update birthday list every hour #9

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .release-it.json

This file was deleted.

6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
BSD 3-Clause License

Copyright (c) 2018, Jan Syring-Lingenfelder
Copyright (c) 2022, Ulrich Wisser

All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
14 changes: 14 additions & 0 deletions MMM-CardDavBirthdaysProvider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Module.register("MMM-CardDavBirthdaysProvider", {
defaults: {},
start: function() {
this.sendSocketNotification('CONFIG', this.config);
Log.info(this.name + " is started");
},
getDom: function() {
let self = this
var wrapper = document.createElement("div");
wrapper.id = "carddav";
wrapper.style.display = "none";
return wrapper
},
})
6 changes: 0 additions & 6 deletions MMM-GoogleBirthdaysProvider.js

This file was deleted.

105 changes: 60 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,76 @@
# GoogleBirthdaysProvider
[![License](https://img.shields.io/github/license/ulrichwisser/MMM-CardDavBirthdaysProvider.svg?style=flat-square)](https://github.com/ulrichwisser/MMM-CardDavBirthdaysProvider/blob/master/LICENSE.md)

A [MagicMirror²](https://magicmirror.builders/) helper to include the birthdays of your Google Contacts in the default calendar.
# MMM-CardDavBirthdaysProvider
Forked from [MMM-GoogleBirthdaysProvider](https://github.com/PalatinCoder/MMM-GoogleBirthdaysProvider).

A *big* thank you to PalatinCoder for the original code.

[![GitHub tag](https://img.shields.io/github/tag/PalatinCoder/MMM-GoogleBirthdaysProvider.svg?style=flat-square)](https://github.com/PalatinCoder/MMM-GoogleBirthdaysProvider/releases)
[![Travis](https://img.shields.io/travis/com/PalatinCoder/MMM-GoogleBirthdaysProvider.svg?style=flat-square)](https://travis-ci.com/PalatinCoder/MMM-GoogleBirthdaysProvider)
[![License](https://img.shields.io/github/license/PalatinCoder/MMM-GoogleBirthdaysProvider.svg?style=flat-square)](https://github.com/PalatinCoder/MMM-GoogleBirthdaysProvider/blob/master/LICENSE.md)

> ## 🛠 Work in progress
> The module is kind of a MVP (minimum viable product) at the moment. That means you can use it in your setup, but things will definitely change on the way to v1.0.
> Also, be aware that there are some [known issues](#known-limitations--issues)! Use it with care 😉
> Please open an issue or cantact me with any questions or error reports.

## How it works

The module reads the birthdays of your Google Contacts via Google's People API and exposes them as an iCal Feed through an internal URL, so you can include it in the default calendar.
The module extracts birthdays from a Cardav feed and exposes them as an iCal Feed through an internal URL, so you can include it in the default calendar. The list of birthdays is updated every hour.

![Screenshot](screenshot.png)

## Prerequisites

You need to have a project setup on Google Cloud Platform for your mirror. If you use other Google Services (like the Directions API with MMM-MyCommute), you most likely already have a project.

To enable the People API:
1. Visit the [API Library](https://console.cloud.google.com/apis/library/people.googleapis.com) and click "Enable". Make sure you have the right project selected in the top menu.

After the API is enabled, you need to create credentials for the module.

2. From the [Overview](https://console.cloud.google.com/apis/api/people.googleapis.com/overview) of the People API, select "Credentials" on the left.
3. Click the button "Create credentials" and choose "OAuth client ID"
4. Select "Other" and give the client a recognizable name, like "MMM-GoogleBirthdaysProvider"
5. Click "Create"

You should be redirected to the credentials overview

6. Download the newly created credentials and set the file aside for now, you'll need it in a moment.

## Installation

1. In your `modules/` directory, `git clone https://github.com/PalatinCoder/MMM-GoogleBirthdaysProvider.git`
2. `cd` in the new `MMM-GoogleBirthdaysProvider` directory
1. In your `modules/` directory, `git clone https://github.com/ulrichwisser/MMM-CardDavBirthdaysProvider.git`
2. `cd` in the new `MMM-CardDavBirthdaysProvider` directory
3. `npm install --production` (note the production flag, so you don't get all the dev dependencies - you don't need them if you just want to use the module)
4. Place the JSON file with the credentials (from step 6 above) in `google-api-credentials/credentials.json`
5. Run `npm run token:generate` and follow the instructions. This will authorize your instance of the module against your GCP project and store an authorization token.
6. Add the module to your `config.js`:
```
{
module: "MMM-GoogleBirthdaysProvider",
config: {}
},
```
Note: Don't give the module a position, as it doesn't render any DOM at all

7. Add `http://localhost:8080/mmm-googlebirthdaysprovider` to your calendar URLs, something like this:
```
{
module: "MMM-CardDavBirthdaysProvider",
position: "top_left",
config: {
authMethod: 'Basic',
serverUrl: 'https://secure.carddav.example/',
credentials: {
username: 'username',
password: 'password',
},
},
},
```

Note: the module does not display anything. So you can chose any position of your liking.

MMM-CardDavBirthdaysProvider uses (tsdav)[https://www.npmjs.com/package/tsdav] from npm.io to retrieve carddav data. Please check the tsdav documentation for details on the credentials.

config should have three attributes "authMethod", "serverURL" and "credentials".

E.g
```
config : {
authMethod: 'Basic',
serverUrl: 'https://secure.carddav.example/',
credentials: {
username: 'username',
password: 'password',
},
},
```
or
```
config : {
authMethod: 'Oauth',
serverUrl: 'https://apidata.googleusercontent.com/caldav/v2/',
credentials: {
tokenUrl: 'https://accounts.google.com/o/oauth2/token',
username: 'YOUR_EMAIL_ADDRESS',
refreshToken: 'YOUR_REFRESH_TOKEN_WITH_CALDAV_PERMISSION',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please share instructions or a script for generating this token?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a pull request. And an old one at that. Totally the wrong place to ask for help.

That said, you need to follow the install instructions on https://github.com/PalatinCoder/MMM-GoogleBirthdaysProvider.
Good luck!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I am aware :) I have been following your updates to your fork and I noticed you are moving to CalDAV API and I am trying to get it working as well. Since you don't have the issues open on your fork, I figured I'll ask here. Let me know if you have a better suggestion for asking questions/ reporting issues for your fork.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have enabled issues and discussions on my repo, please feel free to take the question there.

clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
},
},
```

7. Add `http://localhost:8080/mmm-carddavbirthdaysprovider` to your calendar URLs, something like this:
```
(...)
{
Expand All @@ -59,7 +79,7 @@ You should be redirected to the credentials overview
config: {
calendars: [
{
url: 'http://localhost:8080/mmm-googlebirthdaysprovider',
url: 'http://localhost:8080/mmm-carddavbirthdaysprovider',
symbol: 'birthday-cake',
color: '#f00'
}
Expand All @@ -68,7 +88,7 @@ You should be redirected to the credentials overview
}
(...)
```
8. *(optional)* If you want to see which birthday it is, set the following:
8. *(optional)* If you want to see which birthday it is, set the following:
<details><summary>Config Options</summary>
<p>
Set `displayRepeatingCountTitle` to `true` and set the suffix for the count in the `repeatingCountTitle` in the calendar's options, like so:
Expand All @@ -82,7 +102,7 @@ You should be redirected to the credentials overview
displayRepeatingCountTitle: true,
calendars: [
{
url: 'http://localhost:8080/mmm-googlebirthdaysprovider',
url: 'http://localhost:8080/mmm-carddavbirthdaysprovider',
symbol: 'birthday-cake',
repeatingCountTitle: "Birthday"
color: '#f00'
Expand All @@ -96,8 +116,3 @@ You should be redirected to the credentials overview
9. That's it, now have fun 😉

## Known Limitations / Issues
* Birthdays are only fetched once, when the node_helper is initialized. Should do that regularly
* Birthdays which *don't have a year set* are automatically set to the current year (at the time of fetching the data). That means you won't see birthdays in January during December
* By now, all birthday events are set to the current year, thus you won't see next year's birthdays untils new years day
* Only one google account is supported
* there is no pagination implemented for the data returned by Google People API. Thus, the maximum number of contacts available is 2000 (hard limit on google's side).
6 changes: 0 additions & 6 deletions google-api-credentials/README.md

This file was deleted.

39 changes: 0 additions & 39 deletions google-api-credentials/generate-auth-token.js

This file was deleted.

59 changes: 0 additions & 59 deletions google-api-helper.js

This file was deleted.

Loading