Installing an Eye-fi server on a Synology NAS

Introduction

For a long time I have not had much interest in taking photos, until we had two kid,  who by strange coincidence turned out to be  the most photogenic children ever. The great thing about digital photos is that it is incredibly easy to make them. The bad thing is that is almost just as easy to lose them. A crashed hard disk, a 8 Gbyte, 1000+ photos containing SD card getting lost, etc.. Meanwhile, my analog physical photos are still somewhere down in the closet, perhaps getting a little bit more yellow (instagrammed) with time.

It seems that that long term survival for analog photos is an analog state (gradual degradation ), whereas survival for digital photos is a digital state. either they are bit perfect or they are corrupted. Off course, the degradation of the storage material is gradual, but at some point, the number of read errors will beyond the error-correcting capabilities of the DVD. When it comes to optical discs, there are not many on the market that can be trusted for long-term storage. In a thorough long-term stress test by the well regarded German c’t magazine (c’t 16/2008, pages 116-123), only one DVD type was found that would survive for 20 years and longer. According to the test, the Verbatim Gold Archival DVD-R had a minimum durability of 18 years and an average durability of 32 to 127 years (at 25C, 50% humidity). No other disc came anywhere close to these values, the second best DVD-R had a minimum durability of only 5 years. Of course, the test did not take 18 years. Instead, the DVDs where subjected to extreme conditions, and from these real lifetimes where extrapolated.

DVDlivetime Installing an Eye fi server on a Synology NAS image

Lifetime DVD-r under humid and hot conditions

However, keeping lots of data backed up on DVDs requires a lot of work. In order to preserve our family photos, as well as our free time we have acquired a NAS, a Synology DiskStation412+. The Synology DiskStation comes with a lot of cool extensions to begin with, for example the Photo Station+. It is a photo server, that comes with clients for IOS and Android. We use these to automatically upload all new photos directly to the NAS.

But there is so much more we can do…

Crashplan

Still, I felt that a single backup location was not sufficient given the importance of the photos (and the wrath of my wife, if the photos where to disappear), so I decided to make a backup in the cloud: CrashPlan is a popular online backup solution which supports continuous syncing. It comes with an OS X and Windows client. However, The guys at PCLoadLetter have prepared excellent packages that make it possible to install CrashPlan running on your Synology. With this your NAS can become even more resilient – it could even get stolen or destroyed and you would still have your data. The other great thing is, that there is a quite cheap subscription with unlimited data, for 1 machine. Well, if this machine is your NAS, you can back up from all your computers!

Crashplan Installing an Eye fi server on a Synology NAS image

Crashplan progress screen


Eye-Fi – introduction

Well, that took care of automatically backing up the photos of our camera phones. However, I’m old-fashioned enough that our “normal”camera, makes better photo’s.  Unfortunately, it is old enough to not have Wi-Fi. Thus enters Eye-Fi…

Using an Eye-Fi card inside a camera, one can wirelessly and automatically upload digital photos to a local computer (running Microsoft Windows or Mac OS X) or a mobile device such as a smartphone or tablet (running iOS or Android).

The problem is that the Eye-Fi server is only available for windows and Mac. There is an FTP option in the Eye-Fi card, but it assumes that it is accessible from every WiFi point, whereas the Eye-Fi server is only contacted if within reach of your home WiFi network.


Python based Eye-Fi Server

Fortunately, Jeff Chang has written a python-based Eye-FI server. Many 3rd party Synology packages are Python based, so it ought to be possible to get this to run. Indeed, Matthias Wirtz demonstrates at his blog how to do this.

This works perfectly, but is a bit of a hassle to set up. I simplified this by adding an install script, and use an easily installable Python Package which can be downloaded here:

I looked into making a full Synology Package of the server, but I decided that this would take more free time than I have.

In the remainder of this blog I will describe how to get the server up and running. Be careful, though. Make sure you know what you’re doing, especially if you are using your NAS to store important data

 

