CalDAV binding with OpenHAB2

Hello, Everybody.

I have problems to get the values from the ical-Files into the item definitions:

There was already an discussion regarding non-loaded Events under OpenHAB2 at https://github.com/openhab/openhab1-addons/issues/4074#issuecomment-321937576, but this does not solve my issue.

The frame conditions:
OpenHAB2 - latest version, installed on Raspberry.

no old config files at /var/lib/openhab2/config/org/openhab/
all downloaded .ical-files found at /var/lib/openhab2/etc/caldav/Entsorgung/
log file is reporting events:
2017-08-11 18:58:48.649 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: B8587DCE-23BF-4D65-ACE3-D94646E93D6F(test@11.08.2017/18:00-11.08.2017/19:00)
But… unfortunately no values transferred into the item containers.

The content of the caldavio.cfg file:
caldavio:Entsorgung:url=https://www.google.com/calendar/dav/@group.calendar.google.com/events
caldavio:Entsorgung:username=<myname-without-gmail.com>
caldavio:Entsorgung:password=
caldavio:Entsorgung:reloadInterval=1
caldavio:Entsorgung:preloadTime=20000
caldavio:timeZone=Europe/Berlin

The content of the caldavCommand.cfg file:
caldavCommand:readCalendars=caldavio:Entsorgung

The content of the caldavPersonal.cfg file:
caldavCommand:readCalendars=caldavio:Entsorgung
#homeIdentifiers=

The content of the .items file:
String Cal_Entsorg “Nächste Abholung: [%s]” <Kalender, Entsorgung>
{caldavPersonal=“calendar:Entsorgung type:UPCOMING eventNr:1 value:NAME”}
DateTime Cal_EntsorgDatum “Nächste Abholung: [%1$td.%1$tm.%1$tY]” <Kalender, Entsorgung>
{caldavPersonal=“calendar:Entsorgung type:UPCOMING eventNr:1 value:START”}

Could anybody help me… quite desperate in the meantime :frowning:
Thank you very much in advance.

Tom

I believe your calendar names are wrong.

Should go like this:

caldavCommand:readCalendars=Entsorgung
caldavPersonal:usedCalendars=Entsorgung

Sorry… this settings did not work.
I just double-checked, but with the same result:

.ical files are downloaded, but values not transferred into item containers.

Any suggestions or recommendations are highly appreciated.

Best Regards

Tom

Go compare your items to the ones in the docs here. Fix any discrepancies you find.

Hi, namraccr:

Cal_Entsorg and Cal_EntsorgDatum double-checked and Cal_Presence added:

Current settings in file: Entsorgung.items:
String Cal_Entsorg “Nächste Abholung: [%s]” <Kalender, Entsorgung>
{caldavPersonal=“calendar:‘Entsorgung’ type:‘UPCOMING’ eventNr:‘1’ value:‘NAME’”}
DateTime Cal_EntsorgDatum “Nächste Abholung: [%1$td.%1$tm.%1$tY]” <Kalender, Entsorgung>
{caldavPersonal=“calendar:‘Entsorgung’ type:‘UPCOMING’ eventNr:‘1’ value:‘START’”}
Switch Cal_Presence "Kalenderzugriff " <Kalender, Entsorgung>
{caldavPersonal=“calendar:‘Entsorgung’ type:‘PRESENCE’”}

Unfortunately no progress - items still “NULL” in HABpanel UI - also empty in Classic UI.
No “findings” in /var/log/openhab2/openhab.log

Ok, good progress. Time to review the sitemap file and get a debug log.

Thanks for your kind support on this journey…

Next turn:

The sitemap:

