CalDAV Simple example to turn something ON and OFF?

I have used a lot of time to get familiar with CalDAV binding but I am started to feel myself a total dummy!

I have surfed a lot but not find a simple example to get the point how to implement simple switch through CalDAV server to the my KNX installation at home.

So, I have my CalDAV Server up and running (Radicale Portable) in my WinXP machine. That’s works fine. I have tested it with eM Client. Also with my Android tablet I can read the calendar from CalDAV Server.

But my biggest gap is that I cannot get the point how openHAB binding shouls be configurate to just put my openHAB item to be configured to turn something ON and OFF. KNX binding and Modbus bindings just work fine from the openHAB classic UI but now I want to use calendar things in my system (Car preheating in winter times…).

I have read binding information many many times but I cannot got the point where should I put BEGIN and END things. Via CalDAV client directly to the description field to the CalDAV server calendar or to the openHAB rules or where and what.

Maybe sounds silly thing for more experienced users but if anyone could and like to help a little bit and write a small example I would be extremely happy! Now I have used five (5) long evenings in struggling with this.

Of course there is cron but I really like the way to do calendar things via good CalDAV UI.

Thank you for advance.
-Marko

1 Like

Did you take a look in the wiki?

I didn’t try radicale but followed the wiki. I tried GMX calendar and it didn’t seem to work. The events are scheduled according to the log file, but nothing happened. Maybe the cal format returned by GMX is not compatible…

Yes I did but that was the only source I found but I did not got the glue. I am missing understanding to where and how I should configure to turn one KNX relay ON and OFF in a certain time which I have put to CalDAV Server.

I just don’t understand should I put :BEGIN and :END things to the calendar or somewhere into openHAB rules/scripts or what?

So I think that I have somekind of lack of knowledge of CalDAV itself or openHAB and for sure in both :relaxed:

So just a simple workaround in steps is what I looking for…

Another thing could also be as “hme” wrote and maybe Radicale is just not compatible enough with openHAB?

But anyway; a simple example about configuration with all steps to simple person is my wish. Wiki example I just don’t understand :disappointed:

Hi,

BEGIN:itemname:ON go to the event’s description in the calendar. If you look at openhab log output (e.g. after restart) it should then write something about scheduling events.

Hi,

Thank you, the magic words from you Martin was that BEGIN:Itemname:ON should be in a calendar itself!

Also I had < and > characters in my caldavCommand:readCalendars=<> which should be erased and only put the name of calendar after = mark :confused:

Now it is working fine. I did not got Radicale Portable work in my Win2k server but pure Radicale works fine and now I could read and write calendar with eM Client and also with iPad and Android tablets. Now my car is preheated via CalDAV bindings! Great Job for people who has done it!

Hi,
Is the “caldavCommand:readCalendars=…” stuff mandatory? According to my understanding of the wiki I thought not?

I’m quite new to openhab and tried to tweak around the caldav command binding but i get this error log :
2016-01-27 19:05:52.734 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'mysql.persist’
2016-01-27 19:05:57.366 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'default.items’
2016-01-27 19:06:20.850 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'default.sitemap’
2016-01-27 19:06:31.384 [INFO ] [penhab.io.rest.RESTApplication] - Started REST API at /rest
2016-01-27 19:06:37.322 [INFO ] [.o.u.w.i.servlet.WebAppServlet] - Started Classic UI at /classicui/openhab.app
2016-01-27 19:06:48.740 [INFO ] [.service.AbstractActiveService] - CalDav Loader has been started
2016-01-27 19:06:49.170 [INFO ] [.i.c.internal.CalDavLoaderImpl] - reload job scheduled for: com_test
2016-01-27 19:07:04.208 [ERROR] [o.o.i.c.i.job.EventReloaderJob] - error while loading calendar entries: handshake alert: unrecognized_name
javax.net.ssl.SSLProtocolException: handshake alert: unrecognized_name

I don’t see what’s wrong in my configuration. When i’m connecting to my caldav account on owncloud with curl and the same url, username and password than the one configured in the openhab.cfg file everything works fine.

Thanks for your help.

Eric

Hello Eric,

your post drew my attention to that setting. Actually the caldavCommand:readCalendars is mandatory which makes perfectly sense when thinking about it. All the caldavio stuff is just for reading calendars and scheduling events. For what is inside the event we need the caldavcommand which needs to know which events of which calendar to look on. So thanks, that what helped me, getting the caldav command to work.

