HOWTO: CalDAV/CardDAV Sync from N900 to SOGo using SyncEvolution

When I moved to Maemo in 2010, I was using Google Calendar. I setup a sync via Exchange and eventually Erminig, which allowed me to sync my wife’s Google calendar too. But, when I started degooglifying and moving to free network services, I left Google Calendar for Funambol, using SyncEvolution as a Maemo SyncML client.

This was far from ideal: we lost shared calendars, there was no web UI, and desktop SyncML options were lacking. I quickly realized that CalDAV would be the better long-term option. I choose SOGo as my CalDAV server, but I couldn’t find a CalDAV client for the N900. (I tried the Funambol SOGo Connector. but just couldn’t figure it out.)

I’d just about given up on a comprehensive sync solution in Maemo… until I hit the jackpot a few days ago and stumbled upon a post by Thomas Tanghus on a CalDAV/CardDAV sync from the N900 to ownCloud using SyncEvolution.

It looks like SyncEvolution gained CalDAV/CardDAV support in version 1.2 — the N900 has a CalDAV client!

CalDAV/CardDAV Sync using SyncEvolution

Thomas’ instructions were for ownCloud, but they work for any CalDAV/CardDAV server. I only ran into two issues, I think because I’d been using SyncEvolution pre-1.2. The steps included here are 90% from Thomas, with those two additions.

Reinstallation

First, I ran into the same problem as Wolfgang: the SyncEvolution WebDAV template wasn’t there when I tried to run Thomas’ first step. Wolfgang’s solution worked for me as well: just uninstall and reinstall SyncEvolution.

$ root
# apt-get remove syncevolution syncevolution-frontend
# apt-get install syncevolution syncevolution-frontend

I suspect you’ll need to do this if you initially installed SyncEvolution before it included WebDAV support.

Configuration

After reinstalling, I was successfully able to follow Thomas’ instructions (ignore the “backend failed” notices in the first command):

syncevolution --configure --template webdav username=YOURUSERNAME password=YOURPASSWORD target-config@sogo
syncevolution --configure database=CALDAVURL backend=caldav target-config@sogo calendar
syncevolution --configure database=CARDAVURL backend=carddav target-config@sogo contacts

The CalDAV URL for your default SOGo calendar is http://YOURSOGOINSTALL/dav/YOURUSERNAME/Calendar/personal and the CardDAV URL for your default SOGo addressbook is http://YOURSOGOINSTALL/dav/YOURUSERNAME/Contacts/personal. Your can right-click on any additional calendars in SOGo and select Properties > Links to find the CalDAV link for that particular calendar.

I ran into another issue with the next step in Thomas’ instructions. The above commands created new configuration files in /home/user/.config/syncevolution/sogo/, but the following commands operate on /home/user/.config/syncevolution/default/, in which I already had existing, older SyncEvolution configuration files. SyncEvolution complained about my pre-existing configuration, probably because I’d installed a much earlier version of SyncEvolution, and it said that I’d need to “migrate” with the following command:

syncevolution --migrate '@default'

Again, I suspect you’ll need to run this if you’d installed SyncEvolution pre-1.2. After this, I was able to continue with Thomas’ instructions.

In the following command, the username/password should stay blank:

syncevolution --configure --template SyncEvolution_Client sync=none syncURL=local://@sogo username= password= sogo

Then, configure the databases, backend and sync mode for calendar and contacts:

syncevolution --configure sync=two-way backend=calendar database=N900 sogo calendar
syncevolution --configure sync=two-way backend=contacts database=file:///home/user/.osso-abook/db sogo contacts

I’m running SSL on my server, so I had to add this step to get past an SSL error:
syncevolution --configure SSLVerifyServer=0 target-config@sogo

(I bet there’s a way to configure it to properly verify the SSL certificate… but I’ll save that for another day.)

Testing

To test the configuration:

syncevolution --print-items target-config@sogo calendar
syncevolution --print-items target-config@sogo contacts

