# Gcal error

**URL:** <https://community.openhab.org/t/gcal-error/41688>\
**Category:** Bindings\
**Tags:** openhab2, gcal\
**Created:** [March 13, 2018, 7:41pm UTC](https://community.openhab.org/t/gcal-error/41688 "2018-03-13T19:41:12Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![dimes](https://community.openhab.org/letter_avatar_proxy/v4/letter/d/6bbea6/32.png) [@dimes](https://community.openhab.org/u/dimes)\
**Post date:** [March 13, 2018, 7:41pm UTC](https://community.openhab.org/t/gcal-error/41688/1 "2018-03-13T19:41:12Z")

</div>

Hi,

since few days my gcal addon is not working…

Today I updated my openhab (openhabian), uninstalled gcal, deleted gcal\_oauth2\_token, created a new project in the google api console (+all additional steps (Api, cliend,…)), updated my client\_id and client\_secret in the cfg, installed gcal again and entered the code in ‘[Anmelden – Google Konten](https://www.google.com/device)’.  
Log:

```auto
2018-03-13 20:10:52.895 [INFO] [b.core.service.AbstractActiveService] - Google Calendar Event Downloader has been shut down
2018-03-13 20:23:22.206 [INFO] [openhab.io.gcal.auth.GCalGoogleOAuth] - ################################################################################################
2018-03-13 20:23:22.210 [INFO] [openhab.io.gcal.auth.GCalGoogleOAuth] - # Google-Integration: U S E R I N T E R A C T I O N R E Q U I R E D !!
2018-03-13 20:23:22.213 [INFO] [openhab.io.gcal.auth.GCalGoogleOAuth] - # 1. Open URL 'https://www.google.com/device'
2018-03-13 20:23:22.215 [INFO] [openhab.io.gcal.auth.GCalGoogleOAuth] - # 2. Type provided code JQBD-CGBG 
2018-03-13 20:23:22.219 [INFO] [openhab.io.gcal.auth.GCalGoogleOAuth] - # 3. Grant openHAB access to your Google calendar
2018-03-13 20:23:22.222 [INFO] [openhab.io.gcal.auth.GCalGoogleOAuth] - # 4. openHAB will automatically detect the permiossions and complete the authentication process
2018-03-13 20:23:22.224 [INFO] [openhab.io.gcal.auth.GCalGoogleOAuth] - # NOTE: You will only have 1800 mins before openHAB gives up waiting for the access!!!
2018-03-13 20:23:22.227 [INFO] [openhab.io.gcal.auth.GCalGoogleOAuth] - ################################################################################################
2018-03-13 20:24:05.796 [INFO] [b.core.service.AbstractActiveService] - Google Calendar Event Downloader has been started
2018-03-13 20:24:06.868 [ERROR] [b.core.service.AbstractActiveService] - Error while executing background thread Google Calendar Event Downloader
java.lang.NullPointerException: null
	at org.openhab.io.gcal.internal.GCalEventDownloader.processEntries(GCalEventDownloader.java:276) [236:org.openhab.io.gcal:1.11.0]
	at org.openhab.io.gcal.internal.GCalEventDownloader.execute(GCalEventDownloader.java:140) [236:org.openhab.io.gcal:1.11.0]
	at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [219:org.openhab.core.compat1x:2.2.0]
2018-03-13 20:25:07.256 [ERROR] [b.core.service.AbstractActiveService] - Error while executing background thread Google Calendar Event Downloader
java.lang.NullPointerException: null
	at org.openhab.io.gcal.internal.GCalEventDownloader.processEntries(GCalEventDownloader.java:276) [236:org.openhab.io.gcal:1.11.0]
	at org.openhab.io.gcal.internal.GCalEventDownloader.execute(GCalEventDownloader.java:140) [236:org.openhab.io.gcal:1.11.0]
	at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [219:org.openhab.core.compat1x:2.2.0]
2018-03-13 20:26:07.680 [ERROR] [b.core.service.AbstractActiveService] - Error while executing background thread Google Calendar Event Downloader
java.lang.NullPointerException: null
...

```

What I have done wrong?

regards  
dimes

---

<div class="post-metadata">

**Author:** ![mhilbush](https://community.openhab.org/user_avatar/community.openhab.org/mhilbush/32/56108_2.png) [@mhilbush](https://community.openhab.org/u/mhilbush)\
**Post date:** [March 13, 2018, 9:43pm UTC](https://community.openhab.org/t/gcal-error/41688/2 "2018-03-13T21:43:02Z")

</div>

> [@dimes](#):
>
> What I have done wrong?

No idea. That’s a strange error. Could you try putting the gcal binding in DEBUG or TRACE mode? Maybe that will yield some clues to what’s going on.

---

<div class="post-metadata">

**Author:** ![namraccr](https://community.openhab.org/user_avatar/community.openhab.org/namraccr/32/36484_2.png) [@namraccr](https://community.openhab.org/u/namraccr)\
**Post date:** [March 13, 2018, 11:31pm UTC](https://community.openhab.org/t/gcal-error/41688/3 "2018-03-13T23:31:09Z")

</div>

Looks like the NPE is coming from this line:

```auto
timeRangeCalendar.addTimeRange(new LongRange(event.getStart().getDateTime().getValue(),
event.getEnd().getDateTime().getValue()));

```

---

<div class="post-metadata">

**Author:** ![mhilbush](https://community.openhab.org/user_avatar/community.openhab.org/mhilbush/32/56108_2.png) [@mhilbush](https://community.openhab.org/u/mhilbush)\
**Post date:** [March 13, 2018, 11:55pm UTC](https://community.openhab.org/t/gcal-error/41688/4 "2018-03-13T23:55:11Z")

</div>

Yeah I saw that. But I can’t tell why it’s happening.

---

<div class="post-metadata">

**Author:** ![namraccr](https://community.openhab.org/user_avatar/community.openhab.org/namraccr/32/36484_2.png) [@namraccr](https://community.openhab.org/u/namraccr)\
**Post date:** [March 15, 2018, 3:26am UTC](https://community.openhab.org/t/gcal-error/41688/5 "2018-03-15T03:26:30Z")

</div>

I was hoping the OP would recognize the cause based on this. Most likely either the calendar entry has no start or no end.

---

<div class="post-metadata">

**Author:** ![dimes](https://community.openhab.org/letter_avatar_proxy/v4/letter/d/6bbea6/32.png) [@dimes](https://community.openhab.org/u/dimes)\
**Post date:** [March 15, 2018, 6:22pm UTC](https://community.openhab.org/t/gcal-error/41688/6 "2018-03-15T18:22:03Z")

</div>

without any changes from my site, the calender is working again and also I do not get any error…

---

<div class="post-metadata">

**Author:** ![mancer](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/e95f7d/32.png) [@mancer](https://community.openhab.org/u/mancer)\
**Post date:** [January 2, 2020, 4:33pm UTC](https://community.openhab.org/t/gcal-error/41688/7 "2020-01-02T16:33:12Z")

</div>

Started for me as well 😕

```auto
2020-01-02 17:28:57.535 [DEBUG] [enhab.io.gcal.internal.GCalActivator] - Google Calendar IO has been started.

2020-01-02 17:28:57.607 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - Loaded credential

2020-01-02 17:28:57.615 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device access token: ---

2020-01-02 17:28:57.619 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device refresh_token: ---

2020-01-02 17:28:57.622 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device expires_in: 1577986113120

2020-01-02 17:28:57.626 [INFO] [b.core.service.AbstractActiveService] - Google Calendar Event Downloader has been started

2020-01-02 17:28:57.627 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - Got calendar Arbeiten CalendarID: ---@group.calendar.google.com

2020-01-02 17:28:57.630 [DEBUG] [io.gcal.internal.GCalEventDownloader] - Downloading calendar feed for time interval: 2020-01-02T17:28:57.629+01:00 to 2020-01-02T17:28:59.629+01:00 

2020-01-02 17:28:57.635 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - Loaded credential

2020-01-02 17:28:57.637 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device access token: ---

2020-01-02 17:28:57.639 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device refresh_token: ---

2020-01-02 17:28:57.642 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device expires_in: 1577986113120

2020-01-02 17:28:57.874 [DEBUG] [io.gcal.internal.GCalEventDownloader] - found 1 calendar events to process

2020-01-02 17:28:57.877 [ERROR] [b.core.service.AbstractActiveService] - Error while executing background thread Google Calendar Event Downloader

java.lang.NullPointerException: null

	at org.openhab.io.gcal.internal.GCalEventDownloader.createTriggerAndSchedule(GCalEventDownloader.java:428) ~[?:?]

	at org.openhab.io.gcal.internal.GCalEventDownloader.processEntries(GCalEventDownloader.java:307) ~[?:?]

	at org.openhab.io.gcal.internal.GCalEventDownloader.execute(GCalEventDownloader.java:144) ~[?:?]

	at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:169) [bundleFile:?]

2020-01-02 17:28:58.883 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - Got calendar Arbeiten CalendarID: ---@group.calendar.google.com

2020-01-02 17:28:58.885 [DEBUG] [io.gcal.internal.GCalEventDownloader] - Downloading calendar feed for time interval: 2020-01-02T17:28:58.884+01:00 to 2020-01-02T17:29:00.884+01:00 

2020-01-02 17:28:58.893 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - Loaded credential

2020-01-02 17:28:58.895 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device access token: ---

2020-01-02 17:28:58.896 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device refresh_token: ---

2020-01-02 17:28:58.898 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device expires_in: 1577986113120

2020-01-02 17:28:59.076 [DEBUG] [io.gcal.internal.GCalEventDownloader] - found 1 calendar events to process

2020-01-02 17:28:59.079 [ERROR] [b.core.service.AbstractActiveService] - Error while executing background thread Google Calendar Event Downloader

java.lang.NullPointerException: null

	at org.openhab.io.gcal.internal.GCalEventDownloader.createTriggerAndSchedule(GCalEventDownloader.java:428) ~[?:?]

	at org.openhab.io.gcal.internal.GCalEventDownloader.processEntries(GCalEventDownloader.java:307) ~[?:?]

	at org.openhab.io.gcal.internal.GCalEventDownloader.execute(GCalEventDownloader.java:144) ~[?:?]

	at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:169) [bundleFile:?]

2020-01-02 17:29:00.084 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - Got calendar Arbeiten CalendarID: ---@group.calendar.google.com

2020-01-02 17:29:00.087 [DEBUG] [io.gcal.internal.GCalEventDownloader] - Downloading calendar feed for time interval: 2020-01-02T17:29:00.086+01:00 to 2020-01-02T17:29:02.086+01:00 

2020-01-02 17:29:00.097 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - Loaded credential

2020-01-02 17:29:00.099 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device access token: ---

2020-01-02 17:29:00.102 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device refresh_token: ---

2020-01-02 17:29:00.104 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device expires_in: 1577986113120

2020-01-02 17:29:00.293 [DEBUG] [io.gcal.internal.GCalEventDownloader] - found 1 calendar events to process

```

---

<div class="post-metadata">

**Author:** ![namraccr](https://community.openhab.org/user_avatar/community.openhab.org/namraccr/32/36484_2.png) [@namraccr](https://community.openhab.org/u/namraccr)\
**Post date:** [January 3, 2020, 12:03am UTC](https://community.openhab.org/t/gcal-error/41688/8 "2020-01-03T00:03:11Z")

</div>

If you’re actually wanting help with this, you should:  
a) start a new thread for it  
b) provide your configuration

---

<div class="post-metadata">

**Author:** ![mancer](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/e95f7d/32.png) [@mancer](https://community.openhab.org/u/mancer)\
**Post date:** [January 3, 2020, 7:04am UTC](https://community.openhab.org/t/gcal-error/41688/9 "2020-01-03T07:04:12Z")

</div>

My gcal.cfg only has credentials in it. Refresh rate was not set, so it should’ve been set to 900000 by default. However, the updates posted came every second.  
I now set it manually to 900000, saved, restarted the bundle and then removed and restarted it again, so now it’s updating in the default rate.

Digging through the log files I saw that it started just before an all-day event started with this:

```auto
2020-01-01 23:59:59.399 [ERROR] [b.core.service.AbstractActiveService] - Error while executing background thread Google Calendar Event Downloader
java.lang.NullPointerException: null
	at org.openhab.io.gcal.internal.GCalEventDownloader.createTriggerAndSchedule(GCalEventDownloader.java:428) ~[?:?]
	at org.openhab.io.gcal.internal.GCalEventDownloader.processEntries(GCalEventDownloader.java:307) ~[?:?]
	at org.openhab.io.gcal.internal.GCalEventDownloader.execute(GCalEventDownloader.java:144) ~[?:?]
	at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:169) [251:org.openhab.core.compat1x:2.5.0.M4]

```

and then continued every second until I stopped the bundle. Today (no event) I don’t get any errors, just this:

```auto
2020-01-03 07:41:08.767 [INFO] [b.core.service.AbstractActiveService] - Google Calendar Event Downloader has been started

2020-01-03 07:41:08.769 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - Got calendar Arbeiten CalendarID: ---@group.calendar.google.com

2020-01-03 07:41:08.774 [DEBUG] [io.gcal.internal.GCalEventDownloader] - Downloading calendar feed for time interval: 2020-01-03T07:41:08.772+01:00 to 2020-01-03T08:11:08.772+01:00 

2020-01-03 07:41:08.781 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - Loaded credential

2020-01-03 07:41:08.783 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device access token: ya29.---

2020-01-03 07:41:08.785 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device refresh_token: ---

2020-01-03 07:41:08.787 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device expires_in: 1578037053054

2020-01-03 07:41:08.989 [DEBUG] [io.gcal.internal.GCalEventDownloader] - gcal feed contains no events ...

```

The logfile shows a lot of this though:

```auto
2019-12-29 14:03:26.507 [ERROR] [io.gcal.internal.GCalEventDownloader] - Event fetch failed: connect timed out
2019-12-29 14:06:54.778 [ERROR] [io.gcal.internal.GCalEventDownloader] - Event fetch failed: www.googleapis.com
2019-12-29 14:07:01.085 [ERROR] [io.gcal.internal.GCalEventDownloader] - Event fetch failed: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2019-12-30 13:33:30.693 [ERROR] [io.gcal.internal.GCalEventDownloader] - Event fetch failed: No route to host (Host unreachable)

```

When I tested it previously with non-all-day events (but instead starting at a specific time), it did work for me.

What other info would be helpful here?

---

<div class="post-metadata">

**Author:** ![namraccr](https://community.openhab.org/user_avatar/community.openhab.org/namraccr/32/36484_2.png) [@namraccr](https://community.openhab.org/u/namraccr)\
**Post date:** [January 3, 2020, 5:47pm UTC](https://community.openhab.org/t/gcal-error/41688/10 "2020-01-03T17:47:57Z")

</div>

Things that could help:

1. a debug log
2. the definition of the event

I’ve created an [updated version of the jar](https://drive.google.com/open?id=1GI11QabNIwc7Z7q33CBa9gonM1LmfGeN) for you to use. It traps the error and spits out a little additional debug information.

---

<div class="post-metadata">

**Author:** ![mancer](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/e95f7d/32.png) [@mancer](https://community.openhab.org/u/mancer)\
**Post date:** [January 3, 2020, 8:06pm UTC](https://community.openhab.org/t/gcal-error/41688/11 "2020-01-03T20:06:01Z")

</div>

Thank you!

I removed the 1.14 bundle and installed the jar.  
Debug log when starting is as follows:

```auto
2020-01-03 20:53:03.395 [DEBUG] [enhab.io.gcal.internal.GCalActivator] - Google Calendar IO has been started.
2020-01-03 20:53:03.672 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - Loaded credential
2020-01-03 20:53:03.675 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device access token: ---
2020-01-03 20:53:03.677 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device refresh_token: ---
2020-01-03 20:53:03.679 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device expires_in: 1578084094187
2020-01-03 20:53:03.682 [INFO] [b.core.service.AbstractActiveService] - Google Calendar Event Downloader has been started
2020-01-03 20:53:03.703 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - Loaded credential
2020-01-03 20:53:03.705 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device access token: ---
2020-01-03 20:53:03.706 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device refresh_token: ---
2020-01-03 20:53:03.709 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device expires_in: 1578084094187
2020-01-03 20:53:04.525 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - Got calendar Arbeiten CalendarID: ---@group.calendar.google.com
2020-01-03 20:53:04.528 [DEBUG] [io.gcal.internal.GCalEventDownloader] - Downloading calendar feed for time interval: 2020-01-03T20:53:04.527+01:00 to 2020-01-03T21:23:04.527+01:00 
2020-01-03 20:53:04.533 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - Loaded credential
2020-01-03 20:53:04.535 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device access token: ---
2020-01-03 20:53:04.537 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device refresh_token: ---
2020-01-03 20:53:04.538 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device expires_in: 1578084094187
2020-01-03 20:53:04.831 [DEBUG] [io.gcal.internal.GCalEventDownloader] - gcal feed contains no events ...

```

On the day mentioned above I had 2 all-day events in the calender. The events were defined as follows:

```auto
start { send AlexHomeoffice ON } end { send AlexHomeoffice OFF }

```

and

```auto
start {send VanyFrei ON} end {send VanyFrei OFF}

```

I just set up a new event starting in 5 minutes and restarted the bundle, but it still tells me “gcal feed contains no events …”

---

<div class="post-metadata">

**Author:** ![namraccr](https://community.openhab.org/user_avatar/community.openhab.org/namraccr/32/36484_2.png) [@namraccr](https://community.openhab.org/u/namraccr)\
**Post date:** [January 3, 2020, 9:05pm UTC](https://community.openhab.org/t/gcal-error/41688/12 "2020-01-03T21:05:34Z")

</div>

So we’re kind of stuck if you’re not getting any events. Our code just calls on the google api to fetch events. That call appears to be returning nothing…

---

<div class="post-metadata">

**Author:** ![mancer](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/e95f7d/32.png) [@mancer](https://community.openhab.org/u/mancer)\
**Post date:** [January 4, 2020, 10:31am UTC](https://community.openhab.org/t/gcal-error/41688/13 "2020-01-04T10:31:18Z")

</div>

Just checked the Google dashboard and noted that on Jan 2nd between 2pm and 6pm the API request traffic dropped to 0.  
 ![](https://snipboard.io/ma3BK4.jpg)  
I didn’t change anything in that time period though, neither in the API nor in the Openhab settings…

Since I don’t get any error messages on both token and used calender, accessing the right feed shouldn’t be the issue, right?  
Do you know of any hurdles that can prevent gcal from finding the events…?

---

<div class="post-metadata">

**Author:** ![namraccr](https://community.openhab.org/user_avatar/community.openhab.org/namraccr/32/36484_2.png) [@namraccr](https://community.openhab.org/u/namraccr)\
**Post date:** [January 4, 2020, 11:25pm UTC](https://community.openhab.org/t/gcal-error/41688/14 "2020-01-04T23:25:11Z")

</div>

Not aware of anything that would cause that.

One thing you might try:  
shutdown, clear cache, remove or falsify the gcal credentials in the config, restart; this should generate some sort of login error. You can then reset to the right credentials and see if normal behavior is restored.

---

<div class="post-metadata">

**Author:** ![mancer](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/e95f7d/32.png) [@mancer](https://community.openhab.org/u/mancer)\
**Post date:** [January 5, 2020, 12:31pm UTC](https://community.openhab.org/t/gcal-error/41688/15 "2020-01-05T12:31:14Z")

</div>

Hmm, just tried that… no change unfortunately. Also generated a new secret, but still no change.  
Noted 2 things though…

- I got 2 bundles active. Not sure why 280 is in there - I removed it from my addons.cfg and it was uninstalled previously…

```auto
179 x Active x 80 x 1.15.0.202001031746 x org.openhab.io.gcal
280 x Active x 80 x 1.14.0 x org.openhab.io.gcal

```

- I created a new calender, but it can’t be found. Other calenders however are recognized.
