I have been trying to set up Caldav binding all morning. I have read 20 or so forum posts, followed what examples I can find but to no avail. Can anyone point me in the right direction on how to do the following:
Show upcoming events and times from a google calendar in Habpanel/Sitemap
Seems like it should be fairly simple, but I just can’t figure it out…
I have just finished my setup with a lot of great help from @Celaeno1.
It would be good if you post the configuration files, items and logfiles so people can actually see what you have configured.
You can check my latest posts and the replies from Alex…there is a huge amount of useful information in that conversation!
So I figured it out after a long time of twiddling around. I will post results for anyone who is interested in setting this up too.
Install the Caldav Personal binding & the Caldav Command Binding in Paper UI (You Need Both)
Navigate to the services folder in Openhab/conf/services
There should be 3 Caldav Files there: caldavCommand.cfg, caldavPersonal.cfg and caldavio.cfg
Get your google calendar ready to give caldav access.
Because caldav needs to access the calendar as a “Less Secure App”, and 2 factor auth seems to make this who project a headache, I opted to create a new gmail account that has shared access to the calendar I want to use. I made a new gmail account, and shared the calendar with that gmail with the setting “See All Events And Details”. You can find this in the sharing setting of the calendar page.
Go back to Openhab File System and add the following to the bottom of the caldavio.cfg file:
caldavio:<Calendar Name In Google>:url=https://www.google.com/calendar/dav/<your username>@gmail.com/events
caldavio:<Calendar Name In Google>:username=<gmail username without @gmail.com>
caldavio:<Calendar Name In Google>:password=<password for gmail account>
caldavio:<Calendar Name In Google>:reloadInterval=2
caldavio:<Calendar Name In Google>:preloadTime=200000
caldavio:<Calendar Name In Google>:disableCertificateVerification=true
Add the following to the bottom of the caldavPersonal.cfg file
caldavPersonal:usedCalendars=<Calendar Name In Google>
leave the caldavCommand.cfg as is
Set up your Items File. Mine is pulling the next 5 events with Name, Start Time, End Time, and Location. Note where it says caldavPersonal=“calendar:Matt” replace Matt with the name of your calendar as above:
Save all the changes to files and you should see the following message in the openhab.logs:
CalDAV IO is properly configured.
CalDav Loader has been started
reload job scheduled for:
Now caldav is successfully pulling your calendar entries.
Depending on your application you can now implement into a sitemap or habpanel.
For those who are interested this is the widget code I made to display mine as I didnt like the other widgets I found out there:
I’m a noob…have a ton figured out, but displaying it all is one of my last TODO items… I like your display. Is this a screenshot from Habpanel or Sitemap? (This may sound like a stupid question but once I think mine is cool…then I see people’s that are a million times better, and did things I didn’t know was possible )
Mind posting your code/config file?! (I see you posted code, but where does that go, etc, or entire file?)
I see these bindingscaldav-cmd are version 1…Is there a version 2 equivalent for openhab 2.5+? (Or an alternative binding or method we should be using to get calendar events?)
I’m fairly certain I followed these steps verbatim, except the obvious changes like username, pw, calendar name. ‘’’‘Any chance any of these variables or configs changed, like the calendar event url?’’’’ I’m getting a successful connection in the logs, but I’m not getting any events or updates. Also, I do have openhab 2.5.1 Thanks!
I’ve been getting in so much trouble already for starting threads…I fear it’s just an ID10T error! You don’t think my post is relevant to this? (Yes I’m serious and really looking for input). Appreciate the comment and thank you!
This URL in /services/caldavio.cfg specifically: caldavio:MYCALENDARNAME:url=https://www.google.com/calendar/dav/MYGOOGLEUSERID@gmail.com@gmail.com/events
I’m getting a 404 in the openhab logs. Perhaps this URL changed? (When I pull that URL up in a browser I get a login, but then it leads to: “Not found”)
It’s for habpanel yeah. The code goes in habpanel inside the template widget.
I am not sure about using on openhab 2.5 I am still on 2.4.
To check if the URL is working paste it into a browser, and try logging in with your credentials. If it works it will download a file of calendar entries.
I had an issue with mine it would just keep asking for me to login, it was Google checking it was ok for this new device to log in. I tried just logging into Google, then verifying the device with the email that said something like “is this you logging in?”
Then I checked the url again inna private window, and it worked and downloaded the entries. Then restated openhab and voila.
I’ve followed the steps above to configure my google calendar and the Caldav files but it is not working for me. I keep getting the same error in the logs.
2020-08-10 22:00:59.753 [WARN ] [caldav.internal.job.EventReloaderJob] - Sardine error while loading calendar entries: Unexpected response (401 - Unauthorized) com.github.sardine.impl.SardineException: Unexpected response
at com.github.sardine.impl.handler.ValidatingResponseHandler.validateResponse(ValidatingResponseHandler.java:48) ~[sardine-5.6.jar:5.6]
at com.github.sardine.impl.handler.MultiStatusResponseHandler.handleResponse(MultiStatusResponseHandler.java:40) ~[sardine-5.6.jar:5.6]
at com.github.sardine.impl.handler.MultiStatusResponseHandler.handleResponse(MultiStatusResponseHandler.java:35) ~[sardine-5.6.jar:5.6]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:222) ~[httpclient-4.4.1.jar:4.4.1]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:164) ~[httpclient-4.4.1.jar:4.4.1]
at com.github.sardine.impl.SardineImpl.execute(SardineImpl.java:962) ~[sardine-5.6.jar:5.6]
at com.github.sardine.impl.SardineImpl.list(SardineImpl.java:417) ~[sardine-5.6.jar:5.6]
at com.github.sardine.impl.SardineImpl.list(SardineImpl.java:409) ~[sardine-5.6.jar:5.6]
at com.github.sardine.impl.SardineImpl.list(SardineImpl.java:386) ~[sardine-5.6.jar:5.6]
at org.openhab.io.caldav.internal.job.EventReloaderJob.loadEvents(EventReloaderJob.java:250) ~[bundleFile:?]
at org.openhab.io.caldav.internal.job.EventReloaderJob.execute(EventReloaderJob.java:141) [bundleFile:?]
at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [bundleFile:?]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [bundleFile:?]
First I thought it had something to do with my credentials but when i connect withthese credentials via a web browser it works fine.
I have no idea what the error means. I am still new to openhab and have a lot to learn.
2020-10-16 14:24:14.135 [WARN ] [.io.caldav.internal.CalDavLoaderImpl] - A URL must be configured for calendar 'caldavPersonal
2020-10-16 14:24:14.137 [ERROR] [org.apache.felix.configadmin ] - [org.osgi.service.cm.ManagedService, org.openhab.io.caldav.CalDavLoader, id=129, bundle=251/mvn:org.openhab.io/org.openhab.io.caldav/[1.14.0,1.15)]: Updating property CalDAV IO of configuration org.openhab.caldavio caused a problem: A URL must be configured for calendar 'caldavPersonal'
org.osgi.service.cm.ConfigurationException: CalDAV IO : A URL must be configured for calendar 'caldavPersonal'`
caldavio.cfg:
caldavio:Garbage:url=https://apidata.googleusercontent.com/caldav/v2/<my_calendar_id>@group.calendar.google.com/events
caldavio:Garbage:username=<my google login without @gmail.com>
caldavio:Garbage:password=<my_google_account_password>
caldavio:Garbage:reloadInterval=2
caldavio:Garbage:preloadTime=18720
caldavio:Garbage:disableCertificateVerification=true
caldavio:Garbage:charset=UTF-8
caldavio:Garbage:lastModifiedFileTimeStampValid=false`
Have no idea why do I have in the log my previous configuration I played with (Marked with -> in the log file.
Maybe this is the reason for the problem?
Ps. Reboot done few times after configuration changes.
Hi @Matt_Foreman, I am currently adapting your calendar idea to iCal binding for me to work in OH3.
I wonder about our CSS config. Would you mind sharing it? I really like the grey and neat design from the screenshot.
Ahh, yeah I kinda did somewhat dirty css that was for my specific use case. You should be able to tweak it if you have a larger display. You can also add more entries and tweak the css if you need too.