Download Calendar For Raspberry Pi

First you'll need to install the Adafruit_Blinka  library that provides the CircuitPython support in Python. This may also require enabling SPI on your platform and verifying you are running Python 3.Since Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready!

Next you will want to upload the credentials.json file that you saved in the last steps to your Pi into the main folder that you will be running your script. A good place is inside of /home/pi.

Install the Google API Package

There is one last set of packages that you will need to install in order to run this project:

pip3 install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib

Set your Timezone

If you haven't done so already, be sure your timezone is set correctly. A freshly setup Raspberry Pi is usually set to GMC by default. You can change it by typing:

sudo raspi-config

Then select Localisation Options and Change Time Zone. This will ensure that everything displays with the correct time and date. You can find more information about using raspi-config in the official documentation.

Upload the Project Files

In order to communicate with the Google Calendar API, you will need what is called an OAuth token. The first time you run the script (available on the Event Calendar Code page of this guide), you will be given a URL that you can paste into your browser to finish the token setup procedure. Go ahead and upload the script to the same folder that you uploaded the credentials file. Run the script by typing the following:

python3 event_calendar.py

Generating an OAuth Token

If you haven't previously run the script, you will be taken through a process that generates an OAuth token, which allows the application to communicate with the Google Calendar API securely.

  • eink___epaper_generate_token.png

The script should provide a URL to visit to generate the token. Go ahead and copy and paste the URL into a browser.

  • eink___epaper_security_error.png
  • eink___epaper_security_error.png
  • eink___epaper_security_error2.png

You may run into an alert that says your app isn't verified. Go ahead and click on the Advanced link.

That will expand the dialog. Click Go to Quickstart (unsafe) or whatever you decided on for a project name.

  • eink___epaper_permissions.png

Next, you will be asked to grant permissions to view your calendar. Go ahead and click Allow.

  • eink___epaper_confirm_choices.png

After all that, it will come up with a confirmation dialog with your account name and the permissions that you are granting. Go ahead and click on Allow.

  • eink___epaper_key.png

Finally, you will be given an Authorization Code. Click on the Copy icon and it will get copied to your clipboard.

  • eink___epaper_paste_token.png

Paste the Authorization Code back into the Python script and the token will be generated and saved for next time.

The script will automatically resume and your E-Ink display should be updated with the next event in your calendar.

  • eink___epaper_IMG_2265_2.jpeg

You should now see something similar to this on your ePaper display.

Resetting your token

If for whatever reason you would like reset your token, you can do so by removing the file token.pickle from the same folder where you ran the script:

rm token.pickle

Just re-run the event calendar to go through the steps again.

This guide was first published on Jul 22, 2020. It was last updated on 2021-05-28 17:35:31 -0400.

This page (Raspberry Pi Setup) was last updated on Nov 27, 2021.

Text editor powered by tinymce.

Source: https://learn.adafruit.com/raspberry-pi-e-ink-desk-calendar-using-python/raspberry-pi-setup

Posted by: jannhiguerae0194331.blogspot.com

Post a Comment

Previous Post Next Post