Martin

The more I’m digging the less I understand.

In my default.items file i’ve got this item:
Number Test_bis “test 2 [%.1f o]” (GF_Living)

On my caldav I configured an event such as this:
BEGIN:Test_bis:11,2
END:Test_bis:5

I without the caldavCommand:readCalendars line I get this log :
2016-01-31 13:56:28.139 [INFO ] [.service.AbstractActiveService] - CalDav Loader has been started
2016-01-31 13:56:28.839 [INFO ] [.i.c.internal.CalDavLoaderImpl] - reload job scheduled for: com_test
2016-01-31 14:00:00.032 [INFO ] [o.caldav.internal.job.EventJob] - event BEGIN for: dfbef57057(test2@31.01.2016/14:00-31.01.2016/14:05)
2016-01-31 14:05:00.003 [INFO ] [o.caldav.internal.job.EventJob] - event END for: dfbef57057(test2@31.01.2016/14:00-31.01.2016/14:05)
2016-01-31 14:30:00.003 [INFO ] [o.caldav.internal.job.EventJob] - event BEGIN for: dfbef57057(test2@31.01.2016/14:30-31.01.2016/15:00)
2016-01-31 15:00:00.003 [INFO ] [o.caldav.internal.job.EventJob] - event END for: dfbef57057(test2@31.01.2016/14:30-31.01.2016/15:00)

But nothing happened to my item called Test_bis

When I’m adding the the caldavCommand:readCalendars to my openhab.cfg I’m getting no log from caldavio at all.

What’s wrong?

After checking it’s working: I did some typo in the caldavCommand:…

the description is the wiki is unfortunately horribly bad and totally convoluted with respects of terminology.

I have tried to improve it already a bit but still I am struggling to “decode” any meaning. It should be possible to understand the stuff without having to dig into the java code.

In the wiki there is a paragraph which I do not understand at all:
(I have marked my problems with -> ) It would be great if someone more intelligent than I could clearify a bit.

CalDAV Command

Binding file: org.openhab.binding.caldav-command-version.jar

Used to execute commands through an event, triggered at the start or the end of an event.
-> what does the author mean by commands?
-> what is an “event” is it a entry in the calendar, so to say a calendar event?
-> is the purpose of the whole paragraph to write into the calendar or to trigger a change in an openhab item?
-> it would be great to clear not use the words “item” and “event” other than what the are in the openhab context. So if the author is refering to event that was defined in the calendar, then call it calender entry but not event which is what is defined between a when then statement in rules files of openhab.

The event summary is free selectable.
-> what is an event summary ?

The event description must fullfill special syntax.
Syntax is <BEGIN|END>::.
Each item trigger must be a single line without linebreaks.
-> what is an item trigger ?

Every line which starts with “BEGIN” will be executed at the begin of the event.
Each line with an “END” will be executed at the end of the event. You
can define multiple lines, which must not be ordered. For example:

BEGIN:Heater_Livingroom:22
BEGIN:Heater_Corridor:22
END:Heater_Livingroom:16
END:Heater_Corridor:16
END:Notification_Dummy:Heizung heruntergefahren

-> at this moment an example would be great. My understanding it that this whole definition will be used in item rules ot in the cfg.

Additionaly you can define an item to listen to upcoming changes of
an item (which will be triggered through an event). Two types are
available the command which will be set and the trigger time.
Syntax is caldavCommand="itemName: type:<VALUE|DATE>"
Furthermore a switch can be defined to disable the automatic execution (through calendar) of an item.
Syntax is caldavCommand=“itemName: type:”

-> So there seem to be two different items. A kind of informational Item that contains the date and possible contents of another item that actually will be triggered ???
-> and also the informational item seems also to have the ability to enable and disalbe the trigger of the item that shall be triggered??

openhab.cfg
caldavCommand:readCalendars= (multiple calendars can be seperated by commas)

Hi Martin,
with some Trial and Error I found the following:

ownCloud configuration:
User: openhab
Password: YYYYYY
Calendar: openhab
This gives the Input for the cfg file:
caldavio:openhab:url=http://XXXXXXX.fritz.box/owncloud/remote.php/caldav/calendars/user/calendar

XXXXXX is the name of the server. Maybe IP adress does also work.