If that shows the data you expect to be there, then go ahead and run your first sync.

First Sync

SyncEvolution has several sync modes. The above commands configured the default mode to be ‘two-way’, but if you have initial data on both your client and server, you’ll want to run a ‘slow’ sync first.

syncevolution --sync slow sogo

My initial slow sync took almost an hour for ~2540 calendar events and ~160 contacts.

(If you want to overwrite your client with data from the server, or vice versa, look up ‘refresh-from-client’ or ‘refresh-from-server’ instead of ‘slow’.)

Scheduling

After that initial sync, you can run a normal sync at anytime:

syncevolution sogo

While the command line is great for configuration and testing, you don’t want to open a terminal every time you want to sync your calendar. You could schedule the sync command via fcrontab, but the Maemo syncevolution-frontend GUI has a daily scheduler.

Maemo SyncEvolution Frontend

UPDATE: Syncing Multiple Calendars

I’ve adapted the above commands to create new target-configs for two other calendars I want to sync — my wife’s and my childcare calendar for my son. There may be a more elegant way to reuse the same target-config, but this works.

First, in the Calendar application, under Settings > Calendars, I created one for my wife’s calendar called “Heather” and one for my son’s calendar called “Noah.”

You can view all the available databases with the follow command:syncevolution --print-databases

You should see your new calendar listed here. It can be used by name, so long as that name is unique (and there aren’t any special characters to escape).

Then, adapting the above commands:
##### Heather
syncevolution --configure --template webdav username=MYUSERNAME password=MYPASSWORD target-config@sogoheather
syncevolution --configure database=HEATHERCALDAVURL backend=caldav target-config@sogoheather calendar
syncevolution --configure --template SyncEvolution_Client sync=none syncURL=local://@sogoheather username= password= heather@heather
# A one-way sync is fine here, because I just want to view my wife's calendar
syncevolution --configure sync=one-way-from-remote backend=calendar database=Heather heather@heather calendar
syncevolution --configure SSLVerifyServer=0 target-config@sogoheather
syncevolution --print-items target-config@sogoheather calendar
# no need for a first slow sync with one-way mode set
syncevolution heather
##### Noah
syncevolution --configure --template webdav username=MYUSERNAME password=MYPASSWORD target-config@sogonoah
syncevolution --configure database=NOAHCALDAVURL backend=caldav target-config@sogonoah calendar
syncevolution --configure --template SyncEvolution_Client sync=none syncURL=local://@sogonoah username= password= noah@noah
syncevolution --configure sync=two-way backend=calendar database=Noah noah@noah calendar
syncevolution --configure SSLVerifyServer=0 target-config@sogonoah
syncevolution --print-items target-config@sogonoah calendar
# refresh-from-remote is faster than slow, and I know the local calendar is empty
syncevolution --sync refresh-from-remote noah

YMMV and you may want different configuration for your additional calendars, but this should give you some examples for how to configure additional calendars. The key different in these commands, besides the straight replacements, is to add a unique source name to all the –configure commands from SyncEvolution_Client on (except the SSL fix for the target-config), so that the client config ends up distinct from your primary calendar above.

Lastly, using the syncevolution-frontend, I scheduled daily automatic syncs for these two calendars as well, at different times.

Conclusion

I’m not sure if there’s a more elegant/concise configuration. I’m curious if there’s some way to combine the ‘target-config’ and ‘sogo’ steps… but Thomas spent over 12 hours on this and it works, so I’m not going to mess with it. I’m just thrilled that I’ve got this up and running.

After more than a decade in proprietary software slavery, and nearly two years of wandering in the calendar/contacts desert, I’ve finally reached the promised land of seamless and libre mobile, web and desktop calendar/contact sync. [Edit: Almost: The Maemo calendar application is proprietary...] Thank you, Thomas!

Creative Commons Attribution-ShareAlike 4.0 International Permalink | RSS (comments) | Post a comment

Leave a Reply