Configure Eye-Fi Card

  • Temporarily changed the network name of your PC to that of your NAS. (I am not perfectly sure whether this step is required)
  • Install Eye-Fi server on PC or Mac
  • Update both the server and the firmware of the card
  • Connect Eye-Fi card to your Wi-Fi

    EyeFIConnectToWifi Installing an Eye fi server on a Synology NAS image

    Eye-Fi Connect To Wi-Fi

  • Enable Upload photo’s and point to a folder on your PC. The idea of renaming your PC is that , from now on, the card will  now connect to a machine with the network name  of your NAS. Again, I’m not sure this is necessary

    EyeFiUploadPhotos Installing an Eye fi server on a Synology NAS image

    Eye-Fi upload photos

  • Disable only sharing photos online

    EyeFIDisableSharing Installing an Eye fi server on a Synology NAS image

    Eye-Fi disable Sharing photos online

  • Enable upload video’s and point to a folder on your PC.
  • Disable only sharing videos online
  • Disable Upload items to Eye-Fi View

    EyeFiUploadToEyeFiVIew Installing an Eye fi server on a Synology NAS image

    Upload To Eye-Fi VIew

  • Restore your computer network name to the old name
  • Find your upload key: On Windows 7 this key is likely created at AppData / Roaming / Eye-Fi / Settings.xml. A very easy tool to quickly find this file is VoidTools’ Everything.
  • After this, disable the Eye-fi helper on you PC. I user CodeStuff’s starter to do this:
  • DisableEyeFiHelperCodeStuffStarter Installing an Eye fi server on a Synology NAS image

    Disable Eye-Fi helper withCodeStuff Starter

  • Restore your computer network name to the old name


Preparing your Synology NAS for Eye-Fi Server installation

  • Go to the Package manager

    OpenPackageCenter Installing an Eye fi server on a Synology NAS image

    Open the DiskStation Package Center

  • Add the syno community repository, Package source: http://packages.synocommunity.com,  in the package manager as a source.

    AddSynoCommunityRepository Installing an Eye fi server on a Synology NAS image

    Add the SynoCommunity repository

  • Install the Python (2.7) package
  • Enable SSH:

    enableSSH Installing an Eye fi server on a Synology NAS image

    Enable the SSH server


Installing the  Eye-Fi package

  • Copy the file EyeFiServer to a shared folder that you made

    EyeFiServerPackageInSharedFolder Installing an Eye fi server on a Synology NAS image

    Place Eye-Fi Server Package in Shared Folder on Synology DiskStation

  • Login as root using your SSH client of choice (Putty is by far the most popular):
    SynologySSH Installing an Eye fi server on a Synology NAS image

    Log in on the Synology DiskStation using SSH

  •  Go to the upload location:
  • Unpack the Eye-Fi server package
  • Go into the the package directory and  make installer script excutable
  • And start the script
  • Give the upload key you retreived earlier, when the script asks for it
  • Give the upload path you want to save your images to

    You can use a path that includes date and/or time, for example /volume1/shared/Media/Photo//%%Y-%%m-%%d.
    Possible substitutions are :

    Tag Substitution
    %%a Locale’s abbreviated weekday name.
    %%A Locale’s full weekday name.
    %%b Locale’s abbreviated month name.
    %%B Locale’s full month name.
    %%c Locale’s full date and time.
    %%d Day of the month as a decimal number [01,31].
    %%H Hour (24-hour clock) as a decimal number [00,23].
    %%I Hour (12-hour clock) as a decimal number [01,12].
    %%j Day of the year as a decimal number [001,366].
    %%m Month as a decimal number [01,12].
    %%M Minute as a decimal number [00,59].
    %%p Locale’s equivalent of either AM or PM.
    %%S Second as a decimal number [00,61].
    %%U Week number of the year as a decimal number [00,53].
    %%w Weekday as a decimal number [0(Sunday),6].
    %%W Week number of the year as a decimal number [00,53].
    %%x Locale’s full date
    %%X Locale’s full time
    %%y Year without century as a decimal number [00,99].
    %%Y Year with century as a decimal number.
  • After the script is installed, it will be started in the foreground. This allows to check if everything is working properly. It will show something like:
  • Make sure that the power saving mode of the camera is such that it stays on for several minutes after the last photo has been shot. It will need this time to upload the photos
  • Now use your camera to make a picture.  If everything is working correctly, logging will start after a few seconds. These will look something like
  • If this worked, stop the script on the foreground by pressing  [CTRL-C] or [CTRL-4], and start the server in the background:
  • And you’re done!

