Skip to content

add: support for multiple ICS and Google calendars.#115

Closed
KaeroDot wants to merge 1 commit into
mendhak:masterfrom
KaeroDot:master
Closed

add: support for multiple ICS and Google calendars.#115
KaeroDot wants to merge 1 commit into
mendhak:masterfrom
KaeroDot:master

Conversation

@KaeroDot

Copy link
Copy Markdown

I have added support for up to 5 google calendars and up to 5 ics calendars. All available calendars are fetched, events sorted and displayed together according the event start date. Personally I need to show up events from 2 google calendars and one ics calendar. I use my own layout with more calendar space (I will share this later).
Unfortunately I haven't got outlook or caldav calendars to test them also.

I had to modify time zone operations so the events from all calendars can be joined into one compatible array and properly sorted. Hopefully I have chosen proper approach.

Additionally, urlib3 version requirements had to be loosened otherwise I got compatibility issues:
The user requested urllib3==2.5.0
icalevents 0.3.0 depends on urllib3>=1.26.5
requests 2.28.1 depends on urllib3<1.27 and >=1.21.1

I have removed deprecated .utcnow().

urlib3 version requirements had to be fixed. Also removed deprecated .utcnow()
@mendhak

mendhak commented Apr 20, 2026

Copy link
Copy Markdown
Owner

Hi @KaeroDot thanks for the PR and appreciate your time, but apologies, I'm not looking to merge this, the reason is it's bringing the project to a complexity I'm just not comfortable with. It's also making the providers' behaviour mixed, and tbh ICS has been a pain to deal with, so I'm not keen on expanding it. But this does inspire me to consider whether I should ANDing the providers instead of ORing the providers as right now so at the very least thanks for that.

@mendhak mendhak closed this Apr 20, 2026
@KaeroDot

Copy link
Copy Markdown
Author

Ok, so I will have to divert my fork.
Only ANDing different providers makes only a partial sense, because (I believe) people usually got multiple calendars in one service, i.e. multiple calendars for one type of provider (personal google calendar, wife's google calendar, family's google calendar). Just ANDing would mean people would have to find some new service for every new calendar they would like to add.

@mendhak

mendhak commented Apr 21, 2026

Copy link
Copy Markdown
Owner

Ahhhh that's actually a good point. It makes more senseenseand multiple Google calendars than different providers.

OK I'll want to think on this a bit more because I also have to think of how I'm going to be testing each time I make changes which would go dramatically up, also want to provide consistency across all providers by allowing multiple.

Right now I'm leaning up just stick to single instances like now because it's simpler.

OK let me reopen for now while this serves as a feature request: allow multiple instances of calendars from same provider.

@mendhak mendhak reopened this Apr 21, 2026
@KaeroDot

Copy link
Copy Markdown
Author

Yes, that is the issue of my pull request, I was not able to make the code for all types of providers. But it shows a way how to do it, it is tested for google and ics and it is backward compatible - it will not affect people who use only one calendar.
How you do a reliable testing, that eludes me completely, because it is not easy to cover all possible issues using real family calendars.

@mendhak

mendhak commented May 3, 2026

Copy link
Copy Markdown
Owner

Alright I've finally got something in progress here: https://github.com/mendhak/waveshare-epaper-display/pull/116/changes

I've moved from env.sh to config.toml, this was long overdue anyway. Moving to toml is useful here because it allows for any number of calendar providers in any combination.

As part of this I'm having to do some clean up and cache refactoring, so I think it'll take a bit of testing.

The key bit here is the config.toml.example file. It's a big change from env.sh but I feel it's necessary anyway, the env.sh was a 'temporary' thing that stuck around for too long

@mendhak

mendhak commented Jun 4, 2026

Copy link
Copy Markdown
Owner

#116 is almost ready so I'm closing this PR thanks.

@mendhak mendhak closed this Jun 4, 2026
@mendhak

mendhak commented Jun 21, 2026

Copy link
Copy Markdown
Owner

#116 is merged, so now the project structure has changed and there's a toml file instead of .env.

@feh123

feh123 commented Jun 24, 2026

Copy link
Copy Markdown

Hi @mendhak thanks for doing this. I only have one calendar - my Apple calendar ics (on an RPI running apache2). It works well although it only completely refreshes the events at midnight rather than at their actual end times! Not sure why.
Is it easy to update to the new structure? Thanks.

@mendhak

mendhak commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Hi @feh123 to update I would suggest taking a backup of your current folder, just in case. eg 'waveshare-epaper-display-backup'

Then redownload this repo again, the structure has changed completely. Importantly, the configuration is now in a config.toml instead of env.sh. Do the README initial setup, the python environment, pip install, etc.

Then make a copy of your old env.sh into the new folder.

Now, when you run.sh, it will complain, and tell you to run .venv/bin/python3 utils/migrate_env_to_toml.py.

