How to synchronize your Nokia N900's calendar with a caldav back end

Background/Intro

This tutorial uses syncevolution to synchronize your Nokia's calendar to a caldav calendar. It just uses syncevolution on the phone and sets it up to connect to caldav directly.

Versions

This has been tested with, syncevolution 1.3-1 on the phone.

Setting up syncevolution on the client (N900 phone)

  1. Get a list of databases (local calendars on mobile):
    # Get a list of databases
    syncevolution --print-databases
    ...
    Maemo Tasks = maemo-tasks:
       main (id:1) <default<
       Private (id:2)
       less important (id:5)
    ...
    

    Of interest is the section Maemo Calendar which defines all calendars defined on local device. In this example, we have 3 calendars, one is named N900, and another one less important

  2. Set some variables for the commands:
    PEER="n900"
    SERVER="server"
    SERVER_URL="https://www.hitchhiker.org.lu/caldav/caldav.php/alain/home/"
    LOCAL_DB="main"
    SERVER_USER="alain"
    SERVER_PASSWORD="pass"
    

    These variables are needed in the later steps,and have the following meaning:

    PEER
    identifier for the local device (the N900 itself), can be an opaque random string, which only needs to be the same in all commands
    LOCAL_DB
    Name under which the device itself knows the calendar (printed by the syncevolution --print-databases command above)
    SERVER
    identifier for the caldav server, can be an opaque random string, which only needs to be the same in all commands
    SERVER_URL
    The caldav URL under which the calendar on the server is available
    SERVER_USER
    User name to authenticate with the server
    SERVER_PASSWORD
    Password to authenticate with the server
  3. Create a server object:
    syncevolution --configure --template webdav @$SERVER
    

    $SERVER is just a random opaque identifier for the server. It only needs to match the same identifier in the next command, where we will configure a "source" (calendar back end) on this peer
  4. Configure the source of calendar data on server:
    syncevolution --configure \
      database="$SERVER_URL" \
      databaseUser="$SERVER_USER" databasePassword="$SERVER_PASSWORD" \
      "@$SERVER" calendar
    
  5. Create and configure a peer for representing the local calendar(s):
    syncevolution --configure --template SyncEvolution_Client \
      database="$LOCAL_DB" \
      syncURL="local://@$SERVER" \
      printChanges=false \
      dumpData=false \
      "$PEER" calendar
    

Synchronizing for the first time

The first time a synchronization is performed, you need to do a "slow" synchronization:
syncevolution --sync slow "$PEER" calendar

SSL issues

If your server is reached via SSL, it is possible that syncevolution won't be able to find your certification authority's key.

In that case, check whether /usr/lib/ssl/certs/ directory exists, and if not, symlink it to /etc/certs/common-ca (or copy contents from /etc/certs/common-ca to /usr/lib/ssl/certs/)

Adding a second calendar

  1. Define needed variables (in addition/replacement to those for first calendar):
    CALENDAR_NAME="calendar_less_important"
    SERVER_URL="https://www.hitchhiker.org.lu/caldav/caldav.php/alain/unimportant/"
    LOCAL_NAME="less important"
    SERVER_USER="alain"
    SERVER_PASSWORD="pass"
    

    These have the following meaning:
    CALENDAR_NAME
    Abstract identifier by which this calendar is known to syncevolution. Can be anything, only needs to match among the various commands.
    SERVER_URL
    URL of calendar on server
    LOCAL_DB
    Name of calendar on local device
    SERVER_USER
    User name to authenticate with the server
    SERVER_PASSWORD
    Password to authenticate with the server
  2. Add definition for calendar on server :
    syncevolution --configure \
      backend=CalDAV \
      database="$SERVER_URL" \
      databaseUser="$SERVER_USER" databasePassword="$SERVER_PASSWORD" \
      "@$SERVER" "$CALENDAR_NAME"
  3. Add definition for calendar on client :
    syncevolution --configure \
      sync=two-way \
      uri="$CALENDAR_NAME" \
      backend=calendar \
      database="$LOCAL_NAME" \
      "$PEER" "$CALENDAR_NAME"
    
  4. Do a slow synchronization:
    syncevolution --sync slow "$PEER" "$CALENDAR_NAME"

If you have many remote sources with a same user name and password, you may specify these credentials on the local peer rather than repeating them on each source:

syncevolution --configure \
  username="$SERVER_USER" password="$SERVER_PASS" \
  "$PEER"

Although specified on the local peer, this user name and password applies to the server sources (only for those sources that don't have their own databaseUser and databasePassword set)

Starting a regular synchronization

After a first synchronization has been done in "slow" mode, from now on you can use the faster default incremental mode:
#!/bin/sh

echo Syncing calendar
syncevolution n900 calendar calendar_less_important && exit 0
echo Error          
read a

You may also bind this to a desktop icon as described here. It is intended to be set up to run in a terminal, and the final read a makes sure that the terminal stays up after the command, so that you can look at error messages, if there are any.

Restart the calendar app

The month view of the calendar may not pick up any changes immediately. If the calendar app was running during sync, you may need to quit it and restart it.

On the other hand, if the calendar was not running, you may need to start it, exit it, and start it again. It looks as if, for some strange reason, the calendar refreshes its overview display from its database on exit rather than on start ...

The bug has been reported to Meego and Maemo, but apparently nobody is willing any more to do anything about it (... and this was before the takeover of Nokia by Microsoft...).


Last modified: Thu Mar 7 22:34:55 CET 2013