Thunderbird to Phone Sync

This HOWTO was submitted by Gerd Bavendiek via email.


With a lot of help from Patrick I finally was able to "sync" my addressbook and my calendar from Thunderbird to my Nokia.

This is a "half duplex" sync only. Items changed on the phone do not appear in TB. As I do not use my phone to create new events this is no problem for me.

I wrapped everything up in a simple script my-sync-tb2nokia.

Running Ubuntu 11.10 Oneiric, I installed syncevolution via apt-get. There is a newer version available, see the installation page.

syncevolution will utilize at least e-addressbook-factory and e-calendar-factory, which (in Oneiric) comes with the package

lulu:/home/bav$ dpkg -l evolution-data-server
...
ii  evolution-data-server     3.2.1-0ubuntu1           evolution database backend server

(I tested syncevolution in Natty with an older evolution-data-server without success).

AFAIK syncevolution holds its configuration data in ~/.config/syncevolution and synced data in ~/.cache/syncevolution.

If you ever tried out the software and want to start over, it may be a good idea to remove these directories. So I did:

lulu:/home/bav$ rm -rf ~/.config/syncevolution ~/.cache/syncevolution

I then ran hcitool to scan for bluetooth devices with my phone within reach:

lulu:/home/bav$ hcitool scan
Scanning ...
        C8:97:9F:A0:10:A5       Nokia E66

I then configured syncevolution like so:

lulu:/home/bav$ syncevolution --configure \
                       --template Nokia_N900 \
                       --sync-property syncURL=obex-bt://C8:97:9F:A0:10:A5
                       e66

See the phone + bluetooth instructions for the background.

You now should export the Thunderbird addressbook. Be sure to create a vcf-file (TODO MoreFunctionsForAddressbook must be used to achieve this, as Thunderbird only exports LDIF or CSV). Then export your calendar. Be sure to create a ics-file.

With Bluetooth switched on and the Nokia around you now may run the mentioned script:

lulu:/home/bav$ my-sync-tb2nokia Home.vcf Home.ics e66

The script will check your configuration and create directories needed in $HOME/.local/share/evolution. If everything seems to be fine, it will overwrite a task list in $HOME/.local/share/evolution/tasks/system/tasks.ics with an empty task list. I currently do not care about task lists.

Next step is to create a $HOME/.local/share/evolution/calendar/system/calendar.ics from your exported Thunderbird calendar.

my-sync-tb2nokia will then use syncevolution to delete items in $HOME/.local/share/evolution/addressbook/system/addressbook.db and to create new contents using your exported Thunderbird addressbook.

Finally my-sync-tb2nokia will run syncevolution with the provided configuration name, e66 in my case.

syncevolution will give you a clear feedback then.

AttachmentSize
Plain text icon my-sync-tb2nokia.txt4.99 KB

Comments

One possible reason why it didn't work with Ubuntu Natty is that older Evolution Data Server versions were not able to create the system calendar and address book. If that applies to the version in Natty (not sure), then running Evolution and creating a dummy contact resp. event might solve the problem.

A word of caution: if you have Evolution or some other GNOME app running which talk to EDS, then killing it will make those apps unhappy. A better solution would be to split the .ics file into multiple files so that each file contains the original VCALENDAR with all VTIMEZONE definitions and exactly one VEVENT.

These files then can be imported using SyncEvolution's --import operation.

Or even better, sync them directly to the phone by pointing the backend=file to the directory with the event files, using database= and databaseFormat=text/calendar. These settings can go into default context used by the phone config:

syncevolution --configure backend=file databaseFormat=text/calendar database=path @default calendar

A similar approach would also work for the .vcf file.