{"id":1761,"date":"2017-10-12T22:29:12","date_gmt":"2017-10-13T03:29:12","guid":{"rendered":"http:\/\/lisa.rushworth.us\/?p=1761"},"modified":"2017-10-13T09:09:43","modified_gmt":"2017-10-13T14:09:43","slug":"exchange-2013-calendar-events-in-openhab-caldav","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=1761","title":{"rendered":"Exchange 2013 Calendar Events In OpenHAB (CalDAV)"},"content":{"rendered":"<p>We&#8217;ve wanted to get our Exchange calendar events into OpenHAB &#8212; instead of trying to create a rule to determine preschool is in session, the repeating calendar event will dictate if it is a break or school day. Move the gymnastics session to a new day, and the audio reminder moves itself. Problem is, Microsoft stopped supporting CalDAV.<\/p>\n<p>Scott found <a href=\"http:\/\/davmail.sourceforge.net\/\" target=\"_blank\" rel=\"noopener\">DAVMail<\/a> &#8212; essentially a proxy that can translate between CalDAV clients and the EWS WSDL. Installation was straight-forward (click &#8216;next&#8217; a few times). Configuration &#8212; for Exchange 2013, you need to select the &#8220;EWS&#8221; Exchange protocol and use your server&#8217;s EWS WSDL URL. https:\/\/yourhost.domain.cTLD\/ews\/exchange.asmx &#8230; then enable a local CalDAV port.<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=1762\" rel=\"attachment wp-att-1762\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1762\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2017\/11\/DavMAIL-Main.png\" alt=\"\" width=\"387\" height=\"430\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2017\/11\/DavMAIL-Main.png 387w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2017\/11\/DavMAIL-Main-270x300.png 270w\" sizes=\"auto, (max-width: 387px) 100vw, 387px\" \/><\/a><\/p>\n<p>On the &#8216;network&#8217; tab, check the box to allow remote connections. You *can* put the thumbprint of the IIS web site server certificate for your Exchange server into the &#8220;server certificate hash&#8221; field\u00a0<em>or<\/em> you can leave it blank. On the first connection through DAVMail, there will be a pop-up asking you to verify and accept the certificate.<\/p>\n<p>On the &#8216;encryption&#8217; tab, you can configure a private keystore to allow the client to communicate over SSL. I used a PKCS12 store (Windows type), but a java keystore should work too (you\u00a0<em>may<\/em> need to add the key signing key {a.k.a. CA public key} to the ca truststore for your java instance).<\/p>\n<p>On the advanced tab, I did not enable Kerberos because the OpenHAB CalDAV binding passes credentials. I did enable KeepAlive &#8211; not sure if it is used, the CalDAV binding seems to poll. Save changes and open up the DAVMail log viewer to verify traffic is coming through.<\/p>\n<p>Then comes Scott&#8217;s part &#8212; enable the bindings in OpenHAB (there are two of them &#8211; a CalDAVIO and CalDAVCmd). In the caldavio.cfg, the config lines <a href=\"https:\/\/github.com\/openhab\/openhab1-addons\/issues\/4917\" target=\"_blank\" rel=\"noopener\">need to be prefixed with &#8216;caldavio&#8217;<\/a> even though that&#8217;s not how it works in OpenHAB2.<\/p>\n<pre>caldavio:CalendarIdentifier:url=https:\/\/yourhost.yourdomain.gTLD:1080\/users\/mailbox@yourdomain.gTLD\/calendar\r\ncaldavio:CalendarIdentifier:username=mailbox@yourdomain.gTLD\r\ncaldavio:CalendarIdentifier:password=PasswordForThatMailbox\r\ncaldavio:CalendarIdentifier:reloadInterval=5\r\ncaldavio:CalendarIdentifier:disableCertificateVerification=true\r\n<\/pre>\n<p>Then in the caldavCommand.cfg file, you just need to tell it to load that calendar identifier:<\/p>\n<pre>caldavCommand:readCalendars=CalendarIdentifier\r\n<\/pre>\n<p>We have needed stop openhab, delete the config file from\u00a0.\/config\/org\/openhab\/ related to this calendar and binding before config changes are ingested.<\/p>\n<p>Last step is making a calendar item that can\u00a0<em>do stuff<\/em>. In the big text box that&#8217;s where a message body is located (no idea what that&#8217;s called on a calendar entry):<\/p>\n<p>BEGIN:Item_Name:STATE<br \/>\nEND:Item_Name:STATE<\/p>\n<p>The subject can be whatever you want. The start time and end time are the times for the begin and end events. Voila!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve wanted to get our Exchange calendar events into OpenHAB &#8212; instead of trying to create a rule to determine preschool is in session, the repeating calendar event will dictate if it is a break or school day. Move the gymnastics session to a new day, and the audio reminder moves itself. Problem is, Microsoft &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[63],"tags":[391,393,64,65,44,394,392],"class_list":["post-1761","post","type-post","status-publish","format-standard","hentry","category-home-automation","tag-caldav","tag-ews-wsdl","tag-exchange","tag-exchange-2013","tag-openhab","tag-openhab2","tag-wsdl"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/1761","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1761"}],"version-history":[{"count":2,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/1761\/revisions"}],"predecessor-version":[{"id":1764,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/1761\/revisions\/1764"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}