Micropython Timezone and DST library

As part of a personal project for my Pimoroni Presto, I worked up a timezone with DST support library (as well as an ical parser)
While I’m not great with Micropython yet, spent considerable time making it memory efficient and as fast as I could make it. Hopefully it’s of use to some of you.

Included in the repo are some utility scripts to generate and help keep the binary blob data up to date for timezone changes in the future

Here’s a quick shot of the app, since this is my actual work cal, I redacted a few things.
Event color borders change as it moves from future, to upcoming, to current, to past event.
Rear LEDs also change color, alerting upcoming meeting, ongoing, etc. and I think I have an audio alert buzzer to warn of upcoming as well (but also implemented a quiet hours, and since I do most of the work on it then, not sure if that’s working yet). I can swipe left/right to view a few additional pages of events, the datetime at the top is last time it refreshed. The % is free mem.
Swipe up changes between a dark and light theme, pull down implements a forced refresh of data.

This is my first microcontroller/micropython project, and as such I did use AI for troubleshooting and comment cleanup. But a result of several months of tweaking it to get it as efficient as I could, and realizing what a mess ical format is, and why there isn’t generally support for it with a microcontroller….

1 Like

Very true. I have done something very similar (see: GitHub - bablokb/pico-e-ink-daily: Display Daily Agenda on an E-Ink Display (version for Pico) ) but I leave the iCal processing to a little server process running on my Pi. The server only feeds a suitable json to the Pico, which is only in charge of creating the UI. So this also works on a less powerful Pico of the first generation. I actually use this with Pimoroni’s InkyFrame/InkyImpression line of displays.

Looks really nice 👍

I’m also working on adding calendar agenda on my presto dashboard, but I subscribed to my google calendar from home assistant, so now I can get a nice json output from ha to presto (especially since I already had the ha integration done for showing other stuff like temp etc. and controlling lights).

I’m gonna take a look at your timezone code, as that’s something I’m also interested in.

That would simplify things for sure. I have seen this HA presto dashboard project as well:
https://git.hack-hro.de/kmohrf/compresto

Thanks for pointing to that project, it’s really nice (although I have already seen it, and it’s partly the inspiration for my project as well).

You are indeed brave to tackle iCalendar parsing, particularly with recurrence rules. Of course, there are vanilla Python libraries for iCalendar, but they tend to rely on other libraries, and then you have to face down an entire stack of dependencies.

I have my own Python libraries for the low-level parsing (supporting the general format used by vCalendar, iCalendar and vCard), plus ones for the actual format, with recurrence handling integrated with a framework that actually models the represented data. There’s quite a lot of complexity to deal with.

And then there’s the matter of scheduling events, adding new recurrences, cancelling events, and so on…