MagicMirror² v2.8.0 is available! For more information about this release, check out this topic.

Default module Calendar not updating



  • Hello,

    First I’d like to thank Michael and the great community for this project! Six weeks ago I started with my first MM project and now I spend (too much) of my time for this amazing mirror!

    Currently I’m struggling with a strange problem:

    I’m using the default calendar module to display some different calendar (.ics) files from my intranet. I started with a fresh test appointment in a blank .ics file which is displayed correctly. If I update the .ics with other appointments and upcomming events I can see only the first test appointment. It isn’t updating the display, neither the refresh timer nor a reboot of the RPi solve the problem. It is still showing the test appointment at the display.
    Now the most amazing issue: After I deleted the .ics file from my web server the test appointment is still appearing on the MM!?! Also after a reboot!

    I checked the .js files from my calendar installation as also from the repository and found the reason for this behavior. The ‘calendarfetcher.js’ is using a default header without cache management settings for the file download.

    ‘…/MagicMirror/modules/default/calendar/calendarfetcher.js’:
    Line29:

    var opts = {
                        headers: {
                               "User-Agent": "Mozilla/5.0 (Node.js "+ nodeVersion + ") MagicMirror/"  + global.version +  " (https://github.com/MichMich/MagicMirror/)"
                        },
                        gzip: true
    };
    
    

    should be changed to:

    var opts = {
                        headers: {
                               "User-Agent": "Mozilla/5.0 (Node.js "+ nodeVersion + ") MagicMirror/"  + global.version +  " (https://github.com/MichMich/MagicMirror/)",
                               "Cache-Control": "max-age=0, no-cache, no-store, must-revalidate",
                               "Pragma": "no-cache"
                        },
                        gzip: true
    };
    

    After I changed the fetcher script, the calendar module is displaying the correct entries and updates are displayed after the refresh interval (fetchInterval).
    I checked this issue on two different RPi’s with a fresh Rasbpian and MM installation. On all I observed the same issue.

    I’ve to start some other tests with cloud calendar files also, but it seems this should be changed at the MM repository for the next version.

    Is there anybody else outside with the same bahavior?

    Cheers,
    Jörg


  • Project Sponsor

    Interesting discovery.
    Then why does it work for at least most of us with a cloud calendar and not for you in this specific way? Is the cache management being done from the server side?
    There seems to be some additional options that a google cloud calendar has implemented and your local ics does not have !?



  • Hi,

    thanks for your reply.
    This cache management header is only used for the local caching of any (wget) download. If you set the above header in the fetcher script it isn’t using any local caching mechanism and requests a fresh file download from the web server every time it’s triggered.
    I’ve to investigate a bit more also to the fact that I’m using a caching proxy server inside my LAN. On the RPi I disabled proxy usage for local addresses, but it seems maybe something isn’t working correctly here.
    The .ics file (calendar export from Lotus Domino client) has the same structure like other files (eg. from MS Outlook or Thunderbird). So, I guess this isn’t really a calendar file problem as more an OS related issue.
    If I download this file from the web server with ‘wget’ on my RPi, I’m getting the same file version every time I try to download even if it has changed or not. If I manipulate the HTTP-header which wget is using, the download is working as expected. (see http://xmodulo.com/how-to-use-custom-http-headers-with-wget.html for example). Some about cache management can be found here: http://dev.mobify.com/blog/beginners-guide-to-http-cache-headers/

    Currently I’m at work, but I’ll try to figure it out today evening. I’ll update this post with my findings.

    Cheers,
    Jörg