iCalendar binding

@damihe Thank you very much for your effort. After some days of testing the binding still runs very stable for me. Thumb up :+1:.

It was possible for me to migrate my complete setup in less than 10 minutes from openHAB 1 binding version. Yes, I am missing some information which was available before (e.g. event description or location) but during migration I realized that I do not need it. Time to get rid of some payload from my prod system.

One thing I would love to have in the future would be a way to retrieve more than one upcoming event. Additionally a trigger channel dispatching START / END of events opens flexibility regarding usage of profiles or rule triggers.

Another question: How does the bindings behave if there are multiple events starting at the same time? I am observing a waste collection calendar - which is published by the local community council - and in summer sometimes two different garbage cans are collected on the same day.

For the event trigger part, the binding will process all events in the calendar whose START resp. END time lies in the window between the time when a poll was last executed and the time when the current poll is being executed. So in other words neither multiple simultaneous events, nor multiple staggered events, will be lost.

@cweitkamp Christoph I have vaguely heard about “triggers” but I have never actually used them (or coded them) so => perhaps you can be a bit more specific about what you are looking for?

EDIT: to be more specific, let us say that at time T there are X events containing Command Tags that BEGIN/END in the time window around T; and since each of the X events might contain multiple BEGIN/END tags, then there are Y BEGIN Command Tags and Z END Command Tags in total. So I could image the binding could do one of the following three (four) things…

a) Send 1 trigger message

  • call once: triggerChannel(CHANNEL_EVENT_TRIGGER, "BEGIN" resp. "END");

b) Send X trigger messages

  • call X times: triggerChannel(CHANNEL_EVENT_TRIGGER, "BEGIN" resp. "END");

c) Send Y + Z trigger messages

  • call Y times: triggerChannel(CHANNEL_EVENT_TRIGGER, "BEGIN");
  • call Z times: triggerChannel(CHANNEL_EVENT_TRIGGER, "END");

d) Send something completely different

  • if so, please advise

Thanks for your feedback and of course thanks for your work on the binding too.

For explanation: My idea was to have a trigger channel to emit events like START or END at the beginning or at the end of an calendar event - similar to the existing channel current_presence toggling between ON and OFF. Why? A state channel always has to be linked to an item. This way its state changes (or updates) can be used to trigger a rule. We could omit the item by using channel based triggers. Additionally a trigger channel could be triggered twice (or even more often) if we have two calendar events starting at the same time.

But after your evaluation and the more I am thinking about it the less I am sure if we really need it. I wanted to trigger a rule by it which probably will do some stuff. Most of it can be done by defining command tags inside the event description in an even more flexible way. A rule would only be appropriate if a simple or complex calculation will be needed to perform stuff.

One more situation came to my mind in which a trigger channel could be useful: for reminders. This way one could e.g. play a sound via openHAB as notification.

@cweitkamp many thanks for the feedback; I believe it would be rather simple to send trigger channel messages (indeed I already wrote some code); however it is probably better to wait for some clarity about the exact requirements before I create a PR for this; …

hi,

i’m getting an error on the calendar that i want to use: handshake_failure
its my local trash calendar: https://inzamelkalender.hvcgroep.nl/ical/0505200000073214

icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure

is there something to check? (current openhab setup)

thank you

Hi Richard,

the message is a bit unspecific, there are many reasons why a handshake failure may occur. Some possible: TLS-version-skew, no cipher overlap, Packet loss…

The certificate itself looks good and the error message should be different if something is wrong with the certificate.

Please try to turn on debugging for finding out what’s happening there in detail.

Yeah, I got the same problem. It’s two garbage pick-ups in one day.
Furthermore the question: What is “currend” (always = today?) or “next” (always = tomorrow?).
Furthermore a search for a certain day would be interesting. Is there an appointment on a certain day?

Thanks!
Thomas

Current is whatever calendar event is currently active. The one whose start time has last passed and whose end time has not yet come.

And Next is whatever calendar event would next become Current (according to the definition above).

And if you use command triggers in the events then it will handle as many garbage collections as you want. The related item can be triggered whenever a calendar item become Current and has a BEGIN command in it. If more than one event becomes Current at the same time, then the BEGIN commands of all of them will be activated. Ditto for the END commands when all of the events become no longer current…

