OpenHAB2 - Gcal1 credentials failure

since few days my google calender binding is not working. Here is my config file:

############################### GCal configuration ################################
#
# Before using GCal, you need to have a Google API
# Console project. The Wiki describes in detail the steps necessary to set 
# up your Google API Console project, as well as how to obtain the credentials 
# necessary to complete the information in this file. Once the project is created, 
# and you've completed the steps described in the Wiki, you need to copy 
# the "Client ID" and "Client secret" from the Credentials page on 
# console.developers.google.com
#
#
# Copied from the "Client ID" field on the Credentials page. (required)
client_id=xxx.apps.googleusercontent.com

# Copied from the "Client secret" field on the Credentials page (required)
client_secret=xxx

# This is the name you gave to your Google Calendar, or the word 'primary' if you
# want to use your default Google calendar.  GCal will download calendar events 
# from this calendar (required)
calendar_name=primary

# The filter criteria by which calendar events are searched. The Google Calendar 
# API will do a text search to find calendar events that match the supplied terms. 
# All calendar event fields are searched, except for extended properties (optional)
#filter=

# Refresh interval (in milliseconds) is the frequency with which the
# Google calendar will be checked for calendar events (optional, defaults 
# to 900000 [15 minutes])
refresh=60000

if I reinstall the binding I get this error in the log:

2017-08-01 20:48:24.135 [WARN ] [openhab.io.gcal.auth.GCalGoogleOAuth] - getCredential got exception: null
2017-08-01 20:48:24.136 [ERROR] [io.gcal.internal.GCalEventDownloader] - Cannnot obtain credential based on provided client_id/client_secret
2017-08-01 20:48:24.139 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedService, id=603, bundle=222/mvn:org.openhab.io/org.openhab.io.gcal/1.10.0]: Updating property Credential error of configuration org.openhab.gcal caused a problem: Cannnot obtain credential based on provided client_id/client_secret
org.osgi.service.cm.ConfigurationException: Credential error : Cannnot obtain credential based on provided client_id/client_secret
	at org.openhab.io.gcal.internal.GCalEventDownloader.updated(GCalEventDownloader.java:557)[222:org.openhab.io.gcal:1.10.0]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1461)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1417)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)[3:org.apache.felix.configadmin:1.8.12]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]

I do not changed anything in the googleaccount of something else… :frowning:

Your credentials may have expired. Log into your google account and see if your API key and secret are still active and haven’t expired or been blocked for some reason.

My reading of the error is that the problem is on the Google side.

Should probably also change the title of this posting. The gcal binding is clearly installed, but failing to connect.

I checked my API Key. It is correct and the calender API is activ:

Where I can see if the something is expired or blocked?

The log is flawed:

2017-08-04 14:20:32.221 [WARN ] [openhab.io.gcal.auth.GCalGoogleOAuth] - getCredential got exception: null
2017-08-04 14:20:32.225 [ERROR] [io.gcal.internal.GCalEventDownloader] - Cannnot obtain credential based on provided client_id/client_secret
2017-08-04 14:20:32.230 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedService, id=603, bundle=222/mvn:org.openhab.io/org.openhab.io.gcal/1.10.0]: Updating property Credential error of configuration org.openhab.gcal caused a problem: Cannnot obtain credential based on provided client_id/client_secret
org.osgi.service.cm.ConfigurationException: Credential error : Cannnot obtain credential based on provided client_id/client_secret
	at org.openhab.io.gcal.internal.GCalEventDownloader.updated(GCalEventDownloader.java:557)[222:org.openhab.io.gcal:1.10.0]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1772)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)[3:org.apache.felix.configadmin:1.8.12]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]

I didn’t notice this line before. This appears to indicate the auth process is encountering a null pointer exception. A debug log might produce more information.

The WARN is also implemented incorrectly, failing to provide the information it should.

Please try this test jar.

It won’t fix whatever problem you’re experiencing, but should provide more information about where the error is coming from. Make sure to drop the binding into DEBUG mode.

You should see this message if the new jar is correctly installed:

Google Calendar IO has been started using special build 20170804T2300.

How I should install it? I saved it (org.openhab.io.gcal-1.11.0-SNAPSHOT.jar) in the addons folder. Should I deinstall the original gcal binding or restart openhab/raspberry?
I use openhabian.

1 Like

I don’t know openhabian, so I can’t give specific instructions for the platform.

For the general OH case, you should uninstall the original binding, making sure it doesn’t restart when OH restarts, then drop the new jar into the addons folder. That’s usually sufficient.

I uninstall the original binding and drop the jar in the addons folder. After that I restarted my raspberry.
Here is the log:

2017-08-06 11:36:43.658 [WARN ] [openhab.io.gcal.auth.GCalGoogleOAuth] - getCredential got exception: null
java.io.EOFException
	at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2624)[:1.8.0_121]
	at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3099)[:1.8.0_121]
	at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:853)[:1.8.0_121]
	at java.io.ObjectInputStream.<init>(ObjectInputStream.java:349)[:1.8.0_121]
	at com.google.api.client.util.IOUtils.deserialize(IOUtils.java:171)[223:org.openhab.io.gcal:1.11.0.201708050300]
	at com.google.api.client.util.store.FileDataStoreFactory$FileDataStore.<init>(FileDataStoreFactory.java:102)[223:org.openhab.io.gcal:1.11.0.201708050300]
	at com.google.api.client.util.store.FileDataStoreFactory.createDataStore(FileDataStoreFactory.java:73)[223:org.openhab.io.gcal:1.11.0.201708050300]
	at com.google.api.client.util.store.AbstractDataStoreFactory.getDataStore(AbstractDataStoreFactory.java:55)[223:org.openhab.io.gcal:1.11.0.201708050300]
	at org.openhab.io.gcal.auth.GCalGoogleOAuth.getCredential(GCalGoogleOAuth.java:131)[223:org.openhab.io.gcal:1.11.0.201708050300]
	at org.openhab.io.gcal.internal.GCalEventDownloader.updated(GCalEventDownloader.java:555)[223:org.openhab.io.gcal:1.11.0.201708050300]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1461)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1417)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)[3:org.apache.felix.configadmin:1.8.12]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
2017-08-06 11:36:43.661 [ERROR] [io.gcal.internal.GCalEventDownloader] - Cannnot obtain credential based on provided client_id/client_secret
2017-08-06 11:36:43.662 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedService, id=321, bundle=223/file:/usr/share/openhab2/addons/org.openhab.io.gcal-1.11.0-SNAPSHOT.jar]: Updating property Credential error of configuration org.openhab.gcal caused a problem: Cannnot obtain credential based on provided client_id/client_secret
org.osgi.service.cm.ConfigurationException: Credential error : Cannnot obtain credential based on provided client_id/client_secret
	at org.openhab.io.gcal.internal.GCalEventDownloader.updated(GCalEventDownloader.java:557)[223:org.openhab.io.gcal:1.11.0.201708050300]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1461)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1417)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)[3:org.apache.felix.configadmin:1.8.12]
	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)[3:org.apache.felix.configadmin:1.8.12]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]

Appears that the system is having trouble reading your token file. (gcal_oauth2_token, should be under either etc/gcal or userdata/gcal)

You could try moving the file to a location outside of the OH hierarchy and redo the auth setup process. (I say move instead of delete in case you want/need to put it back again)

1 Like

I renamed the file and install the binding again. A new file was created and it is working again now.
@namraccr: thank you