sitemap SmartHaus label=“Rottenberg” {

Frame label="" {
Text item=fboxMissedCalls
visibility=[fboxMissedCalls>0] icon="error"
Text item=fboxIncomingCallName label="Anruf von [%2$s für %1$s]"
visibility=[fboxRinging==“ON”] icon="alarm"
Text item=fboxOutgoingCall label="Ausgehender Anruf [%1$s durch %2$s]"
visibility=[fboxRinging_Out==“ON”] icon=“alarm"
Text item=fboxTAM0NewMsg label=”%1$n Anrufe auf dem AB"
visibility=[fboxTAM0NewMsg<>“0”] icon="error"
Text item=HUM_UG label="Luftfeucht. Keller [%.1f %%]"
visibility=[HUM_UG>80] icon=“error”
}

Frame label=“Entsorgungskalender” {
Text item=Cal_Entsorg label=“Nächste Müllabfuhr [%s]” icon="alarm"
Text item=Cal_EntsorgDatum label=“Nächste Abholung [%1$td.%1$tm.%1$tY]” icon=“alarm”
}

Logging activated in org.ops4j.pax.logging.cfg with line
log:set DEBUG org.openhab.binding.CalDAV

but unfortunately no output - is the activation at by this line correct?

I don’t know how you even manage to see anything in the UI. When I load your sitemap, I get a blank screen like below.

You need to eliminate the smartquotes from the sitemap, for starters. I think that will eliminate most of your problems. If not, see below for how to set up logging properly.

sitemap SmartHaus label=“Rottenberg” {

Logging: no, you can’t add a log:set command to the pax config file. That command has to be issued in the Karaf console, like so:

openhab> log:set DEBUG org.openhab.io.caldavio
openhab> log:get org.openhab.io.caldavio
Logger                              | Level
-------------------------------------------
org.openhab.io.caldavio             | DEBUG

The packages of interest for caldav are caldavio as shown above, plus org.openhab.binding.caldav-command and org.openhab.binding.caldav-personal.

Hmmm… no caldavio related output on the log at all… just the common ongoing item updates with latest values:

I tried for all three objects:

  • org.openhab.io.caldavio
  • org.openhab.binding.caldav-command and
  • org.openhab.binding.caldav-personal

…to get log files by launching the following command sequences:

**    openhab> log:set DEBUG org.openhab.binding.caldav-personal**
**    openhab> log:g org.openhab.binding.caldav-personal**
**    Logger                              | Level**
**    -------------------------------------------**
**    org.openhab.binding.caldav-personal | DEBUG**
**    openhab> log:tail**

The event log is running, but no output for the three log categories mentioned above.

running output (access to UI in the meantime, refresh frequency in caldavio.cfg populated with one minute)
12:29:37.349 [INFO ] [marthome.event.ItemStateChangedEvent] - TEMP_Raspi_Keller changed from 51 to 50
12:30:31.399 [INFO ] [marthome.event.ItemStateChangedEvent] - TEMP_Raspi_Test changed from 44 to 45
12:30:38.781 [INFO ] [marthome.event.ItemStateChangedEvent] - TEMP_Raspi_Keller changed from 50 to 51
12:31:01.759 [INFO ] [marthome.event.ItemStateChangedEvent] - TEMPSolar changed from 35 to 34
12:31:32.944 [INFO ] [marthome.event.ItemStateChangedEvent] - TEMP_Raspi_Test changed from 45 to 44

Regarding the sitemap topic:
I am sure, you cannot copy&paste my sitemap, since this was just the very beginning of the sitemap (closing }-sign was missing). At the other hand, I do not see a chance for some issue with the sitemap configuration, since the problem occurs also, if I am inserting this item in parallel on/via HABpanel UI, directly (where sitemap files are not involved).

Another approach:
Is there any chance to check, if all caldavio-related services are running?

In the meantime, I have also created another calendar “Muell” instead of “Entsorgung”, to check, if the calendar or the .ical files are corrupt.

The iCal-file is added to the file location on the OpenHAB instance, but import is not logged into the OpenHAB file system. This event is not logged by the three running log threads mentioned above.

At the other hand, the log at /var/log/openhab2/openhab.log is listing Events from one calendar entry, which is due:

recurring entries like:
15:17:53.399 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: xxxxxxxxxxxx@google.com(test@13.08.2017/15:15-13.08.2017/16:15)

The openhab.log file is where you should be looking for log messages. The events log is not as useful for debugging.

The INFO entry you posted shows CalDAV is working correctly.

You can see the running bundles with bundle:list.

I can. I did. Obviously I had to fix the missing elements.

Another thing you can do is list the items openHAB knows about. When I do this with your item file installed, OH doesn’t see any of your items. Only mine:

openhab>smarthome:items list
FirstDayNumberOfMonth (Type=NumberItem, State=NULL, Label=First Day of Month Day Number, Category=null)

The bundle:list entries:

openhab> bundle:list
START LEVEL 100 , List Threshold: 50
ID | State | Lvl | Version | Name

9 | Active | 80 | 2.3.0.201506221200 | JAX-RS Gson Provider
10 | Active | 80 | 5.3.1.201602281253 | OSGi JAX-RS Connector
11 | Active | 80 | 2.3.1 | Gson
12 | Active | 80 | 18.0.0 | Guava: Google Core Libraries for Java
13 | Active | 80 | 3.0.0.v201312141243 | Google Guice (No AOP)
14 | Active | 80 | 1.5.8 | swagger-annotations
15 | Active | 80 | 3.19.0.GA | Javassist
17 | Active | 80 | 3.5.1 | JmDNS
20 | Active | 80 | 1.1.0.Final | Bean Validation API
22 | Active | 80 | 2.0.1 | javax.ws.rs-api
24 | Active | 80 | 3.2.0.v201101311130 | ANTLR Runtime
27 | Active | 80 | 1.6.0 | Commons Codec
28 | Active | 80 | 3.2.1 | Commons Collections
29 | Active | 80 | 1.1 | Commons Exec
30 | Active | 80 | 2.2.0 | Commons IO
31 | Active | 80 | 2.6 | Commons Lang
36 | Active | 80 | 4.2.3 | Apache HttpClient OSGi bundle
37 | Active | 80 | 4.2.3 | Apache HttpCore OSGi bundle
58 | Active | 80 | 4.0.8 | Apache Karaf :: Wrapper :: Core
59 | Active | 80 | 3.1.0.7 | Apache ServiceMix :: Bundles :: commons-httpclient
64 | Active | 80 | 2.11.0.v20150805-0538 | EMF Common
65 | Active | 80 | 2.11.1.v20150805-0538 | EMF Ecore
66 | Active | 80 | 2.11.1.v20150805-0538 | EMF XML/XMI Persistence
67 | Active | 80 | 3.7.0.v20150402-1709 | Common Eclipse Runtime
68 | Active | 80 | 3.6.0.v20150318-1503 | Extension Registry Support
94 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Config Core
95 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Configuration Discovery
96 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Config Dispatcher
97 | Active | 75 | 0.9.0.b4 | Eclipse SmartHome Config XML
98 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Core
99 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Core Audio
100 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome AutoUpdate Binding
101 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Core Binding XML
102 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Core ID
103 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Core Persistence
104 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Scheduler Service
105 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Core Thing
106 | Active | 75 | 0.9.0.b4 | Eclipse SmartHome Core Thing XML
107 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Transformation Service
108 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Core Voice
109 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Console
110 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Console for OSGi runtime Karaf
111 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome JavaSound I/O, Fragments: 169
112 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Monitor
113 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Net I/O Bundle
114 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome REST Interface Bundle
115 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Core REST API
116 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome REST mDNS Announcer
117 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Sitemap REST API
118 | Resolved | 80 | 0.9.0.b4 | Eclipse SmartHome SSE REST API
119 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Voice REST API
120 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Bonjour/MDS Service Discovery Bundle
121 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Web Audio Support
122 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Model Core
123 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Item Model
124 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Item Model Runtime
125 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Persistence Model
126 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Persistence Runtime
127 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Rule Model
128 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Rule Runtime
129 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Script
130 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Script Runtime
131 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Sitemap Model
132 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Sitemap Runtime
133 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Thing Model
134 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Thing Model Runtime
135 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Json Storage Service
136 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome UI
137 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome UI Icons
138 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Classic IconSet
139 | Active | 80 | 2.9.2 | Xtend Runtime Library
140 | Active | 80 | 2.9.2 | Xtend Macro Interfaces
141 | Active | 80 | 2.9.2 | Xtext
142 | Active | 80 | 2.9.2 | Xtext Common Types
143 | Active | 80 | 2.9.2 | JSR-45 Smap installer
144 | Active | 80 | 2.9.2 | Xtext Utility
145 | Active | 80 | 2.9.2.v20160428-1452 | Xbase Model
146 | Active | 80 | 2.9.2 | Xbase Runtime Library
162 | Active | 80 | 2.2.0 | JUPnP Library
163 | Active | 80 | 1.9.6 | MIME streaming extension
164 | Active | 80 | 5.0.2 | Require-Bundle Fix :: org.objectweb.asm
166 | Active | 90 | 2.0.0 | openHAB Core
167 | Active | 80 | 2.0.0 | openHAB Karaf Integration
169 | Resolved | 80 | 2.0.0 | openHAB Sound Support, Hosts: 111
170 | Active | 80 | 2.0.0 | openHAB Dashboard UI
175 | Active | 80 | 3.2.0 | Commons Net
179 | Active | 80 | 2.0.0 | HABPanel User Interface
181 | Active | 80 | 1.9.0 | openHAB Weather Binding
182 | Active | 80 | 2.0.0 | openHAB 1.x Compatibility Layer
184 | Active | 80 | 0.9.0.b4 | MacOS Text-to-Speech
185 | Active | 80 | 2.0.0 | MaryTTS Voice Service
186 | Active | 80 | 2.0.0 | openHAB Cloud Connector Bundle
187 | Active | 80 | 1.9.0 | openHAB Mail Action
188 | Active | 80 | 1.9.0 | openHAB NotifyMyAndroid Action
190 | Active | 75 | 0.9.0.b4 | Eclipse SmartHome Map Transformation Service
191 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome UPnP Transport Bundle
192 | Active | 80 | 2.0.0 | Samsung Tv Binding
194 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Automation API
195 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Automation commands
196 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Automation Core
197 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Automation Module Core
198 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Automation Media Modules
199 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Automation Module Script
200 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Automation Script Globals
201 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Automation Module Timer
202 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Automation GSON Parser
203 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Automation Providers
204 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Automation REST API
205 | Active | 75 | 0.9.0.b4 | Eclipse SmartHome RegEx Transformation Service
208 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome WebApp UI
209 | Active | 80 | 2.0.0 | openHAB Classic UI Fragment
214 | Active | 80 | 0.9.0.b4 | Eclipse SmartHome Paper UI, Fragments: 215
215 | Resolved | 80 | 2.0.0 | openHAB Paper UI Theme Fragment, Hosts: 214
216 | Active | 80 | 0.9.0.b4 | YahooWeather Binding
217 | Active | 80 | 2.0.0 | Exec Binding
219 | Active | 75 | 0.9.0.b4 | Eclipse SmartHome Exec Transformation Service
220 | Active | 80 | 1.9.0 | openHAB Exec Binding
221 | Active | 80 | 2.0.0 | SqueezeBox Binding
224 | Active | 80 | 1.9.0 | openHAB FritzboxTr064 Binding
225 | Active | 80 | 1.9.0 | openHAB HTTP Binding
229 | Active | 80 | 0.9.0.b4 | ntp Binding
230 | Active | 80 | 1.9.0 | openHAB CalDav Command Binding
231 | Active | 80 | 1.9.0 | openHAB CalDav Calendar
232 | Active | 80 | 1.9.0 | openHAB CalDav Binding

Both CalDav bindings deinstalled and reinstalled in the meantime… without positive effect on this issue.

The log file output during the installation period:

2017-08-13 15:40:57.452 [DEBUG] [org.openhab.binding.caldav-personal ] - BundleEvent STARTING - org.openhab.binding.caldav-personal
2017-08-13 15:40:57.458 [DEBUG] [org.openhab.binding.caldav-personal ] - BundleEvent STARTED - org.openhab.binding.caldav-personal
2017-08-13 15:40:57.502 [DEBUG] [org.openhab.binding.caldav-personal ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService}={event.topics=openhab/command/*, service.pid=org.openhab.caldavPersonal, component.name=org.openhab.binding.caldav_personal, component.id=270, service.id=422, service.bundleid=232, service.scope=bundle} - org.openhab.binding.caldav-personal
2017-08-13 15:40:57.512 [DEBUG] [org.openhab.binding.caldav-personal ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.caldav_personal.CalDavBindingProvider}={component.name=org.openhab.binding.caldav_personal.caldavbindingprovider, component.id=271, service.id=421, service.bundleid=232, service.scope=bundle} - org.openhab.binding.caldav-personal

Some relevant items of the items list:

openhab> smarthome:items list

The first three items are found (and known), but with State=NULL.
The same, I can see, when I insert those items into HABpanel UI.

Cal_Entsorg (Type=StringItem, State=NULL, Label=Nächste Abholung:, Category=Kalender)
Cal_EntsorgDatum (Type=DateTimeItem, State=NULL, Label=Nächste Abholung:, Category=Kalender)
Cal_Presence (Type=SwitchItem, State=NULL, Label=Kalenderzugriff , Category=Kalender)
IT1000_1 (Type=SwitchItem, State=OFF, Label=IT-1000 #1 (variabel), Category=poweroutlet, Groups=[Funkschalter])
IT1000_2 (Type=SwitchItem, State=OFF, Label=Poolfilter, Category=poweroutlet, Groups=[Funkschalter, Pool])
IT1000_3 (Type=SwitchItem, State=OFF, Label=IT-1000 #3 (variabel), Category=poweroutlet, Groups=[Funkschalter])
IT1000_4 (Type=SwitchItem, State=OFF, Label=Poolbeleuchtung, Category=poweroutlet, Groups=[Funkschalter, Pool, Licht])
IT1000_5 (Type=SwitchItem, State=OFF, Label=IT-1000 #5 (variabel), Category=poweroutlet, Groups=[Funkschalter])
fboxName (Type=StringItem, State=FRITZ!Box 7490, Label=Fritzbox Modell, Category=receiver, Groups=[Fritzbox])
fboxWifi24 (Type=SwitchItem, State=ON, Label=Status WLAN Keller (2,4GHz), Category=network, Groups=[Fritzbox, WLAN])
fboxWifi50 (Type=SwitchItem, State=ON, Label=Status WLAN Keller (5,0GHz), Category=network, Groups=[Fritzbox, WLAN])