2 Likes

Hi

I’m currently using the caldav personal v1 binding to retrieve the next 3 future events from an icloud shared family calendar and displaying these (Date, Day, Title & Location) on a wall mounted tablet running HABPanel. This works well, however, I’m worried that once openHAB 3 is released and support/development of openHAB 2 stops, specifically the compatibility layer, that I will either loose this functionality or will have to remain on openHAB 2.

Is there any plans to increase the functionality of this binding to provide access to more than 1 future event and access to other fields?

Thanks

So I have to loop through the data. I have no idea how to program it. Is there an example of a rule?

Many thanks!

I’m not sure what you mean by looping through the data?? And you don’t need a rule to program it. You just need to put command tags inside the events in your calendar. See the ReadMe file for examples.

The feature is planned, but currently not in development. The user openhab-5iver (afair) at github seemed to have an simliar usecase.

2 Likes

What I don’t understand is: How I could find out and show today (14.07.) that tomorrow (15.07.) two appointments exist?

Using next_start I only find one next appointment out of two. Is there something like a FetchNext() loop?

ideas?

Hmmm. Currently this possibility does not exist. Also i’m not sure how i would implement a possibility to do that. What exactly you try to do?

I have the simple problem of being able to display two appointments for the next day.

Hi,

just started using iCalendar binding as replacement for CalDAV binding. Setup and documentation is straight forward and self explanatory, thanks for the good work.
What I see is that the binding works for a while (I have loglevel TRACE on) and after a while the whole binding seems to stop working at all.
There are neither more messages about fetching new events from the calendar nor does it trigger anything after some while.
Even though when I restart the bundle via karaf console the bindings stays dead.
I have to restart the whole openhab2 service to bring it back to life.

Any ideas for the cause?

This sounds like a problem with the scheduler as nothing happens anymore, at least when restarting the binding it should work again. Do other timebased bindings work well (bindings that use polling)?

Can’t say. Therefor that all other things work as expected I think iCalender is the only binding I use which uses the scheduler for polling.

I just set a new schedule with content:
BEGIN:EdisonLamp:ON
BEGIN:EdisonLamp:OFF

But the binding doesn’t seem to read the calendar anymore.

2020-10-06 09:51:58.468 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 09:53:58.470 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 09:55:58.473 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 09:57:58.476 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 09:59:58.479 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 10:01:58.482 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 10:03:58.485 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 10:05:58.488 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 10:07:58.491 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 10:09:58.494 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 10:11:58.497 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 10:13:58.500 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 10:15:58.503 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 10:17:58.506 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 10:19:58.509 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 10:21:58.512 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 10:23:58.515 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 10:25:58.518 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 10:27:58.521 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 10:29:58.524 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 10:31:58.527 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null
2020-10-06 10:33:58.531 [WARN ] [g.icalendar.internal.handler.PullJob] - Response for calendar request could not be retrieved. Error message is: null

Then I restarted openhab2 and the calendar entries are being read again:

2020-10-06 10:38:50.724 [TRACE] [.icalendar.internal.logic.CommandTag] - Command Tag Trace: "BEGIN:EdisonLamp:ON" => Fully valid Command Tag!
2020-10-06 10:38:50.725 [TRACE] [.icalendar.internal.logic.CommandTag] - Command Tag Trace: "BEGIN:EdisonLamp:OFF" => Fully valid Command Tag!
2020-10-06 10:38:50.738 [TRACE] [.icalendar.internal.logic.CommandTag] - Command Tag Trace: "BEGIN:EdisonLamp:ON" => Fully valid Command Tag!
2020-10-06 10:38:50.740 [TRACE] [.icalendar.internal.logic.CommandTag] - Command Tag Trace: "BEGIN:EdisonLamp:OFF" => Fully valid Command Tag!

Please check your URL and your frequency (maybe you are running into some limits). The message “Response for calendar request could not be retrieved” is written when downloading the calendar fails. If your URL is http, you can also analyse the traffic with tcpdump/wireshark.

After restarting, the still cached calendar is loaded again.