When you run .venv/bin/python3 utils/migrate_env_to_toml.py it will generate a config.toml file output for you. Copy that into a new config.toml file, remove the env.sh, then run again.

Then it should work.

@feh123

feh123 commented Jun 25, 2026 via email

Copy link
Copy Markdown

@feh123

feh123 commented Jun 26, 2026

Copy link
Copy Markdown

Hi @mendhak although still very hot did have a try after cloning my current sd card! It all seemed to go well and your "copy. to toml script" was great. But I have hit a problem - undoubtedly somewhere I am making a mistake with the syntax of .toml files as I cut and paste into the config.toml.
The weather_get.py keeps reporting an error at line 11 import weather provider. It's a mystery to me - I have reset the api and have it working on my current Calendar. And I have changed the line position, the name (metoffice and metofficedatahub) and the use of "". I have also switched to openweathermap but no success. I am using VSC and checking the files in place with nano but nothing seems wrong. Could you send me a config.toml redacted as you wish to see if by copying your .toml file in structure and syntax I could find my error? Any thoughts appreciated!

@mendhak

mendhak commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Oh sorry you're running into that @feh123 You do have another option, you can do a startover and copy config.example.toml to config.toml. Then start editing the sections one by one. For metoffice just use 'metoffice' as the provider.

Here is my config.toml for reference anyway


# --------------------------------------------
# DISPLAY CONFIGURATION
# --------------------------------------------

[display]

waveshare_version = "2"

screen_output_layout = 1

# -------------------------------------------
# WEATHER CONFIGURATION
# Only the provider you name here will be used.
# Fill in the credentials for your chosen provider.
# You can leave the others empty or commented out.
# -------------------------------------------

[weather]
# Your location (required for all providers)
latitude  = 5xxxxx
longitude = -0.xxxxx

# Temperature: "CELSIUS" or "FAHRENHEIT"
format = "CELSIUS"

# How long to cache weather data (in seconds)
cache_ttl_seconds = 3600

# Choose ONE weather provider by setting this to one of:
#   metoffice, climacell, accuweather, openweathermap, metno, met_eireann, weathergov, smhi, visualcrossing
provider = "metoffice"

# MetOffice (UK)
[weather.providers.metoffice]
api_key = "eyJxxxxxxxxxxxxxxxx"



# -------------------------------------------
# ALERTS CONFIGURATION
# All provider blocks are shown below. Only the provider you named here
# will be used. Fill in the credentials for your chosen provider.
# -------------------------------------------

[alerts]
# Set to false to disable alerts entirely
enabled = true

# How long to cache alert data (in seconds)
cache_ttl_seconds = 3600

# Choose ONE alert provider by setting this to one of:
#   metoffice, met_eireann, weathergov
provider = "metoffice"


# MetOffice (UK)
[alerts.providers.metoffice]
feed_url = "https://www.metoffice.gov.uk/public/data/PWSCache/WarningsRSS/Region/se"



# --------------------------------------------
# CALENDAR CONFIGURATION
# You can enable multiple calendars by adding more [[calendar.providers.xyz]] blocks.
# Events from all enabled calendars will be merged and sorted by date.
# The [[double brackets]] are important here!
# --------------------------------------------

[calendar]
# How long to cache calendar data (in seconds)
cache_ttl_seconds = 3600

# Maximum number of events to display
max_events = 10

# Include all events from today, even if they're in the past
include_past_events_for_today = false

# Google Calendar
# You can add multiple Google calendars by adding more [[calendar.providers.google]] blocks
# Get your Calendar ID from Google Calendar Settings > Share this calendar
# Format: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@group.calendar.google.com
[[calendar.providers.google]]
enabled   = true
id        = "xxxxxxxxxxxxxxxxxx@group.calendar.google.com"
time_zone = "Europe/London"  # Optional: for family calendars that don't support timezone


# Outlook Calendar
# Run: python3 outlook_util.py to get available Calendar IDs
[[calendar.providers.outlook]]
enabled     = true
calendar_id = "AQMxxxxxxxxxxxxxxxxxxx"

# ICS Calendar
[[calendar.providers.ics]]
enabled = false
url     = "https://calendar.google.com/xxxxxxxxxxxxxxx.ics"


# ---------------------------------------------
# PRIVACY MODE
# ---------------------------------------------

[privacy]
# Display an XKCD comic instead of weather/calendar
xkcd = false

# Display a literary quote with clock instead of weather/calendar
literature_clock = false

# ---------------------------------------------
# LOCALIZATION & LOGGING
# ---------------------------------------------

[locale]
# Set a language locale (e.g., "en_GB.UTF-8", "ko_KR.UTF-8")
# Leave empty to use system default. Run `locale -a` to see available locales.
language = ""

# Logging level: "DEBUG", "INFO", "WARNING", or "ERROR"
log_level = "DEBUG"


@mendhak

mendhak commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Do share the error you ran into as well in case it's something obvious that I missed. It might be easier to track this if you create a new issue, this is a closed PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants