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.

    Calendar not updating

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    95 Posts 4 Posters 78.6k Views 6 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.
    • S Do not disturb
      sdetweil @matt216
      last edited by sdetweil

      @matt216 i test others problems by building an ics FILE and using the url

      http://localhost:mirror_port/modules/default/calendar/????.ics
      

      so it doesn’t have to be ON a ‘server’… just has to be an ICS format file.
      linking to google, the url returns that data when the calendar does a get request
      same as for the local file. BUT we depend on the data changing…
      the cal module does not know that ‘this’ fetch was or was not different than the last fetch.
      we don’t keep a diff… we just get the current data and present it.

      if it didn’t change then nothing changes

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      M 1 Reply Last reply Reply Quote 0
      • M Offline
        matt216 @sdetweil
        last edited by

        @sdetweil Trying this.
        Steps:

        1. add new test event scheduled tomorrow
        2. verify event on another device, proving calendar server sync
        3. curl .ics file from server, find test event
        4. set calendar module as described in your post above

        Result:
        calendar loads successfully, but still does not show new event.

        Event as shown in ics file:

        BEGIN:VEVENT
        CREATED:20240109T161646Z
        DTEND;TZID=Europe/London:20240110T170000
        DTSTAMP:20240109T161647Z
        DTSTART;TZID=Europe/London:20240110T160000
        LAST-MODIFIED:20240109T161646Z
        SEQUENCE:0
        SUMMARY:test54321
        TRANSP:OPAQUE
        UID:156ED8F1-9BDA-43D2-BE7C-DDEFE18E95EF
        URL;VALUE=URI:
        X-APPLE-CREATOR-IDENTITY:com.apple.mobilecal
        X-APPLE-CREATOR-TEAM-IDENTITY:0000000000
        END:VEVENT
        

        I think MagicMirror does not like the baikal server - no events created since I migrated from iCloud to self-hosted baikal are showing. Can you see anything unusual in the ics event above @sdetweil ?

        M S 2 Replies Last reply Reply Quote 0
        • M Offline
          matt216 @matt216
          last edited by

          @sdetweil so I’ve just spun up a radicale calendar server and added a few test events, then some more - works perfectly!

          Looks like a problem with baikal integration

          1 Reply Last reply Reply Quote 1
          • S Do not disturb
            sdetweil @matt216
            last edited by

            @matt216 no. i created an ics and ran mm against it

            [09.01.2024 10:42.53.207] [LOG]   Create new calendarfetcher for url: http://localhost:8090/modules/default/calendar/testbalkan.ics - Interval: 604800000
            ...
            [09.01.2024 10:42.53.336] [DEBUG] parsed data={"156ED8F1-9BDA-43D2-BE7C-DDEFE18E95EF":{"type":"VEVENT","params":[],"created":"2024-01-09T16:16:46.000Z","end":"2024-01-10T17:00:00.000Z","dtstamp":"2024-01-09T16:16:47.000Z","start":"2024-01-10T16:00:00.000Z","datetype":"date-time","lastmodified":"2024-01-09T16:16:46.000Z","sequence":"0","summary":"test54321","transparency":"OPAQUE","uid":"156ED8F1-9BDA-43D2-BE7C-DDEFE18E95EF","url":{"params":{"VALUE":"URI"},"val":""},"APPLE-CREATOR-IDENTITY":"com.apple.mobilecal","APPLE-CREATOR-TEAM-IDENTITY":"0000000000"},"vcalendar":{"type":"VCALENDAR"}}
            [09.01.2024 10:42.53.337] [DEBUG] There are 2 calendar entries.
            [09.01.2024 10:42.53.338] [DEBUG] Processing entry...
            [09.01.2024 10:42.53.339] [DEBUG] Event:
            {"type":"VEVENT","params":[],"created":"2024-01-09T16:16:46.000Z","end":"2024-01-10T17:00:00.000Z","dtstamp":"2024-01-09T16:16:47.000Z","start":"2024-01-10T16:00:00.000Z","datetype":"date-time","lastmodified":"2024-01-09T16:16:46.000Z","sequence":"0","summary":"test54321","transparency":"OPAQUE","uid":"156ED8F1-9BDA-43D2-BE7C-DDEFE18E95EF","url":{"params":{"VALUE":"URI"},"val":""},"APPLE-CREATOR-IDENTITY":"com.apple.mobilecal","APPLE-CREATOR-TEAM-IDENTITY":"0000000000"}
            [09.01.2024 10:42.53.339] [DEBUG] start: Wed Jan 10 2024 10:00:00 GMT-0600 (Central Standard Time)
            [09.01.2024 10:42.53.339] [DEBUG] end:: Wed Jan 10 2024 11:00:00 GMT-0600 (Central Standard Time)
            [09.01.2024 10:42.53.339] [DEBUG] duration: 3600000
            [09.01.2024 10:42.53.340] [DEBUG] title: test54321
            [09.01.2024 10:42.53.340] [DEBUG] full day event =false
            [09.01.2024 10:42.53.340] [DEBUG] initial tz=Europe/London
            [09.01.2024 10:42.53.340] [DEBUG] corrected tz=Europe/London
            [09.01.2024 10:42.53.341] [DEBUG] start date/time=Wed Jan 10 2024 10:00:00 GMT-0600 (Central Standard Time)
            [09.01.2024 10:42.53.341] [DEBUG] start offset=0
            [09.01.2024 10:42.53.341] [DEBUG] start date/time w tz =Wed Jan 10 2024 10:00:00 GMT-0600 (Central Standard Time)
            [09.01.2024 10:42.53.342] [DEBUG] event date=Wed Jan 10 2024 10:00:00 GMT-0600 (Central Standard Time)
            [09.01.2024 10:42.53.342] [DEBUG] event offset=0 hour=16 event date=Wed Jan 10 2024 10:00:00 GMT-0600 (Central Standard Time)
            [09.01.2024 10:42.53.342] [DEBUG] adjustHours=0
            [09.01.2024 10:42.53.342] [DEBUG] saving event: test54321
            [09.01.2024 10:42.53.342] [DEBUG] Processing entry...
            [09.01.2024 10:42.53.342] [INFO]  Calendar-Fetcher: Broadcasting 1 events from http://localhost:8090/modules/default/calendar/testbalkan.ics.
            

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            S 1 Reply Last reply Reply Quote 0
            • S Do not disturb
              sdetweil @sdetweil
              last edited by

              @matt216 can u send me the curl ics from the baikal server where the events don’t show??
              (if you are willing)
              rename to .txt

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              M 1 Reply Last reply Reply Quote 0
              • M Offline
                matt216 @sdetweil
                last edited by

                @sdetweil this is from the curl’d ics file, showing one of the events that will not display on the mirror display:

                BEGIN:VEVENT
                CREATED:20240109T161646Z
                DTEND;TZID=Europe/London:20240110T170000
                DTSTAMP:20240109T161647Z
                DTSTART;TZID=Europe/London:20240110T160000
                LAST-MODIFIED:20240109T161646Z
                SEQUENCE:0
                SUMMARY:test54321
                TRANSP:OPAQUE
                UID:156ED8F1-9BDA-43D2-BE7C-DDEFE18E95EF
                URL;VALUE=URI:
                X-APPLE-CREATOR-IDENTITY:com.apple.mobilecal
                X-APPLE-CREATOR-TEAM-IDENTITY:0000000000
                END:VEVENT
                

                I’d be happy to send over the contents of the ics file before events start, if that would be helpful? Far too much personal family info to send the whole thing, Im afraid (again, no offence intended)!

                S 1 Reply Last reply Reply Quote 0
                • S Do not disturb
                  sdetweil @matt216
                  last edited by

                  @matt216 I used that event in an ICS and it displays just fine.

                  so I think this is not the events but some communications problem.

                  the fact that you have it working with another local hosting server tells me it’s something other than the data

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    matt216
                    last edited by

                    Initial testing with the apache version of the baikal container looks promising (I’m currently having problems with the nginx version). Will continue testing along these lines…

                    M 1 Reply Last reply Reply Quote 0
                    • M Offline
                      matt216 @matt216
                      last edited by matt216

                      OK interesting. I created a brand new calendar server. Empty. Added one event to it and configured the mirror calendar module to use this server. It shows the one single event ok. I added a second new event to the calendar and this also shows on the mirror. Seems to work as expected - new events are showing!

                      Then I import my whole famlly calendar and run the same test. I now have 5 family events showing on the calendar. But if I add a new event that should show within my 5 events, it does not show. :(

                      Debug logs >somefile.txt show the mirror is picking up the new event from the ics file, it’s just not showing on the display.

                      1 Reply Last reply Reply Quote 0
                      • M Offline
                        matt216
                        last edited by

                        @sdetweil I wonder if I could run a nightly cron job to purge the calendar module or something similar…? Not sure how the calendar fetcher works.
                        It still feels like the calendar will load an ics link ok the first time, but is not displaying events created since that first load.
                        Nightly purge and re-connect would be acceptable, I think. Any advice there?

                        S 1 Reply Last reply Reply Quote 0
                        • S Do not disturb
                          sdetweil @matt216
                          last edited by

                          @matt216 there is no way to programmatically trigger a calendar refresh. you have to restart mm

                          but you could do this w pm2

                          pm2 restart MagicMirror
                          

                          (or it’s number)

                          in the current state does the broadcasting message indicate a change in number of events?

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

                          M 1 Reply Last reply Reply Quote 0
                          • M Offline
                            matt216 @sdetweil
                            last edited by

                            @sdetweil yes, the broadcasting event number increases by 1 when I add my new event, but the event does not show on the display.

                            S 1 Reply Last reply Reply Quote 0
                            • S Do not disturb
                              sdetweil @matt216
                              last edited by sdetweil

                              @matt216 can u show me the cal config again… as far as I can tell, the ONLY reason its not displayed is that the count (maximumEntries) clips off the total number of events

                              actually there are more conditions… in calendar.js
                              but they are all configurable

                              			for (const e in calendar) {
                              				const event = JSON.parse(JSON.stringify(calendar[e])); // clone object
                              
                              				if (this.config.hidePrivate && event.class === "PRIVATE") {
                              					// do not add the current event, skip it
                              					continue;
                              				}
                              				if (limitNumberOfEntries) { (//called with true) 
                              					if (event.endDate < maxPastDaysCompare) {
                              						continue;
                              					}
                              					if (this.config.hideOngoing && event.startDate < now) {
                              						continue;
                              					}
                              					if (this.config.hideDuplicates && this.listContainsEvent(events, event)) {
                              						continue;
                              					}
                              					if (--remainingEntries < 0) {
                              						break;
                              					}
                              				}
                              

                              and after filtering them out , apply the number of days limit and max entries limit

                              		// Limit the number of days displayed
                              		// If limitDays is set > 0, limit display to that number of days
                              		if (this.config.limitDays > 0) {
                              			let newEvents = [];
                              			let lastDate = today.clone().subtract(1, "days").format("YYYYMMDD");
                              			let days = 0;
                              			for (const ev of events) {
                              				let eventDate = moment(ev.startDate, "x").format("YYYYMMDD");
                              				// if date of event is later than lastdate
                              				// check if we already are showing max unique days
                              				if (eventDate > lastDate) {
                              					// if the only entry in the first day is a full day event that day is not counted as unique
                              					if (!this.config.limitDaysNeverSkip && newEvents.length === 1 && days === 1 && newEvents[0].fullDayEvent) {
                              						days--;
                              					}
                              					days++;
                              					if (days > this.config.limitDays) {
                              						continue;
                              					} else {
                              						lastDate = eventDate;
                              					}
                              				}
                              				newEvents.push(ev);
                              			}
                              			events = newEvents;
                              		}
                              
                              		return events.slice(0, this.config.maximumEntries);
                              

                              Sam

                              How to add modules

                              learning how to use browser developers window for css changes

                              M 1 Reply Last reply Reply Quote 0
                              • M Offline
                                matt216 @sdetweil
                                last edited by

                                @sdetweil

                                {
                                			module: "calendar",
                                			header: "--- Calendar testing ---",
                                			position: "top_left",
                                			config: {
                                				fetchInterval: 120000,
                                				timeFormat: 'absolute',
                                				maximumEntries: 5,
                                				broadcastPastEvents: false,
                                				calendars: [
                                					{
                                						url: 'https://my.cal.url/dav.php/calendars/family/default?export',
                                						auth: 	{
                                							user: 'family',
                                							pass: 'pass',
                                							method: 'basic'
                                							}
                                					}
                                					]
                                				}
                                		},
                                
                                

                                With the maximumEntries I currently have events showing several days in the future. When I am adding events to test this, I add the event to start just a few hours in the future so that it should show within the 5 events.

                                S 1 Reply Last reply Reply Quote 0
                                • S Do not disturb
                                  sdetweil @matt216
                                  last edited by

                                  @matt216 lets make that maximumEvents: 20

                                  for this test

                                  Sam

                                  How to add modules

                                  learning how to use browser developers window for css changes

                                  M 1 Reply Last reply Reply Quote 0
                                  • M Offline
                                    matt216 @sdetweil
                                    last edited by

                                    @sdetweil Updated to 20. This now shows calendar entries all the way to early May but the test event that starts at 20:00 this evening does not show. There are actually lots of events over the next few days that are not showing.

                                    S 1 Reply Last reply Reply Quote 0
                                    • S Do not disturb
                                      sdetweil @matt216
                                      last edited by sdetweil

                                      @matt216 ok, lets add some debugging , then we can see what is received in the UI module and what is processed for display (after filtering)

                                      ~/MagicMirror/modules/default/calendar/calendar.js

                                      about line 219

                                      		const events = this.createEventList(true);
                                      		Log.log("events to process="+JSON.stringify(events))  // add this line 
                                      		const wrapper = document.createElement("table");
                                      

                                      and around line 582

                                      		for (const calendarUrl in this.calendarData) {
                                      			const calendar = this.calendarData[calendarUrl];
                                      			Log.log("before filter events="+JSON.stringify(calendar))  // add this line
                                      			let remainingEntries = this.maximumEntriesForUrl(calendarUrl);
                                      

                                      then in the browser developers window (ctrl-shift-i to open) select the console tab,
                                      add cal to the filter field

                                      you will see these two blocks

                                      before filter events=[{"title":"Henry swim at Y","startDate":"1705156800000","endDate":"1705159200000","fullDayEvent":false,"recurringEvent":true,"class":"","firstYear":2024,"location":false,"geo":false,"description":false},{"title":"Henry swim at Y","startDate":"1705761600000","endDate":"1705764000000","fullDayEvent":false,"recurringEvent":true,"class":"","firstYear":2024,"location":false,"geo":false,"description":false},{"title":"Henry swim at Y","startDate":"1706366400000","endDate":"1706368800000","fullDayEvent":false,"recurringEvent":true,"class":"","firstYear":2024,"location":false,"geo":false,"description":false},{"title":"Henry swim at Y","startDate":"1706971200000","endDate":"1706973600000","fullDayEvent":false,"recurringEvent":true,"class":"","firstYear":2024,"location":false,"geo":false,"description":false},{"title":"Henry swim at 
                                      

                                      and then

                                      events to process=[{"title":"Henry swim at Y","startDate":"1705156800000","endDate":"1705159200000","fullDayEvent":false,"recurringEvent":true,"class":"","firstYear":2024,"location":false,"geo":false,"description":false,"url":"http://localhost:8090/modules/default/calendar/JUSTONE.ICS","today":false,"dayBeforeYesterday":false,"yesterday":false,"tomorrow":true,"dayAfterTomorrow":false},{"title":"Henry swim at Y","startDate":"1705761600000","endDate":"1705764000000","fullDayEvent":false,"recurringEvent":true,"class":"","firstYear":2024,"location":false,"geo":false,"description":false,"url":"http://localhost:8090/modules/default/calendar/JUSTONE.IC
                                      

                                      Sam

                                      How to add modules

                                      learning how to use browser developers window for css changes

                                      S M 2 Replies Last reply Reply Quote 0
                                      • S Do not disturb
                                        sdetweil @sdetweil
                                        last edited by sdetweil

                                        @matt216 the before filter is what was sent from the parser
                                        the events to process is what will be shown, limited to maximumEntries in length

                                        Sam

                                        How to add modules

                                        learning how to use browser developers window for css changes

                                        M 1 Reply Last reply Reply Quote 0
                                        • M Offline
                                          matt216 @sdetweil
                                          last edited by

                                          @sdetweil Thanks Sam. Will have a go and report back.

                                          S 1 Reply Last reply Reply Quote 0
                                          • S Do not disturb
                                            sdetweil @matt216
                                            last edited by

                                            @matt216 you can also use this web site

                                            https://codebeautify.org/jsonvalidator?/jsonvalidate
                                            

                                            to paste in the data (from [ to ]) and then push the format button (in pink) to make it more readable, ctrl-f will allow you to search for the entry you are looking for

                                            Screenshot at 2024-01-12 10-27-11.png

                                            Sam

                                            How to add modules

                                            learning how to use browser developers window for css changes

                                            M 1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 4 / 5
                                            • 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