• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Default module Calendar not updating

Scheduled Pinned Locked Moved Bug Hunt
5 Posts 3 Posters 2.2k Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    jotha
    last edited by Feb 26, 2019, 9:04 AM

    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

    1 Reply Last reply Reply Quote 0
    • L Offline
      lavolp3 Module Developer
      last edited by Feb 26, 2019, 9:44 AM

      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 !?

      How to troubleshoot modules
      MMM-soccer v2, MMM-AVStock

      1 Reply Last reply Reply Quote 0
      • J Offline
        jotha
        last edited by Feb 26, 2019, 10:15 AM

        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

        1 Reply Last reply Reply Quote 0
        • K Offline
          Kowalski
          last edited by Apr 16, 2020, 2:16 PM

          I had the same problem with old events not being updated. Calendar source is the secret url of Google calendars. I changed the calendarfetcher.js file as described and it solved the problem.

          1 Reply Last reply Reply Quote 0
          • L Offline
            lavolp3 Module Developer
            last edited by Apr 17, 2020, 2:19 PM

            This should be PRd to the develop branch then!

            How to troubleshoot modules
            MMM-soccer v2, MMM-AVStock

            1 Reply Last reply Reply Quote 0
            • D dkhorse74 referenced this topic on Jan 9, 2023, 5:15 AM
            • 1 / 1
            • First post
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Sam, technical setup by Karsten.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy