CalDav Personal binding works weirdly with Google Calendar

Dear Everyone!

Are there anyone who is using CalDav-Personal binding? For me, it seems to work, because sometimes I can see my events on my sitemap (unfortunately only the next event and just the name not the date and other things), but this usually works just after a reboot (if there is a next event in the upcoming days) and it don’t get updated as the time passes…

My questions are:

  • Do someone know why this happens? I don’t think that this is a configuration error, because sometimes it works…
  • Are there any alternatives for Google Calendars?
  • The documentation says that there is a type ‘NAMEANDTIME (itemtype:String)’ but this doesn’t seem to work for me…
  • I saw some people has a really good widget in HabPanel where it lists the upcoming events (not one, more…) and their dates… Are this is done by this binding or somehow else?

Thanks!

I don’t use CalDav personally but I have seen others mention it working with this jar file in addons. https://dl.bintray.com/openhab/mvn/org/openhab/io/org.openhab.io.caldav/1.12.0

Hope it helps

Thanks, I’ll try it!

BTW should be 9th one from top of list.

I use both CalDav Personal binding, and have it setup to give the next occurrence of a couple events through a DateTime item, and they are updated properly.

DateTime    Calendar_Upcoming_School        "Upcoming Preschool (start) [%1$tA, %1$tB %1$te, %1$tY at %1$tl:%1$tM%1$tp]"     <calendar>    (gCalendar) { caldavPersonal="calendar:mycalendar type:UPCOMING eventNr:1 value:START filter-category:'School'" }
DateTime    Calendar_Upcoming_Gymnastics    "Upcoming Gymnastics (start) [%1$tA, %1$tB %1$te, %1$tY at %1$tl:%1$tM%1$tp]"    <calendar>    (gCalendar) { caldavPersonal="calendar:mycalendar type:UPCOMING eventNr:1 value:START filter-category:'Gymnastics'" }

The easiest way to get the binding is to install it through PaperUI. The link @HM102 provided is outdated. If you want the latest snapshot build of this, or any of the other bindings, then download it from here…

https://openhab.ci.cloudbees.com/job/openHAB2-Bundles/lastSuccessfulBuild/

Although, I’m not sure if there have been any changes in this binding since the 2.3.0 release.

My guess is that it is an issue using it with Google calendar. Maybe there are some errors in the logs? The caldavio.cfg file may have a hint too. I have this set to false, but I’m not using Google…

# A caldav Server is just a webdav Server which list files. Some servers does not use the valid timestamp for modifications.
# If your calendar does not provide correct timestamps you have to set this false.
# Default is true
caldavio:mycalendar:lastModifiedFileTimeStampValid=false

Thanks! I had the addon installed through PaperUI.

Now I have tried the version recommended by @H102, but it didn’t helped…

Now I have reinstalled the binding from PaperUI and I get errors like this:

Cannot load events

java.util.ServiceConfigurationError: net.fortuna.ical4j.model.PropertyFactory: Provider net.fortuna.ical4j.model.property.Action$Factory not a subtype

	at java.util.ServiceLoader.fail(ServiceLoader.java:239) ~[?:?]

	at java.util.ServiceLoader.access$300(ServiceLoader.java:185) ~[?:?]

	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376) ~[?:?]

	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) ~[?:?]

	at java.util.ServiceLoader$1.next(ServiceLoader.java:480) ~[?:?]

	at net.fortuna.ical4j.model.AbstractContentFactory.getFactory(AbstractContentFactory.java:85) ~[258:org.openhab.io.caldav:1.12.0]

	at net.fortuna.ical4j.model.PropertyFactoryImpl.createProperty(PropertyFactoryImpl.java:78) ~[258:org.openhab.io.caldav:1.12.0]

	at net.fortuna.ical4j.data.CalendarBuilder$ContentHandlerImpl.startProperty(CalendarBuilder.java:326) ~[258:org.openhab.io.caldav:1.12.0]

	at net.fortuna.ical4j.data.CalendarParserImpl$PropertyParser.parse(CalendarParserImpl.java:206) ~[258:org.openhab.io.caldav:1.12.0]

	at net.fortuna.ical4j.data.CalendarParserImpl$PropertyParser.access$1100(CalendarParserImpl.java:190) ~[258:org.openhab.io.caldav:1.12.0]

	at net.fortuna.ical4j.data.CalendarParserImpl$PropertyListParser.parse(CalendarParserImpl.java:173) ~[258:org.openhab.io.caldav:1.12.0]

	at net.fortuna.ical4j.data.CalendarParserImpl.parse(CalendarParserImpl.java:122) ~[258:org.openhab.io.caldav:1.12.0]

	at net.fortuna.ical4j.data.CalendarBuilder.build(CalendarBuilder.java:198) ~[258:org.openhab.io.caldav:1.12.0]

	at org.openhab.io.caldav.internal.job.EventReloaderJob.loadEvents(EventReloaderJob.java:339) ~[258:org.openhab.io.caldav:1.12.0]

	at org.openhab.io.caldav.internal.job.EventReloaderJob.execute(EventReloaderJob.java:100) [258:org.openhab.io.caldav:1.12.0]

	at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh230]

	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh230]

Manual installs can be tricky to remove, since they will be cached. You may need to go into Karaf to remove it properly (deleting the jar is not enough). Let me know if you need help with this. The calDav bindings are also a bit picky about restarting, and I usually do an OH restart after making any configuration changes to them.

You can use this to clear cache and tmp files from terminal, all on one line, even the grey part.

sudo service openhab2 stop && sudo rm -rf /var/lib/openhab2/cache/* && sudo rm -rf /var/lib/openhab2/tmp/* && sudo reboot

I have removed the cache and used your method, however now I don’t have PaperUI and I get this error when starting…

2018-09-03 22:26:50.618 [INFO ] [org.eclipse.smarthome.ui.paper      ] - FrameworkEvent INFO - org.eclipse.smarthome.ui.paper

org.osgi.framework.BundleException: The bundle class path entry "patch/" could not be found for the bundle "osgi.identity; type="osgi.bundle"; version:Version="0.10.0.oh230"; osgi.identity="org.eclipse.smarthome.ui.paper"; singleton:="true""

	at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findClassPathEntry(ClasspathManager.java:174) [?:?]

	at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.buildClasspath(ClasspathManager.java:152) [?:?]

	at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.<init>(ClasspathManager.java:81) [?:?]

	at org.eclipse.osgi.internal.loader.EquinoxClassLoader.<init>(EquinoxClassLoader.java:43) [?:?]

	at org.eclipse.osgi.internal.loader.BundleLoader.createClassLoaderPrivledged(BundleLoader.java:316) [?:?]

	at org.eclipse.osgi.internal.loader.BundleLoader.getModuleClassLoader(BundleLoader.java:233) [?:?]

	at org.eclipse.osgi.internal.loader.BundleLoader.findEntries(BundleLoader.java:819) [?:?]

	at org.eclipse.osgi.container.ModuleWiring.findEntries(ModuleWiring.java:289) [?:?]

	at org.eclipse.osgi.storage.ManifestLocalization.findResource(ManifestLocalization.java:199) [?:?]

	at org.eclipse.osgi.storage.ManifestLocalization.lookupResourceBundle(ManifestLocalization.java:130) [?:?]

	at org.eclipse.osgi.storage.ManifestLocalization.getResourceBundle(ManifestLocalization.java:101) [?:?]

	at org.eclipse.osgi.storage.ManifestLocalization.getHeaders(ManifestLocalization.java:64) [?:?]

	at org.eclipse.osgi.storage.BundleInfo$Generation.getHeaders(BundleInfo.java:125) [?:?]

	at org.eclipse.osgi.internal.framework.EquinoxBundle.privGetHeaders(EquinoxBundle.java:462) [?:?]

	at org.eclipse.osgi.internal.framework.EquinoxBundle.getHeaders(EquinoxBundle.java:457) [?:?]

	at org.eclipse.osgi.internal.framework.EquinoxBundle.getHeaders(EquinoxBundle.java:451) [?:?]

	at org.apache.felix.metatype.internal.MetaTypeServiceImpl.getMetaTypeInformation(MetaTypeServiceImpl.java:129) [2:org.apache.felix.metatype:1.1.6]

	at org.apache.karaf.config.command.completers.MetaCompleter$1.callWith(MetaCompleter.java:71) [44:org.apache.karaf.config.core:4.1.5]

	at org.apache.karaf.config.command.completers.MetaCompleter$1.callWith(MetaCompleter.java:63) [44:org.apache.karaf.config.core:4.1.5]

	at org.apache.karaf.config.core.impl.MetaServiceCaller.withMetaTypeService(MetaServiceCaller.java:36) [44:org.apache.karaf.config.core:4.1.5]

	at org.apache.karaf.config.command.completers.MetaCompleter.updateMeta(MetaCompleter.java:63) [44:org.apache.karaf.config.core:4.1.5]

	at org.apache.karaf.config.command.completers.MetaCompleter.init(MetaCompleter.java:49) [44:org.apache.karaf.config.core:4.1.5]

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]

	at org.apache.karaf.shell.impl.action.command.ManagerImpl.instantiate(ManagerImpl.java:103) [12:org.apache.karaf.shell.core:4.1.5]

	at org.apache.karaf.shell.impl.action.command.ManagerImpl.instantiate(ManagerImpl.java:60) [12:org.apache.karaf.shell.core:4.1.5]

	at org.apache.karaf.shell.impl.action.command.ManagerImpl.register(ManagerImpl.java:151) [12:org.apache.karaf.shell.core:4.1.5]

	at org.apache.karaf.shell.impl.action.osgi.CommandExtension.updateState(CommandExtension.java:168) [12:org.apache.karaf.shell.core:4.1.5]

	at org.apache.karaf.shell.impl.action.osgi.CommandExtension.start(CommandExtension.java:113) [12:org.apache.karaf.shell.core:4.1.5]

	at org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:254) [12:org.apache.karaf.shell.core:4.1.5]

	at org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:227) [12:org.apache.karaf.shell.core:4.1.5]

	at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:482) [?:?]

	at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:415) [?:?]

	at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232) [?:?]

	at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444) [?:?]

	at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908) [?:?]

	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [?:?]

	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) [?:?]

	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213) [?:?]

	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120) [?:?]

	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112) [?:?]

	at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:168) [?:?]

	at org.eclipse.osgi.container.Module.publishEvent(Module.java:476) [?:?]

	at org.eclipse.osgi.container.Module.start(Module.java:467) [?:?]

	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1634) [?:?]

	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1614) [?:?]

	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1585) [?:?]

	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1528) [?:?]

	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) [?:?]

	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [?:?]

	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) [?:?]

Now I’m back at where I started, but still the same. Binding installed through PaperUI, I have updated to 2.4.0 M3 but the binding works the same… Now I don’t have any event in that calendar which is set, but I can’t see any event, or anything that the binding is doing something or not…

I do not understand what you mean by this. If you don’t have anything in the calendar, then how would you see any events in OH?

Sorry it was a little misleading… for example today I had an event in that calendar for tonight (~8pm to 10pm), but I didn’t saw that event in my sitemap… not today or any other day…

Yes, that is also unfortunately my own experience with this binding. I use(d) it with my Synology NAS as CalDav server and it used to read the next n dates after reboot ( I had defined 5 items for the next 5 appointments). Without a reboot the items shifted forward with time (item 1 disappearing and being replaced with item 2), but the most future item 5 did not pick up the next date but became empty, and then 4, then 3 and then there were no more entries. After a reboot all 5 items were populated freshly as expected.

Did you set lastModifiedFileTimeStampValid to false?

Better yet, post your caldavio.cfg file, but remove your account and password first.

No, I just added that now, I’m trying it out it, right now…

However here is my config:

caldavio:openhab:url=https://www.google.com/calendar/dav/XXXXXXXX@group.calendar.google.com/events
caldavio:openhab:username=XXXXXXXXXXX
caldavio:openhab:password=XXXXXXXXXXX
caldavio:openhab:reloadInterval=10
caldavio:openhab:preloadTime=20000
caldavio:openhab:lastModifiedFileTimeStampValid=false

Another thing which I noticed when I opened the config, that I have Two-Factor Auth enabled on my Google Account so here the password is just an app-generated password. Maybe this can cause some problem? (However I don’t think so, because when I restart openhab, it can pull the events…)

If 2-factor authentication has been enabled, create an application password using https://support.google.com/accounts/answer/185833?hl=en Use this password instead of your account password.

Yes, I’m using it with an application password

Did you allow “Third Party Apps” in your Google account settings?

Yes, because I’m using other third party apps as well…

Then I am out of ideas.