Hi,
because it was a bit hard to find all the steps needed to configure my iCloud calender (iCal) to calDav-Binding - i will list here the steps for the others coming up with it
( by the way, thanks to @Andrew_Pawelski and his “ical-connection” thread here )
for this HowTo, you only need the "CalDAV Personal Binding"
- Log into your Apple-ID at appleid.apple.com ( not www.icloud.com! ) . Confirm your login by entering the two-factor identification code sent. Once logged in, look for the section in your Apple ID control panel labeled “Security” and click on “Generate Password”
-
When prompted, label the app-specific password whatever you want eg “OpenHab” and click “Create”.
-
Apple will provide you with a randomly generated alphanumeric string in the format xxx-xxxx-xxxx-xxxx. Highlight and copy the password and keep it somewhere safe.
-
Go on your Mac to your ~/Library/Calendars folder
-
You will see some folders with long string names, there should be one, with .caldav at the end
-
in this folder, there are maybe again a lot of long string folders, just go inside one of them and check the inside of info.plist
-
search for CalenderPath - there should be a string looking like this:
( the “0123456789” is the USER_ID )
<key>CalendarPath</key>
<string>/0123456789/calendars/XXX-XXXX-XXXXXX-XXXXXXXXXXXXXX/</string>
- now lets find the server adress, open Terminal and type,
replace this:
XXXXXXXXXX = your EMAIL adress ( icloud )
0123456789 = your USER_ID ( from step 7 above )
curl -s -X PROPFIND -u "XXXXXXXXX" -H "Depth: 0" --data "<propfind xmlns='DAV:' xmlns:cd='urn:ietf:params:xml:ns:caldav'><prop><cd:calendar-home-set/></prop></propfind>" https://calendars.icloud.com/0123456789/principal/
-
ENTER
password = type the app-specific password from step 3 -
hopefully you get something like this output:
<calendar-home-set xmlns="urn:ietf:params:xml:ns:caldav"><href xmlns="DAV:">https://p99-caldav.icloud.com:443/0123456789/calendars/</href></calendar-home-set>
- we know the Server Adress now ( p99 / Port: 443 )
https://p99-caldav.icloud.com:443/0123456789/calendars/
- lets check the available calenders with:
( replace email & url in the curl command )
curl -s -X PROPFIND -u "XXXXXXXXX" -H "Depth: 1" --data "<propfind xmlns='DAV:'><prop><displayname/></prop></propfind>" https://p99-caldav.icloud.com:443/0123456789/calendars/ | grep displayname
password = type the app-specific password from step 3
you should see somthing like this - we need the XXXXXXXX-Part for the .cfg file
<response>
<href>/0123456789/calendars/XXXXXXXXXXXXXXX/</href>
<propstat>
<prop>
<displayname>Büro</displayname>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
- now lets configure the caldavio.cfg
caldavio:YYYYYY:url=https://p99-caldav.icloud.com:443/0123456789/calendars/XXXXXXXXXXXXXXXXXX/
caldavio:YYYYYY:username=XXXX@icloud.com
caldavio:YYYYYY:password=XXXXXXXXX // your key from step 3 (not your iCloud account password)
caldavio:YYYYYY:reloadInterval=1440 // 24 hours interval ( Put 1 while testing)
caldavio:YYYYYY:preloadTime=30 // events in the past
caldavio:YYYYYY:disableCertificateVerification=false
YYYYYY = choose your calender name
username = iCloud Account
password = the key made in step 3
url = edit the p99, 0123456789, XXXXXXXXX to your informations given above
- maybe again restart openhab and hope that helped and you made it workin
- just for displaying events, there is no need to edit the caldavPersonal.cfg
ITEMS
String OfficeCalName0 "Termin jetzt [%s]" <calendar> (gDummy) { caldavPersonal="calendar:YYYYYY type:ACTIVE eventNr:1 value:NAME" } //eventNr for concurrent events
DateTime OfficeCalTime0 "Beginn [%1$tT, %1$td.%1$tm.%1$tY]" <calendar> (gDummy) { caldavPersonal="calendar:YYYYYY type:ACTIVE eventNr:1 value:START" } //eventNr for concurrent events
String OfficeCalName1 "nächster Termin [%s]" <calendar> (gDummy) { caldavPersonal="calendar:YYYYYY type:UPCOMING eventNr:1 value:NAME" }
DateTime OfficeCalTime1 "Beginn [%1$tT, %1$td.%1$tm.%1$tY]" <calendar> (gDummy) { caldavPersonal="calendar:YYYYYY type:UPCOMING eventNr:1 value:START" }
String OfficeCalName2 "übernächster Termin [%s]" <calendar> (gDummy) { caldavPersonal="calendar:YYYYYY type:UPCOMING eventNr:2 value:NAME" }
DateTime OfficeCalTime2 "Beginn [%1$tT, %1$td.%1$tm.%1$tY]" <calendar> (gDummy) { caldavPersonal="calendar:YYYYYY type:UPCOMING eventNr:2 value:START" }
Helpful Links
• Determing the URL of CalDAV Calendars ( iCloud, Google, Baikal, OwnCloud )
http://www.ict4g.net/adolfo/notes/2015/07/04/determingurlofcaldav.html
• Another Thread - same topic:
[SOLVED] Apple icloud CalDav connection
Github
https://github.com/openhab/openhab1-addons/wiki/CalDAV
Troubleshooting
if you see nothing displayed in the sitemap - check if you see the .ics files (step below)
when you see the .ics files, but nothing displayed in the sitemap - maybe you picked the wrong calender (e.g. shopping-list) - the sitemap cant display anything - change the “Folder-Number” in the caldavio.cfg file
maybe you have a wrong config file from ealier attemps stored in
/var/lib/openhab2/config/org/openhab/
Remove (or edit) all* .config files which are related to caldavio (caldavio.config, caldavPersonal.config, caldavCommand.config, i.e. “NameOfYourCalendar.config”).
After removing these files restart openhab
and check if your events are stored as *.ics files in
/var/lib/openhab2/etc/caldav/"nameOfYourCalendar"/
Check your Log for Infos
For Console ( KARAF) - i dunno which one helped for :
log:set TRACE org.openhab.binding.caldav_personal
log:set TRACE org.openhab.binding.caldav_personal.CalDavBindingProvider
log:set TRACE org.openhab.io.caldav.CalDavLoader
Clear Cache:
sudo /etc/init.d/openhab2 stop
sudo rm -rf /var/lib/openhab2/cache/*
sudo rm -rf /var/lib/openhab2/tmp/*
sudo /etc/init.d/openhab2 start
hopefully that helped you - good luck