grover / homebridge-calendar

A calendar plugin for homebridge (https://github.com/nfarina/homebridge), which allows flexible scheduling of triggers using any iCal calendar.
MIT License
73 stars 13 forks source link

Error and crash from reading Google calendar #4

Open bohtho opened 6 years ago

bohtho commented 6 years ago

The homebridge instance crashes with the following error log when I start it with my Google Calendar url. I sent you an email with all the rest of the details.

May 24 01:13:10 LillePi homebridge[643]: [2018-5-24 01:13:10] [Calendar] Initializing Calendar platform... May 24 01:13:10 LillePi homebridge[643]: [2018-5-24 01:13:10] [Calendar] CalendarPlatform Plugin Loaded - version 0.3. 6 May 24 01:13:10 LillePi homebridge[643]: [2018-5-24 01:13:10] [Calendar] Found calendar in config: "Kalender" May 24 01:13:10 LillePi homebridge[643]: [2018-5-24 01:13:10] [Calendar] Pushing calendar sensor 'Kalender' state 0 - value 0 May 24 01:13:10 LillePi homebridge[643]: [2018-5-24 01:13:10] [Calendar] Pushing calendar sensor 'Ferie' state 0 - val ue 0 May 24 01:13:10 LillePi homebridge[643]: [2018-5-24 01:13:10] [Calendar] Pushing calendar sensor 'Tur' state 0 - value 0 May 24 01:13:10 LillePi homebridge[643]: [2018-5-24 01:13:10] [Calendar] Polling calendar Kalender has started. May 24 01:13:10 LillePi homebridge[643]: [2018-5-24 01:13:10] [Calendar] Updating calendar Kalender May 24 01:13:10 LillePi homebridge[643]: [2018-5-24 01:13:10] [Calendar] Initializing platform accessory 'Kalender'... May 24 01:13:10 LillePi homebridge[643]: [2018-5-24 01:13:10] Loading 0 accessories... May 24 01:13:10 LillePi homebridge[643]: Load homebridge-calendar.Calendar May 24 01:13:10 LillePi homebridge[643]: [2018-5-24 01:13:10] [homebridge-calendar.Calendar] CalendarPlatform Plugin L oaded - version 0.3.6 May 24 01:13:14 LillePi homebridge[643]: /var/lib/homebridge-ext/node_modules/homebridge-calendar/src/CalendarActionBu ilder.js:98 May 24 01:13:14 LillePi homebridge[643]: return events.sort((a, b) => a.date.valueOf() - b.date.valueOf()); May 24 01:13:14 LillePi homebridge[643]: ^ May 24 01:13:14 LillePi homebridge[643]: TypeError: Cannot read property 'valueOf' of undefined May 24 01:13:14 LillePi homebridge[643]: at events.sort (/var/lib/homebridge-ext/node_modules/homebridge-calendar/ src/CalendarActionBuilder.js:98:60) May 24 01:13:14 LillePi homebridge[643]: at InternalArray.sort (native) May 24 01:13:14 LillePi homebridge[643]: at Array.sort (native) May 24 01:13:14 LillePi homebridge[643]: at CalendarActionBuilder.sortEventsByDate (/var/lib/homebridge-ext/node modules/homebridge-calendar/src/CalendarActionBuilder.js:98:19) May 24 01:13:14 LillePi homebridge[643]: at CalendarActionBuilder.generateActions (/var/lib/homebridge-ext/node_mo dules/homebridge-calendar/src/CalendarActionBuilder.js:28:22) May 24 01:13:14 LillePi homebridge[643]: at CalendarAccessory._onCalendar (/var/lib/homebridge-ext/node_modules/ho mebridge-calendar/src/CalendarAccessory.js:136:41) May 24 01:13:14 LillePi homebridge[643]: at CalendarPoller.emit (events.js:180:13) May 24 01:13:14 LillePi homebridge[643]: at ical.fromURL (/var/lib/homebridge-ext/node_modules/homebridge-calendar /src/CalendarPoller.js:48:14) May 24 01:13:14 LillePi homebridge[643]: at Request._callback (/var/lib/homebridge-ext/node_modules/node-ical/node -ical.js:11:5) May 24 01:13:14 LillePi homebridge[643]: at Request.self.callback (/var/lib/homebridge-ext/node_modules/node-ical/ node_modules/request/request.js:187:22) May 24 01:13:14 LillePi systemd[1]: homebridge-ext.service: Main process exited, code=exited, status=1/FAILURE

May 24 01:13:14 LillePi systemd[1]: homebridge-ext.service: Unit entered failed state. May 24 01:13:14 LillePi systemd[1]: homebridge-ext.service: Failed with result 'exit-code'.

bohtho commented 6 years ago

Any idea what that sort of error could be?

bohtho commented 6 years ago

According to this validator there are numerous (ical) non-standard properties in my google calendars: http://ical-validator.herokuapp.com/urlvalidate?url=https://calendar.google.com/calendar/ical/1bi4kcb79ongrkh3sspei3n4ic@group.calendar.google.com/public/basic.ics

Is this the problem ? How do other people get Google ical to work ? On the other side you specifically say you support Google Calendar ?

lmelon commented 5 years ago

You could give a try with my fork (waiting to be merged in this project): https://github.com/lmelon/homebridge-calendar My fix rely on another library for parsing ... it may help. Google calendar is working for me (at least a simple one).

bohtho commented 5 years ago

@lmelon Thanks! I use the homebridge-config-ui-x to install, make sure I keep updated, and config my plugins. Anyway to make yours show up as installable there (as long as it´s not merged into this) ?

grover commented 5 years ago

Published version 0.4.0 with the changes from @lmelon.