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

Calendar issue with 2.7.1



  • After updating to the latest version ( 2.7.1 ) from 2.6.0, one of my subscribed calendar feeds no longer works. It has worked fine in 2.6.0.

    Running on Raspberry Pi 3B - Raspbian Stretch. NodeJS version 9.11.2. Electron 3.0.13

    Currently, the calendar module shows “No upcoming events” for this calendar feed. I know there are items there because I’m subscribed on my laptop and iphone. This is a feed for our school calendar.

    In the error logs, I see the following:

    TypeError: Cannot read property 'length' of undefined
        at eventDate (/home/pi/MagicMirror/modules/default/calendar/calendarfetcher.js:69:25)
        at /home/pi/MagicMirror/modules/default/calendar/calendarfetcher.js:90:22
        at Request._callback (/home/pi/MagicMirror/modules/default/calendar/vendor/ical.js/node-ical.js:11:5)
        at Request.self.callback (/home/pi/MagicMirror/node_modules/request/request.js:185:22)
        at Request.emit (events.js:182:13)
        at Request. (/home/pi/MagicMirror/node_modules/request/request.js:1157:10)
        at Request.emit (events.js:182:13)
        at Gunzip. (/home/pi/MagicMirror/node_modules/request/request.js:1079:12)
        at Object.onceWrapper (events.js:273:13)
        at Gunzip.emit (events.js:187:15)
    
    

    My calendar config is as follows:

    {
      module: "calendar",
      header: "School Calendar",
      position: "top_left",
      config: {
        wrapEvents: true,
        fade: false,
        timeFormat: 'absolute',
        dateFormat: 'ddd , MMM DD',
        getRelative: 0,
        urgency: 0,
        maxTitleLength: 25,
        maximumEntries: 10,
        calendars: [
          {
            symbol: "calendar",
            url: "https://www.ojrsd.com//site/handlers/icalfeed.ashx?MIID=11"
          }
        ]
      }
    },
    

    Anyone else come across this issue?



  • Hi Dommer,
    Quite similar with me. I have a fresh Raspberry installation on my Pi-3B, the only additional packages installed are vsftpd (FTP-tool) and xrdp (RDP-server to allow Windows Remote Desktop Connections). On this fresh installation I have installed MagicMirror² and default Weather- and News app are working fine receiving live data.
    For some reason the calendar app does not work and I get the same error message for the calendar module as you in my log-file:

    ./home/pi/.pm2/logs/MagicMirror-error.log

    ATTENTION: default value of option force_s3tc_enable overridden by environment.
    TypeError: Cannot read property 'length' of undefined
        at eventDate (/home/pi/MagicMirror/modules/default/**calendar/calendarfetcher.js:69:25)
        at /home/pi/MagicMirror/modules/default/calendar/calendarfetcher.js:90:22
        at Request._callback (/home/pi/MagicMirror/modules/default/calendar/vendor/ical.js/node-ical.js:11:5)
        at Request.self.callback (/home/pi/MagicMirror/node_modules/request/request.js:185:22)
        at Request.emit (events.js:182:13)
        at Request. (/home/pi/MagicMirror/node_modules/request/request.js:1157:10)
        at Request.emit (events.js:182:13)
        at IncomingMessage. (/home/pi/MagicMirror/node_modules/request/request.js:1079:12)
        at Object.onceWrapper (events.js:273:13)
        at IncomingMessage.emit (events.js:187:15)
    

    I reinstalled from scratch on another SD-card with the same result.



  • @Dommer said in Calendar issue with 2.7.1:

    there is an event which does not have a start date and time. i looked thru changes to the calendarfetcher code, and cannot see any change to this line of code since before 2017.

    data={"type":"VEVENT","params":[],"uid":"42271","dtstamp":"20190414T114129Z","summary":"District Closed","class":"PUBLIC","status":"CONFIRMED","priority":"0","sequence":"0","duration":"P1D","last-modified":"20180523T131717Z","transparency":"OPAQUE"}
    

    raw data from ical

    BEGIN:VEVENT
    UID:42271
    DTSTAMP:20190414T112505Z
    SUMMARY:District Closed
    CLASS:PUBLIC
    STATUS:CONFIRMED
    PRIORITY:0
    SEQUENCE:0
    DTSTART:20190419
    DURATION:P1D
    LAST-MODIFIED:20180523T131717Z
    TRANSP:OPAQUE
    END:VEVENT
    


  • @drfukc this is the same problem as for @Dommer
    if u can send me your calendar entry url, I can look at it to see which event is causing this problem…
    or u can uncomment the one line in mm/modules/default/calendar/calendarfetcher.js, line

    				if (event.type === "VEVENT") {
             // console.log("have event title="+event.summary);
    

    and restart the mirror

    you will see the event summary in the pm2 log



  • @sdetweil

    Hi Sam,
    the calendar entry I use for testing is the standard URL:

    url: "webcal://www.calendarlabs.com/templates/ical/US-Holidays.ics"
    

    As advised by you I searched up-and-down my calendarfetcher.js in:
    /home/pi/MagicMirror/modules/default/calendar/calendarfetcher.js

    I can find the following string: if (event.type === “VEVENT”) {
    But I cannot even find substring to uncomment such like this: console.log("have or event title or
    Hence there seems to be nothing to uncomment

    I rather believe my issue has something to do with to many Electron instances that kill several moduls.
    Maybe you have an idea for this:

    1. I boot up my raspberry 3b
    2. Execute ‘ps -a’ to check the running processes
    3. ‘ps -a’ returns ‘ps’ as the only running processes
    4. launching the mirror: ‘npm start &’
    5. the console tells me uncaught exception since EADDRINUSE is already in use:

    magicmirror@2.7.1 start /home/pi/MagicMirror
    sh run-start.sh

    Starting MagicMirror: v2.7.1
    Loading config ...
    Loading module helpers ...
    No helper found for module: alert.
    Initializing new module helper ...
    Module helper loaded: updatenotification
    No helper found for module: clock.
    Initializing new module helper ...
    Module helper loaded: calendar
    Initializing new module helper ...
    Module helper loaded: newsfeed
    All module helpers loaded.
    Starting server on port 8080 ... 
    Server started ...
    Connecting socket for: updatenotification
    Connecting socket for: calendar
    Starting node helper for: calendar
    Connecting socket for: newsfeed
    Starting module: newsfeed
    Sockets connected & modules started ...
    Whoops! There was an uncaught exception...
    { Error: listen EADDRINUSE 127.0.0.1:8080
        at Server.setupListenHandle [as _listen2] (net.js:1330:14)
        at listenInCluster (net.js:1378:12)
        at GetAddrInfoReqWrap.doListen [as callback] (net.js:1492:7)
        at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:55:10)
      errno: 'EADDRINUSE',
      code: 'EADDRINUSE',
      syscall: 'listen',
      address: '127.0.0.1',
      port: 8080 }
    MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
    If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
    
    1. Now I recheck my running processes and see *four instances of Electron. According to another thread it looks like I run two instances of MagicMirror in parallel, that have a conflict with each other and causing this EADDRINUSE message:
    PID TTY          TIME CMD
     1176 pts/0    00:00:01 npm
     1187 pts/0    00:00:00 sh
     1188 pts/0    00:00:00 sh
     1189 pts/0    00:00:00 node
     1196 pts/0    00:00:30 electron
     1198 pts/0    00:00:00 electron
     1236 pts/0    00:00:00 electron
     1238 pts/0    00:00:15 electron
     1305 pts/1    00:00:00 ps
    
    1. Checking PM2 by ‘pm2 list’ gives me only one instance:
    pi@raspberrypi:~ $ pm2 list
    +-------------------------------------------------------+
    ¦ Name        ¦ id ¦ mode ¦ status ¦ ? ¦ cpu ¦ memory   ¦
    +-------------+----+------+--------+---+-----+----------¦
    ¦ MagicMirror ¦ 0  ¦ fork ¦ online ¦ 0 ¦ 0%  ¦ 2.5 MB   ¦
    +-------------------------------------------------------+
    
    1. For more details I try pm2 show 0
    pi@raspberrypi:~ $ pm2 show 0
     Describing process with id 0 - name MagicMirror 
    +--------------------------------------------------------------+
    ¦ status            ¦ online                                   ¦
    ¦ name              ¦ MagicMirror                              ¦
    ¦ version           ¦ 2.7.1                                    ¦
    ¦ restarts          ¦ 0                                        ¦
    ¦ uptime            ¦ 16m                                      ¦
    ¦ script path       ¦ /home/pi/MagicMirror/installers/mm.sh    ¦
    ¦ script args       ¦ N/A                                      ¦
    ¦ error log path    ¦ /home/pi/.pm2/logs/MagicMirror-error.log ¦
    ¦ out log path      ¦ /home/pi/.pm2/logs/MagicMirror-out.log   ¦
    ¦ pid path          ¦ /home/pi/.pm2/pids/MagicMirror-0.pid     ¦
    ¦ interpreter       ¦ bash                                     ¦
    ¦ interpreter args  ¦ N/A                                      ¦
    ¦ script id         ¦ 0                                        ¦
    ¦ exec cwd          ¦ /home/pi/MagicMirror                     ¦
    ¦ exec mode         ¦ fork_mode                                ¦
    ¦ node.js version   ¦ N/A                                      ¦
    ¦ node env          ¦ N/A                                      ¦
    ¦ watch & reload    ¦ ?                                        ¦
    ¦ unstable restarts ¦ 0                                        ¦
    ¦ created at        ¦ 2019-04-06T11:57:10.685Z                 ¦
    +--------------------------------------------------------------+
     Revision control metadata 
    +---------------------------------------------------------------------+
    ¦ revision control ¦ git                                              ¦
    ¦ remote url       ¦ https://github.com/MichMich/MagicMirror.git      ¦
    ¦ repository root  ¦ /home/pi/MagicMirror                             ¦
    ¦ last update      ¦ 2019-04-15T06:53:55.840Z                         ¦
    ¦ revision         ¦ b508a629e8a727358f1b88e3c7df842d14669ec4         ¦
    ¦ comment          ¦ Merge pull request #1632 from MichMich/fix-2.7.1 ¦
    ¦                  ¦                                                  ¦
    ¦                  ¦ Fix package.json version number.                 ¦
    ¦ branch           ¦ master                                           ¦
    +---------------------------------------------------------------------+
    

    Any ideas?



  • @drfukc said in Calendar issue with 2.7.1:

    { Error: listen EADDRINUSE 127.0.0.1:8080

    ok, then something ELSE on your system is using port 8080… maybe a web server?

    change the port number in mm/config/config.js to something else (8081 maybe)

    			if (event.type === "VEVENT") {
             // console.log("have event title="+event.summary);
    

    so, add the second line and then uncomment it… I must have added that fro debugging someone elses problem



  • @sdetweil
    Thanks for your comment.
    First I changed the port as recommended in mm/config/config.js to 8081 and gave it a reboot.
    After reboot and logon I checked the network connections by sudo netstat -lnptu:

    pi@raspberrypi:~ $ sudo netstat -lnptu
    Aktive Internetverbindungen (Nur Server)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
    tcp        0      0 127.0.0.1:8081          0.0.0.0:*               LISTEN      836/electron.js     
    tcp6       0      0 
    
    *                    LISTEN      418/vsftpd          
    tcp6       0      0 ::1:3350                
    
    3389                 
    
    5353                 
    
    34261                
    
    21                   
    
    *                    LISTEN      450/xrdp-sesman     
    tcp6       0      0 
    
    *                    LISTEN      465/xrdp            
    udp        0      0 0.0.0.0:42644           0.0.0.0:*                           318/avahi-daemon: r 
    udp        0      0 0.0.0.0:5353            0.0.0.0:*                           318/avahi-daemon: r 
    udp        0      0 0.0.0.0:68              0.0.0.0:*                           354/dhcpcd          
    udp6       0      0 
    
    *                                318/avahi-daemon: r 
    udp6       0      0 
    
    *                                318/avahi-daemon: r 
    

    This is strange. The launch of the mirror npm start & tells me a multiple use of the port 8080 or 8081 (whatever it set in config.js) but netstat -lnptu does not know anything about a duplicate use.

    As advised I also added below line right after if (event.type === “VEVENT”) { in ftp://192.168.178.36/home/pi/MagicMirror/modules/default/calendar/calendarfetcher.js

    console.log("have event title="+event.summary);
    

    Unfortunately the console outcome again is: “EADDRINUSE”

    Initializing new module helper ...
    Module helper loaded: calendar
    Initializing new module helper ...
    Module helper loaded: newsfeed
    All module helpers loaded.
    Starting server on port 8081 ... 
    Server started ...
    Connecting socket for: updatenotification
    Connecting socket for: calendar
    Starting node helper for: calendar
    Connecting socket for: newsfeed
    Starting module: newsfeed
    Sockets connected & modules started ...
    Whoops! There was an uncaught exception...
    { Error: listen EADDRINUSE 127.0.0.1:8081
        at Server.setupListenHandle [as _listen2] (net.js:1330:14)
        at listenInCluster (net.js:1378:12)
        at GetAddrInfoReqWrap.doListen [as callback] (net.js:1492:7)
        at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:55:10)
      errno: 'EADDRINUSE',
      code: 'EADDRINUSE',
      syscall: 'listen',
      address: '127.0.0.1',
      port: 8081 }
    MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
    If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
    Launching application.
    

    I feel a little bit lost … … …



  • @drfukc is mirror starting on boot with PM2?

    go to console and do

    pm2 list
    is something, get its name and pm2 stop name



  • Thanks for your advise. After launching the mirror I do a pm2 list with the following result:

    pi@raspberrypi:~/MagicMirror $ pm2 list
    +-------------------------------------------------------+
    ¦ Name        ¦ id ¦ mode ¦ status ¦ ? ¦ cpu ¦ memory   ¦
    +-------------+----+------+--------+---+-----+----------¦
    ¦ MagicMirror ¦ 0  ¦ fork ¦ online ¦ 0 ¦ 0%  ¦ 2.5 MB   ¦
    +-------------------------------------------------------+
     Use `pm2 show ` to get more details about an app
    

    With this information I stop the MagicMirror by the following command: pm2 stop 0

    pi@raspberrypi:~ $ pm2 stop 0
    [PM2] Applying action stopProcessId on app [0](ids: 0)
    [PM2] [MagicMirror](0) ?
    +------------------------------------------------------+
    ¦ Name        ¦ id ¦ mode ¦ status  ¦ ? ¦ cpu ¦ memory ¦
    +-------------+----+------+---------+---+-----+--------¦
    ¦ MagicMirror ¦ 0  ¦ fork ¦ stopped ¦ 0 ¦ 0%  ¦ 0 B    ¦
    +------------------------------------------------------+
    Use `pm2 show ` to get more details about an app
    
    

    By surprise the running MagicMirror survives and I kill the Electron instance with kill
    After the MagicMirror instance is terminated I relaunch MagicMirror again with npm start &
    The funny thing is that the naughty EADDRINUSE message is gone by now, but the calendar is still not working:

    pi@raspberrypi:~/MagicMirror $ npm start &
    [2] 1279
    [1]   Fertig                  npm start
    pi@raspberrypi:~/MagicMirror $ 
    > magicmirror@2.7.1 start /home/pi/MagicMirror
    > sh run-start.sh
    
    Starting MagicMirror: v2.7.1
    Loading config ...
    Loading module helpers ...
    No helper found for module: alert.
    Initializing new module helper ...
    Module helper loaded: updatenotification
    No helper found for module: clock.
    Initializing new module helper ...
    Module helper loaded: calendar
    Initializing new module helper ...
    Module helper loaded: newsfeed
    All module helpers loaded.
    Starting server on port 8081 ... 
    Server started ...
    Connecting socket for: updatenotification
    Connecting socket for: calendar
    Starting node helper for: calendar
    Connecting socket for: newsfeed
    Starting module: newsfeed
    Sockets connected & modules started ...
    Launching application.
    Create new calendar fetcher for url: http://www.calendarlabs.com/templates/ical/US-Holidays.ics - Interval: 300000
    Create new news fetcher for url: http://www.tagesschau.de/xml/rss2 - Interval: 300000
    

    OK, as said above I have relaunched the mirror by npm start & and try to evaluate what is going on with pm2 list:

    pi@raspberrypi:~ $ pm2 list
    +------------------------------------------------------+
    ¦ Name        ¦ id ¦ mode ¦ status  ¦ ? ¦ cpu ¦ memory ¦
    +-------------+----+------+---------+---+-----+--------¦
    ¦ MagicMirror ¦ 0  ¦ fork ¦ stopped ¦ 0 ¦ 0%  ¦ 0 B    ¦
    +------------------------------------------------------+
     Use `pm2 show ` to get more details about an app
    

    It’s funny, pm2 list tells me that the Mirror has stopped, while it is still running, but I still do not recieve any Calendar updates.
    What is wrong here?



  • @drfukc that calendar,

    url: "webcal://www.calendarlabs.com/templates/ical/US-Holidays.ics"
    

    is thru 2018…

    this one contains thru 2019

    url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics"