This repository provides a custom Node-RED node that allows you to connect to the Google Calendar API, retrieve events, and work with both full-day and timed events. The node offers an intuitive interface for selecting calendars and date ranges, with OAuth2 authentication to securely access your Google Calendar.
- OAuth2 Authentication: Secure integration with Google Calendar through OAuth2.
- Retrieve Events: Fetch events between specific start and end dates.
- Full-Day Event Support: Easily switch between full-day events and events with specific time ranges.
- Dynamic Calendar List: Automatically loads available calendars and provides them in a dropdown.
- Configurable UI in Node-RED: Easy to configure via the Node-RED editor.
Before using this node, ensure you have:
- A Google Cloud Project with the Google Calendar API enabled.
- OAuth2 credentials (Client ID and Client Secret) created in the Google Cloud Console.
- Node-RED installed on your system.
Via Manage Palette -> Search for "@fdecourt/node-red-google-calendar-events"
Basic installation:
go to the Node-RED "userDir" folder, typically ~/.node-red run npm install node-red-contrib-moment To get the latest development version, install with:
run npm install fdecourt/node-red-google-calendar-events
The google-calendar-config
node is responsible for handling OAuth2 authentication with Google Calendar. This requires creating a project in the Google Cloud Console and obtaining OAuth2 credentials.
- Go to the Google Cloud Console.
- Create a new Web App project and enable the Google Calendar API.
- Create OAuth 2.0 credentials by setting up a Client ID and Client Secret.
- In the Node-RED editor, the
google-calendar-config
node will generate a redirect URI. Copy this URI and add it to your Authorized Redirect URIs in the Google Cloud Console. - Use the Client ID and Client Secret generated in Google Cloud Console and enter them in the
google-calendar-config
node in Node-RED. - Click Authenticate with Google to start the OAuth2 process. Follow the prompts to authorize your Node-RED instance to access your Google Calendar.
This node retrieves events from your Google Calendar. Configure the following fields:
- Calendar: This dropdown will be populated dynamically with your available Google Calendars once authentication is completed.
- Start Date: The date and time from which you want to retrieve events.
- End Date: The date and time until which you want to retrieve events.
- Full-Day Events: If you want to retrieve full-day events, check the box. If unchecked, you will retrieve events within specific time frames.
- Drag the
google-calendar-events
node into your flow. - Configure the node by adding a new Google Calendar Configuration
- Add the Client ID and Client Secret from your Google Cloud Console to the node's configuration.
- Click on Authenticate with Google to log in and authorize access to your Google Calendar.
- Select the calendar and set the date range (start and end dates).
- Deploy the flow and start retrieving events from your Google Calendar.
You can dynamically override parameters like calendar, start and end, using msg.calendar, msg.start, msg.end. be aware that the calendar you want to use must be identified by its ID (you can find it when opening the google-calendar-events node)
If using it with NodeRed as a plugin in HomeAssistant, you may need to reenter yoiur HomeAssistant Login / Password during the authorization process with Google Agenda.
If using NginxProxyManager (NPM), you may have to configure a specific location, to allow it to work :
- NODERED_IP : this is the IP address of your NodeRed installation.
- NODERED_PORT : this is the NodeRed port (if using through HomeAssistant, it is not the HomeAssistant Port, but the NodeRed one)
This one is working for me :
location /google-calendar/ {
proxy_pass http://NODERED_IP:NODERED_PORT/google-calendar/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
}