CFG File:
caldavio:openhab:url=http://XXXXXXX.fritz.box/owncloud/remote.php/caldav/calendars/openhab/openhab
caldavio:openhab:username=openhab
caldavio:openhab:password=YYYYYY
caldavio:openhab:reloadInterval=10
caldavio:openhab:preloadTime=20000
caldavCommand:readCalendars=openhab
caldavPersonal:usedCalendars=openhab

Items:
Switch Thekenlicht “Thekenlicht” (Licht, Kueche, Raeume) {rwe2=“id=8b35bdf1-111f-4fdb-9e7e-159757e2c7f8,param=switch”}

This a switch item which is using the RWE binding. So in principle any ordinary switch item.

I use an I-Phone and connected it to ownCloud via “add account” - “Other”.
Creating an event in the calendar I chose the openhab calendar.

Name: Thekenlich (same than the item)
Location: (does not matter)
Use start and end time.
Description:
BEGIN:Thekenlicht:ON
END:Thekenlicht:OFF

By this the light is switched on, at the start of the event and switched off at the end.

Maybe this helps you a little bit.

Cheers

Björn

HI Martin,
thanks for your reply.

Are you really referring to the new cal dav binding?
I did not see that the description part is necessary anymore in the new binding.
Which is actually good because it made importing of public calendar more complicated.
regards Martin

Hi Martin,
I refer to 1.8.0 caldav binding.
The description is necessary, if you want to use the caldav.command.
In German:
Titel: "does not matter"
Ort: "does not matter"
Beginn: "time when action starts BEGIN-> e.g. activation of switch"
Ende: : "time when action ends END-> e.g. activation of switch"
Notizen: "where you put your commands like BEGIN:Switch:ON
END:Switch:OFF
Cheers
Björn
PS: Important that you chose the right calender in the IOS.

1 Like

Hi there,

Good converstion from you, that’s why I deleted the [solved] word from the title.

There are something in a wiki and I am right with you that it leads maybe to some misunderstoodings. But I cannot say neither how it should be written to get more easier to understood.

But anyway keep going guys!

I give up after having spend about 2 hours getting something to work without success.
Too bad.
Will use iFTTT and myopenhab instead.

[quote=“martin_klimke, post:16, topic:6586, full:true”]
… about 2 hours [/quote]

After that short period of time I’m starting to dig for problems … just kidding :yum:

Hi Martin,
can I help somehow?
Cheers Björn

@Börn,

Yes, if you could answer the questions in my posting above indicated by "->"
regards Martin

Hi Martin,
I’ll try my very best on basis what worked for me (after several hours of trial and error):

If you create an event in the calendar app of your choice synchronized via caldav with openHAB, you can via text lines in the description section “instruct” openHAB to carry out actions -> commands. See here for i-phone entry:

The actual command in the calendar is the second part of “BEGIN:Thekenlicht:ON”, thus a command is send via the caldav binding to openHAB to put switch “Thekenlicht” to ON at start time of the calender entry (event). In your case: Put temperature to 22 of Heater_Livingroom.
Anyhow: in your items file of openHAB a corresponding item (in my case a switch “Thekenlicht” see post before) needs to be defined.

Yes. See answer before. The actual calender entry you are doing.

You “only” need to write in the calendar, as long as you have defined the corresponding items in your openHAB items file and configured the cfg file right (see also afore). This writing in the calendar then triggers a change in the openHAB item at the date and start time defined in your calendar entry.

You are right. This was misleading for me at first.

See afore: “BEGIN:Thekenlicht:ON” This line triggers the command of the item “Thekenlicht” to ON to be executed in openHAB.

I tried to give a detailed example in a post before (you do NOT need rules for that!):

In principle you are right. You define two items in your item file. One to visualize the events coming up (like this - however, having nothing to do with carrying out commands via your calendar event):
In items file:

String Event1 “Event1 [%s]” {caldavPersonal=“calendar:openhab type:EVENT eventNr:1 value:NAMEANDTIME”}

In sitemaps file:

Text item=Event1

And another you want to trigger (like this):

Switch Thekenlicht “Thekenlicht” (Licht, Kueche, Raeume) {rwe=“id=8b35bdf1-111f-4fdb-9e7e-159757e2c7f8,param=switch”}

The statement "caldavCommand=“itemName: type:” means only that you can introduce a switch in your openHAB setup which allows you to deactivate the caldav command feature.

Hope I could help a bit.

Cheers
Björn