54 Comments

  1. Thanks for the great script!

    Could it be that there are wrong line endings or wrong coding?
    It did not work on my NAS. So I changed line endings to Unix and coding to “UTF-8 without BOM”.
    Now it works fine.

    Regards Matthias

  2. Hello
    I have the Eye-fi Server running on my Synology DS211j. I followed Matthias Wirtz’s instructions. Does your version create sub-directories by date the photo was taken? Matthias’ version only saves by date of the transfer.
    I do not know enough about Python to make the changes, but that is a feature I need.
    Thank you
    Ralf

    • Hi Ralph,

      I haven’t changed much in the script. So if the script doesn’t create making subdirectories, this will not have been solved. However, if I look at the script I see
      if not os.path.isdir(uploadDir):
      os.makedirs(uploadDir)

      And according to the python documentation this should be able to create nested directories. I would figure it does what you want

  3. Awesome – I’ve been trying to get this working, but couldn’t. This tutorial worked like a charm and now its all working.

    Thanks!

  4. Love it, and it works, but it doesn’t make a subdirectory for me, it just puts everything in the photo directory. Is this the correct behavior?

  5. Hello and thank you
    The script makes subdirectories based on the date of the upload – I have confirmed it works.
    The original Eyefi software saves the photos in subdirectories named with the date the picture was taken. This is what I would like to recreate, but do not know how to get the info for the date of the photo out and then use that to create the subdirectory.
    I will have to learn python!
    Ralf

  6. Pingback: Eye-Fi Server auf der DiskStation | mwits

  7. First, thank you for your help.

    I used the synocommuity python and I have gotten much farther. it seems to make the connection but never uploads anything to my server. here is the output:

    Type your Eye-Fi upload path, followed by [ENTER]:
    /volume1/photo/eyefi

    EyeFiServer stopped
    Copying files..

    Setting properties..

    Start server verbosely and on foreground
    if this works correctly, start using
    Command /usr/local/etc/rc.d/S99EyeFiServer.sh start

    [04/14/13 07:27PM][main] – Reading config /usr/local/eyefiserver/etc/eyefiserver.conf
    [04/14/13 07:27PM][main] – Eye-Fi server started listening on port 59278
    [04/14/13 07:27PM][get_request] – Incoming connection from client 192.168.1.33
    [04/14/13 07:27PM][do_POST] – POST /api/soap/eyefilm/v1 HTTP/1.1
    [04/14/13 07:27PM][do_POST] – Headers received in POST request:
    [04/14/13 07:27PM][do_POST] – content-length: 412
    [04/14/13 07:27PM][do_POST] – soapaction: “urn:StartSession”
    [04/14/13 07:27PM][do_POST] – connection: Close
    [04/14/13 07:27PM][do_POST] – accept: text/xml, application/soap
    [04/14/13 07:27PM][do_POST] – user-agent: Eye-Fi Card/5.0019
    [04/14/13 07:27PM][do_POST] – host: api.eye.fi
    [04/14/13 07:27PM][do_POST] – Attempting to read 412 bytes of data
    [04/14/13 07:27PM][do_POST] – Finished reading 412 bytes of data
    [04/14/13 07:27PM][do_POST] – Got StartSession request
    [04/14/13 07:27PM][startSession] – Delegating the XML parsing of startSession postData to EyeFiContentHandler()
    [04/14/13 07:27PM][startSession] – Extracted elements: {‘transfermode’: u’33314′, ‘macaddress’: u’001856489625′, ‘cnonce ‘: u’b7b76e554bf43f7d2c252d699da21256′, ‘transfermodetimestamp’: u’1365964704′}
    [04/14/13 07:27PM][startSession] – Setting Eye-Fi upload key to 5782d73a5298dadbf36b52a3b81de157
    [04/14/13 07:27PM][startSession] – Concatenated credential string (pre MD5): 001856489625b7b76e554bf43f7d2c252d699da2125 65782d73a5298dadbf36b52a3b81de157
    [04/14/13 07:27PM][do_POST] – StartSession response: fe2dc42dacd263f6a358f93b3c22623199208c155fc1883579cf0812ec0fe6d221230268824false
    192.168.1.33 – - [14/Apr/2013 19:27:54] “POST /api/soap/eyefilm/v1 HTTP/1.1″ 200 -
    [04/14/13 07:27PM][get_request] – Incoming connection from client 192.168.1.33
    ————————–

    It never gets any farther than this.

    thanks again for your help.

    hal

  8. Is it possible to autorun this script so it gets started whenever I restart the NAS?

  9. I checked firmware on the eyefi and then tried again. No Change.

    I appreciate your help.

    Hal

  10. Does it also work with RAW format? Or is this a property of the eye-fi card?

    • Hi, according to the Eye-Fi website only the Pro X2 card will output RAW images. I have not tested if the server supports RAW images. If you want to know for sure, you would need to contact the author of the server, Jeff Chang.

  11. Hi, great work there!

    However, I have Python from Synology but it is in path /usr/bin and not the path you have set in your script.

    Maybe you could modify it by just calling “python” without the path before.

    • Hi Jeff,

      I made it to work with the SynoCommunity Python, and this Python version is not added to the PATH. Hence, I need to add the full path. If it works for you without the path added, please remove it.

      • Hi Thijs, thanks you for your answer.

        If it is not added in the path, you perfomed a check before using “which python” and if the message “command unknown” is returned, set the variable to the your path of SynoCommunity.

        Something like that:

        which python 2>/dev/null
        if [ $? == 0 ]; then
        python_bin=”python”
        else
        python_bin=”/usr/local/python/bin/python”
        fi

  12. Will be trying to get this working again. Just want to know though, does it delete the photo from the card after it has been uploaded?

  13. Pingback: The Bridgers : Getting an Eye-Fi X2 Pro Card Working on Linux vs. Mac

  14. Hello,
    I would like to use this in a hospital envirroment where a lot of pictures are being taken.
    I’m a virgin when it comes to Linux, and I’m having trouble just opening the file.
    I’m already stuck here:

    BusyBox v1.16.1 (2013-04-16 20:15:54 CST) built-in shell (ash)
    Enter ‘help’ for a list of built-in commands.

    NAS> cd /volume1/share
    -ash: cd: can’t cd to /volume1/share
    NAS>

    Can you help further, please?

    • Hi, you never forget your first time. Using Linux, that is. I think the issue is that you have not created a folder on your NAS called “shared”

      As for putting a NAS in a hospital, usually the network security is quite tight, for good reasons. Did it work with the pc based served?

  15. Thank you for putting this all together – the eyefiserver and the details instructions for installing it! I do share Ralf Mesenbrink’s desire to have the upload directory be the date taken rather than the date uploaded. If someone figures out how to do this, please let us know.

  16. Thank you for putting this all together – the script and the detailed instructions! I do share Ralph Mesenbrink’s desire to have the directory be the date the picture was taken rather than the date of the upload. If someone works out a way to do this, please let us know!

    • You’re welcome! But, I just wrote the how-to. All praise should go to the authors of the server. I still believe the current implementation should be capable of doing this, but have not tried it

  17. Need some help , please. I am able to use the ./install.sh to monitor the progress and successfully to receive photos to my DS212j, I could not get the Synology’s python or the syno’s python to work, so I tried the python 2.6 and it works.

    however, when I try to run the

    /usr/local/etc/rc.d/S99EyeFiServer.sh start

    in the nohup log, I got the following error…

    [05/21/13 08:46PM][main] – Reading config /usr/local/eyefiserver/etc/eyefiserver .conf
    Traceback (most recent call last):
    File “/usr/local/eyefiserver/bin/eyefiserver.py”, line 607, in
    main()
    File “/usr/local/eyefiserver/bin/eyefiserver.py”, line 585, in main
    eyeFiServer = EyeFiServer(server_address, EyeFiRequestHandler)
    File “/usr/local/python26/lib/python2.6/SocketServer.py”, line 402, in __init_ _
    self.server_bind()
    File “/usr/local/eyefiserver/bin/eyefiserver.py”, line 134, in server_bind
    BaseHTTPServer.HTTPServer.server_bind(self)
    File “/usr/local/python26/lib/python2.6/BaseHTTPServer.py”, line 108, in serve r_bind
    SocketServer.TCPServer.server_bind(self)
    File “/usr/local/python26/lib/python2.6/SocketServer.py”, line 413, in server_ bind
    self.socket.bind(self.server_address)
    File “”, line 1, in bind
    socket.error: [Errno 98] Address already in use

    Can someone please help?

    Thanks

  18. Thanks after change the path for the python path it started to worked.

    Great work, hopefully one day we can have a nice package for Eye Fi :-) hint hint ;-)

    • I know! Somebody should really make something like that :-) but to be truthfulI, I did have look at it, but making a ui in particular seemed to have a real learning curve. For me this was just a small side project.

  19. Nice job and tutorial.
    Works great on my ds 412+ except that the picture file downloaded get the modification date/time of the actual date instead of keeping the creation date of the picture.
    The original EyeFi software keep the creation Date/Time of the picture…

  20. Thank you for a great tutorial!

  21. Hi,

    thanks a lot for you script!
    I had some issues with the installation:
    My DS212j is running DSM 4.2 an my Python path is /usr/local/bin
    I had to change the path in the install.sh and! /usr/local/etc/rc.d/S99EyeFiServer.sh

    Setting the name of the computer to the name of the NAS is not necessary.

    Hope this helps ;)

  22. Dag Thiis!

    Why not just use FTP with the Synology? I do this with my surveillance cameras
    in my home…

    Thanks
    -Todd

    • Dag Todd :-) My main reason was that I only want the card to initiate uploading when it comes within reach of my local WiFi network. This is not supported by the FTP implementation (at time of writing this article). Cheers, Thijs

  23. Hello,
    Great job!
    I am running DSM 4.3 and because the Python installation path probably changed, I had to modify PYTHONPATH with:
    PYTHONPATH=/usr/local/bin

  24. On MacOsX, the upload key can be found here:
    ~/Library/Eye-Fi/Settings.xml

  25. I can confirm that it is absolutely not necessary to change the computer name while configuring the Eye-Fi card.

  26. Also I can confirm that the same thing is possible with the nowadays available python 2.7 package from Synology Inc.
    I had to change the variable PYTHONPATH in the scripts of this software package, but I could imagine that this had to be done anyways, according to some comments here.
    In install.sh, replace PYTHONPATH=/usr/local/python/bin
    with
    PYTHONPATH=/usr/bin/python
    Same has to be done in /usr/local/etc/rc.d/S99EyeFiServer.sh

    • I need to correct my comment:

      In install.sh, replace PYTHONPATH=/usr/local/python/bin
      with
      PYTHONPATH=/usr/bin/ <– change here, no "python" after /
      Same has to be done in /usr/local/etc/rc.d/S99EyeFiServer.sh

  27. Thanks for creating this! The installation worked perfectly on my XPenology 4.2 setup with community Python. I did change the computer name to “DiskStation” temporarily, and while you didn’t mention it explicitly, I restarted the computer each time to make the name change stick.

    My question is about geotagging: I notice that the downloaded files (jpeg) don’t have geotags in their EXIF files. Is this a known issue?

  28. Hello again Thijs Elenbaas,

    By any chance, do you know if there is a way to make the server working for 2 EyeFi Cards and upload to different folders?

    I was thinking installing 2 servers running in parallel but I’m not sure if it might work.

  29. https://x2help.eyefi.com/hc/en-us/articles/200410368

    this solution works with little setting. This may help anyone who has this need.

    • Indeed! However, I used the alternative because I only want the card to upload when it comes in reach of my WiFi network. This is not the case for the FTP solution (at least not at time of writing the article).

  30. Did you install the Python from SynoCommunity? It is installed in another path as the Synology one.

  31. Got it. I should install python from “Community” instead of the above tab.

  32. weird…….

    have the same problem with hal’s. Got message like

    [03/14/14 04:05PM][main] – Reading config /usr/local/eyefiserver/etc/eyefiserver.conf
    [03/14/14 04:05PM][main] – Eye-Fi server started listening on port 59278
    [03/14/14 04:05PM][get_request] – Incoming connection from client 192.168.1.33
    [03/14/14 04:05PM][do_POST] – POST /api/soap/eyefilm/v1 HTTP/1.1
    [03/14/14 04:05PM][do_POST] – Headers received in POST request:
    [03/14/14 04:05PM][do_POST] – content-length: 412
    [03/14/14 04:05PM][do_POST] – soapaction: “urn:StartSession”
    [03/14/14 04:05PM][do_POST] – connection: Close
    [03/14/14 04:05PM][do_POST] – accept: text/xml, application/soap
    [03/14/14 04:05PM][do_POST] – user-agent: Eye-Fi Card/5.0019
    [03/14/14 04:05PM][do_POST] – host: api.eye.fi
    [03/14/14 04:05PM][do_POST] – Attempting to read 412 bytes of data
    [03/14/14 04:05PM][do_POST] – Finished reading 412 bytes of data
    [03/14/14 04:05PM][do_POST] – Got StartSession request
    [03/14/14 04:05PM][startSession] – Delegating the XML parsing of startSession postData to EyeFiContentHandler()
    [03/14/14 04:05PM][startSession] – Extracted elements: {‘transfermode’: u’33314′, ‘macaddress’: u’001856489625′, ‘cnonce ‘: u’b7b76e554bf43f7d2c252d699da21256′, ‘transfermodetimestamp’: u’1365964704′}
    [03/14/14 04:05PM][startSession] – Setting Eye-Fi upload key to 5782d73a5298dadbf36b52a3b81de157
    [03/14/14 04:05PM][startSession] – Concatenated credential string (pre MD5): 001856489625b7b76e554bf43f7d2c252d699da2125 65782d73a5298dadbf36b52a3b81de157
    [03/14/14 04:05PM][do_POST] – StartSession response: fe2dc42dacd263f6a358f93b3c22623199208c155fc1883579cf0812ec0fe6d221230268824false
    192.168.1.33 – – [14/Apr/2013 19:27:54] “POST /api/soap/eyefilm/v1 HTTP/1.1″ 200 -
    [03/14/14 04:05PM][get_request] – Incoming connection from client 192.168.1.33

    ——————
    I am sure that the firmware of the card is up to date.

    sigh…..