Building a Family Week Planner

Building a Family Week Planner

“Are you home Thursday night, or do you have yoga?”

“Are the kids going anywhere this weekend?”

“I’m sure I mentioned that!”

I’ve wanted to build a family week planner for ages that puts everyone’s week on a easy to read screen somewhere in the house. Maybe somewhat surprisingly, I’m not a big fan of home automation or a “smart” house, so I don’t want this thing to alert me in the morning that “Today J has five appointments blah blah”. I just want to be able to look at it every now and again and see what’s coming up.

I used to run an Exchange server for all my various email accounts, and that was good, but it started becoming an issue with out-of-date software. The option to move to O365 was there, but it feels expensive, especially since several of the accounts are for the kids and aren’t “serious” mailboxen.

I spun up a cheap (US$10/month) Ubuntu server on Linode and ran the setup script for Mail-in-a-Box, which has worked (touch wood) nearly perfectly since. The issues so far have been pretty minimal. Microsoft was blocking my IP address for all Outlook-themed email services (live.com, hotmail.com, etc), but emailing them asking them to stop worked. When I reboot the server, the Outlook app on an iPhone stops syncing, and the account has to be removed and re-added. I also need to figure out how to make it send calendar invites properly over email.

Considering I have about 10 mailboxen on there, I’m way ahead in terms of cost.

The Mail-in-a-Box script installs NextCloud (an OwnCloud fork), which has a WebDAV implementation for calendar and contacts.

Step 1 for getting a week planner up will be to figure out how to interrogate the CalDAV server with some sort of programming language. I’m comfortable with PHP, so that’s what I’m going to do it with. Specifically, using cURL from PHP and then stuffing the results into an array to display later.

A bit of reading and digging in the WebDAV standards has lead me to being able to grab calendar entries for an account on the serer with the following command:

curl --request REPORT --header "Depth: 1" --header "Content-Type: text/xml" --data "<c:calendar-query xmlns:d='DAV:' xmlns:c='urn:ietf:params:xml:ns:caldav'><d:prop><d:getetag /><c:calendar-data /></d:prop><c:filter><c:comp-filter name='VCALENDAR'><c:comp-filter name='VEVENT'><c:time-range start='20210218T000000' end='20210225T000000'/></c:comp-filter></c:comp-filter></c:filter></c:calendar-query>" --user nextclouduser:nextcloudpass https://box.example.com/cloud/remote.php/dav/calendars/nextclouduser/personal/

The time-range field will limit the calendar entries that will be grabbed based on the starting-time.

This spits forth a large blob of data that will be interrogated later.

There will be tricky things to over-come like multi-day events and the like, but based on some work I’ve done previously with a calendar and loading events, I think I have a plan.

That’s step 1 done.

Step 2 to come.