[SOLVED] Setting up GCAL

So in the console, if you type this, what do you see?

list -s | grep gcal

You should see something like this.

236 │ Active   │  80 │ 1.12.0.201802120209    │ org.openhab.io.gcal

230 | Active | 80 | 1.10.0 | openHAB Google Calendar | org.openhab.io.gcal

Then you should be able to do bundle:stop org.openhab.io.gcal and bundle:start org.openhab.io.gcal

This looks encouraging.

12:40:43.979 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - Loaded credential
12:40:43.979 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device expires_in: 1518726985089
12:40:44.649 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - Got calendar primary CalendarID: s1@gmail.com
12:40:44.649 [DEBUG] [io.gcal.internal.GCalEventDownloader] - Downloading calendar feed for time interval: 2018-02-16T12:40:44.649Z to  2018-02-16T13:10:44.649Z```

If you have calendar entries within the time interval, it should be downloading them.

just ran stop/start

12:53:45.318 [DEBUG] [io.gcal.internal.GCalEventDownloader] - found 1 calendar events to process
12:53:45.318 [DEBUG] [io.gcal.internal.GCalEventDownloader] - given event content doesn't match regular expression to extract start-, end commands - using whole content as startCommand (start&nbsp;{  send|update &lt;Lamp1_Brightness&gt; &lt;OFF&gt;&nbsp;}<br>&nbsp;end {  send|update &lt;Lamp1_Brightness&gt; &lt;ON&gt;}&nbsp;&nbsp;)

looks like it downloaded the event but my wording is now off

start { send|update <Lamp1_Brightness> <OFF> }
 end { send|update <Lamp1_Brightness> <ON>} 

i will have a look at the docs again should be able too sort that will it work then once i reword the description thanks for your help on that i will update post soon once read the description section again

Make sure you remove all formatting in the event description. There’s a little button in the toolbar for this.

I have replaced the description with

send|update <Lamp1_Brightness> <OFF>  

I have also used the remove formatting button you recomended just waiting see what happens
I have also ran stop/start its definitely reading the calendar my wording must still be wrong at least it reads the calendar

This

send Lamp1_Brightness OFF

Or this.

start {
    send Lamp1_Brightness ON
}
end {
    send Lamp1_Brightness OFF
}
1 Like

i keep making the same mistake when reading the docs i never remove the <>

i will try now its always simple :frowning:

Thanks for your help on that it now works perfect all mistakes were simple like always

any ideas if its the same sort of thing to setup gmail so openhab can send emails i have been using IFTTT ?

Having followed a couple solutions to gcal. I am still getting

[org.osgi.service.cm.ManagedService, id=402, bundle=292/mvn:org.openhab.io/org.openhab.io.gcal/1.11.0]: Updating property Credential error of configuration org.openhab.gcal caused a problem: Cannnot obtain credential based on provided client_id/client_secret

I have cleared the google credentials and followed the docs and removed the /var/lib/openhab2/gcal/gcal_oauth2_token

to confirm its getting updated, what can i check next ? I have restarted openhab2.2.0 and watched the logs to spot the next step where i confirm the “Provided Code” yet I dont believe its happened

That’s a strange error coming from the framework, not the binding. I’m not sure what to suggest. Just a guess, but it may be the symptom of a permissions issue.

When you removed the credentials, did you remove the file AND the gcal directory, or just the file. If just the file, try removing the directory, too.

1 Like

just the file, I can try both. it did replace the file soon after

Then that’s probably not the issue. But, it’s worth trying nonetheless.

You also could try putting the binding in debug mode, then stop/start the binding while watching the log file. That might provide some additional clues.

this looks better,

2018-04-03 23:26:15.403 [DEBUG] [org.openhab.io.gcal                 ] - BundleEvent STOPPED - org.openhab.io.gcal
2018-04-03 23:26:18.717 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - waiting for 5 seconds
2018-04-03 23:26:24.044 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - waiting for 5 seconds
2018-04-03 23:26:24.142 [DEBUG] [org.openhab.io.gcal                 ] - BundleEvent STARTING - org.openhab.io.gcal
2018-04-03 23:26:24.143 [DEBUG] [enhab.io.gcal.internal.GCalActivator] - Google Calendar IO has been started.
2018-04-03 23:26:24.143 [DEBUG] [org.openhab.io.gcal                 ] - BundleEvent STARTED - org.openhab.io.gcal
2018-04-03 23:26:24.147 [DEBUG] [org.openhab.io.gcal                 ] - ServiceEvent REGISTERED - {org.osgi.service.cm.ManagedService}={service.pid=org.openhab.gcal, component.name=org.openhab.binding.gcal.eventdownloader, component.id=267, service.id=408, service.bundleid=293, service.scope=bundle} - org.openhab.io.gcal
2018-04-03 23:26:29.369 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - waiting for 5 seconds
2018-04-03 23:26:34.622 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - waiting for 5 seconds

i guess i can try some items now, EDIT maybe not thats just the binding re initializing…

I think ive seen it connect, not that i can find it now… when with openhab in use does show up on the google Dashboard ?

Not sure what you mean by Google Dashboard.

https://console.developers.google.com/apis/dashboard?

Ah, ok. Yes, you should see a count of requests to the calendar API.

good progress here, I think ?

2018-04-04 18:22:25.902 [DEBUG] [io.gcal.internal.GCalEventDownloader] - found event ‘send CH1 ON’ with no content, add this event to the excluded TimeRangesCalendar - this event could be referenced by the modifiedBy clause

I think so. But that’s another message I’ve never seen before. :confused:

Its Working ( Tested )

The previous message means That was the Calendar Alarm title entry
and the content was empty and blanking - more info here https://community.openhab.org/t/gcal-binding-stopped-working-org-openhab-io-gcal-1-9-0-snapshot-jar-with-oh-1-8-3/18733/24 ( the command goes in the content of the Alarm )
eg

send Switch1 ON

or as examples

start {
  send Light_Garden ON
  send Pump_Garden ON
}
end {
  send Light_Garden OFF
  send Pump_Garden OFF
}

Thank for your input on solving the earlier parts