GCAL bindings - refreshed version

You have to create application type Other. Please follow the Wiki.
Regards

2 Likes

Just to be thorough: Is http://docs.openhab.org/addons/io/gcal/readme.html (originally from the wiki) OK as well? Its source file is openhab1-addons/bundles/io/org.openhab.io.gcal/README.md at main · openhab/openhab1-addons · GitHub.

Thanks, the Wiki must have slipped through, @sirad, for others like me, would be great to edit the original post and add the link to the wiki! :wink:

ok. now I’m through with authentication (I hope), but the calendar seems not to be read out. is there some timeframe, the service looks for events? I just addes some 30mins in the future and the next day.
All I get after restarting OH2-service twice and restarting the GCAL-Service with bundle:restart is this in my openhab.log:

2017-02-25 10:06:43.609 [INFO ] [b.core.service.AbstractActiveService] - Google Calender Event-Downloader has been started
2017-02-25 10:06:51.473 [INFO ] [b.core.service.AbstractActiveService] - Google Calender Event-Downloader has been shut down

What I did was now according to the Wiki ():

  1. using new OAuth2 credentials with Application Type “Other” at Google API Manager
  2. getting this in my openhab.log:
017-02-25 09:18:25.689 [INFO ] [openhab.io.gcal.auth.GCalGoogleOAuth] - ################################################################################################
2017-02-25 09:18:25.691 [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 !!
2017-02-25 09:18:25.692 [INFO ] [openhab.io.gcal.auth.GCalGoogleOAuth] - # 1. Open URL 'https://www.google.com/device'
2017-02-25 09:18:25.693 [INFO ] [openhab.io.gcal.auth.GCalGoogleOAuth] - # 2. Type provided code XXXX-YYYY
2017-02-25 09:18:25.694 [INFO ] [openhab.io.gcal.auth.GCalGoogleOAuth] - # 3. Grant openHAB access to your Google calendar
2017-02-25 09:18:25.695 [INFO ] [openhab.io.gcal.auth.GCalGoogleOAuth] - # 4. openHAB will automatically detect the permiossions and complete the authentication process
2017-02-25 09:18:25.696 [INFO ] [openhab.io.gcal.auth.GCalGoogleOAuth] - # NOTE: You will only have 1800 mins before openHAB gives up waiting for the access!!!
2017-02-25 09:18:25.697 [INFO ] [openhab.io.gcal.auth.GCalGoogleOAuth] - ################################################################################################
  1. putting the Code in the URL
  2. getting this in the openhab.log:
2017-02-25 09:18:58.482 [INFO ] [b.core.service.AbstractActiveService] - Google Calender Event-Downloader has been started
2017-02-25 09:18:59.235 [ERROR] [openhab.io.gcal.auth.GCalGoogleOAuth] - authentication I/O exception: 403 Forbidden
{
  "code" : 403,
  "errors" : [ {
    "domain" : "usageLimits",
    "message" : "Access Not Configured. Calendar API has not been used in project 12345 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/calendar/overview?project=12345 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
    "reason" : "accessNotConfigured",
    "extendedHelp" : "https://console.developers.google.com/apis/api/calendar/overview?project=12345"
  } ],
  "message" : "Access Not Configured. Calendar API has not been used in project 12345 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/calendar/overview?project=12345 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."
}
  1. Granting Calendar API Access with the Project-ID (the OAuth-credentials)
  2. nothing happens
  3. restarting GCAL-service in OH2 console bundle:restart gave my this:
2017-02-25 09:20:59.545 [INFO ] [b.core.service.AbstractActiveService] - Google Calender Event-Downloader has been started
2017-02-25 09:22:37.061 [INFO ] [b.core.service.AbstractActiveService] - Google Calender Event-Downloader has been started
  1. nothing happened again
  2. restarted OH2 Service (sudo /etc/init.d/openhab2 restart)
  3. resulted in this:
(...)
2017-02-25 09:35:13.176 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2017-02-25 09:35:13.977 [INFO ] [b.core.service.AbstractActiveService] - Google Calender Event-Downloader has been started
(...)
  1. again nothing happend
  2. bundle:restart the GCAL Service with now this in the openhab.log
2017-02-25 10:06:43.609 [INFO ] [b.core.service.AbstractActiveService] - Google Calender Event-Downloader has been started
2017-02-25 10:06:51.473 [INFO ] [b.core.service.AbstractActiveService] - Google Calender Event-Downloader has been shut down

Am I missing something?

Why are you referring continuing to refer to the wiki in the posts following mine? openHAB 2 users should heed the warning in the 1.x wiki as it’s not correct information for you.

I’m confused. The Wiki (http://docs.openhab.org/addons/io/gcal/readme.html) is for OH2? I understand, the GCAL Service is 1.10 Version, but my understanding is, that >1.9 versions of bindings are at least tested for use within OH2?
or do you mean something completely different? :wink:

Ah, “the wiki” as I use the term refers to the old 1.x wiki at https://github.com/openhab/openhab1-addons/wiki, which OH2 users should not use for add-on documentation (and refer to with great caution for the other pages there). The “docs site” or “openHAB documentation” or similar term is what you find at http://docs.openhab.org. So we were using different terminology.

1 Like

all right! :wink: I’ll think about it in future posts! :wink:

I played around a bit more, still the same gcal.cfg, and bundle:restarts bring up this in the log, log:set trace 210 doesn’t improve logging in that case:

2017-02-27 15:57:42.292 [INFO ] [b.core.service.AbstractActiveService] - Google Calender Event-Downloader has been started
2017-02-27 15:57:50.059 [INFO ] [b.core.service.AbstractActiveService] - Google Calender Event-Downloader has been shut down
2017-02-27 15:58:12.530 [INFO ] [b.core.service.AbstractActiveService] - Google Calender Event-Downloader has been started
2017-02-27 15:59:12.516 [INFO ] [b.core.service.AbstractActiveService] - Google Calender Event-Downloader has been shut down
2017-02-27 15:59:45.162 [INFO ] [b.core.service.AbstractActiveService] - Google Calender Event-Downloader has been started
2017-02-27 16:01:13.031 [INFO ] [b.core.service.AbstractActiveService] - Google Calender Event-Downloader has been shut down

what bothers me, sometimes, the “Google Calender Event-Downloader” was shut down right in the instance, then I have 8secons or 90seconds! I don’t see a pattern here. Is there something I could do?

btw: @SirAd: could you Change the logging to “Google Calendar” with an “a” instead of an “e”, so it is easier to read and search in the logs, thanks!

I just added a pull request:

1 Like

I’m new to Openhab and trying to get this set up. I’m following the instructions and have managed to create my google credentials but cannot find the gcal.cfg file to put them in, nor do the instructions indicate where it should be created. I also looked for an openhab.cfg file mentioned at the very start of this thread.

I’m running using an Openhabian installation on a Pine64. So far everything has been fairly smooth but I’ve made the modifications through the UI. Unfortunately the google searches I’ve done turn up only OH1 information that isn’t very helpful.

Assistance greatly appreciated!

hi Simon,

I assume, you’re running openHAB2, so please use the documentation on docs.openhab.org: http://docs.openhab.org/addons/io/gcal/readme.html
Second, some bindings automatically create configuration files, in this case, GCAL isn’t a “binding” so to speak, and still the present Installation (copyin JAR-files) doesn’t create files. So in that case - and in most bindings also - you must create the config files yourself. Just place them in the config-directory (usually on Linux this is /etc/openhab2/services).
There you find at least the “addons.cfg”. In there you just create a new file gcal.cfg and paste your credentials and the other configurational stuff in.

After leaving OH2 to its own, since tonight at midnight, I get periodically (refresh-option in gcal.cfg) these errors:

2017-02-28 10:51:44.844 [ERROR] [b.core.service.AbstractActiveService] - Error while executing background thread Google Calender Event-Downloader
java.lang.NullPointerException
	at org.openhab.io.gcal.internal.GCalEventDownloader.processEntries(GCalEventDownloader.java:276)[210:org.openhab.io.gcal:1.10.0.201702240212]
	at org.openhab.io.gcal.internal.GCalEventDownloader.execute(GCalEventDownloader.java:140)[210:org.openhab.io.gcal:1.10.0.201702240212]
	at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173)[200:org.openhab.core.compat1x:2.1.0.201702202246]

So I guess, you just have to wait a little! :wink:

As I’m about to leave for skiing today, I won’t pursue this until next week, but I assume, I have to play around a bit with the calendar entries, I guess.

The documentation references the services folder. If you are using openHAB 2, refer to docs.openhab.org as the primary source of accurate information. Installation and configuration has changed in openHAB 2, as well as the addition of new features. The old 1.x wiki still has lots of useful information, but most of it is oriented towards users of the openHAB 1.x runtime.

Thanks for your suggestions @watou, @binderth.

Apologies for not mentioning the version, I am using OpenHab 2. Indeed, I was referring to the OH2 documentation and saw that it references a services folder, but my openhabian installation does not have any services folder. In my openhab root (this appears to be at /var/lib/openhab2) a search (find . -name services) turns up nothing.

There is a config directory and an etc directory. Based on the input from @binderth I’m going to try creating /var/lib/openhab2/etc/services and dropping the gcal.cfg file into there.

Will let you know how I get on! (Took delivery of a handful of z-wave devices today, so have a strong motivation to do something with them)

Do you have a services directory under /etc/openhab2 ?

:flushed: Yes, yes I do. Complete with a gcal.cfg file and everything else that I couldn’t find under /var/lib/openhab2.

Thanks!

1 Like

Hello,

to bindins gcal on OH2 with official version of binding 1.9 I receiving always “gcal feed contains no events …”

My primary calendar have only one event with in description:

start {
update Rele4 ON
}
end {
update Rele4 OFF
}

Any suggestion ?

Hi,

I’ve got the Gcal up and running, and I can trigger items from calendar events. But It only works with calendar_name=primary.
I have generated calendar Openhab2, and i can see this calendar and events when using google calendar api online(apis-explorer)

This is my openhab.log when trying to use Openhab2 calendar in Gcal.cfg:

[WARN ] [openhab.io.gcal.auth.GCalGoogleOAuth] - Calendar Openhab2 not found

Anyone know what the problem could be?

This is my openhab.log:
Google Calendar Event Downloader has been started
unable to change permissions for everybody: C:\openHAB2\userdata\gcal
unable to change permissions for owner: C:\openHAB2\userdata\gcal

what’s the problem?, please help

Hi,
It seems to be known problem is google-oauth library FileDataStoreFactory class. It should be only Warning, no impacting on service. See https://github.com/google/google-http-java-client/issues/315 for details.

Regards, Adam

ok
thanks for your reply

Regards
David