iCalendar binding

Hi and thanks for the awesome binding!

One question: My commands are not executed when the scheduled event ist starting/ending but when the icalendar binding refreshes the ical info.

I would have expected the commands to be issued at the start time of the event. Now I have set the refresh interval to 5m because otherwise the commands come worst case 60mins too late for an 60min refresh interval.
Example:
Set Heating Event Begin: 08:45 End: 09:15

2020-10-11 09:18:31.190 [DEBUG] [ar.internal.handler.ICalendarHandler] - Event: Heating Office, Command Tag: END:Set_THPS6_Temp:17°C => Set_THPS6_Temp.postUpdate(QuantityType: 17 °C)

09:18:31 is when the 5-minute refresh ran.
Is this the expected way it’s working? I’m on openhab 2.5.5.

Thank you so much and all the best,

Bob

Correct.

The binding polls the calendar events periodically at the refresh interval (this is actually the meaning of “refresh interval”). At each poll, it checks all the calendar events to discover those that have “just begun” resp. “just ended” during the interval since the last poll: For the “just begun” events, it processes the BEGIN tags; and for the “just ended” events, it processes the END tags.

1 Like

Thanks for the explanation. Maybe it’d be nice if the documentation stated that the refresh interval has an impact on when the actions are executed.
It works like a charm now, thank you for all the work you put into it!

I have suggested a change to Michael’s Pull Request.

1 Like

Hi. I’m really happy to have tried out this binding. Our municipality is publishing the waste tour in an iCal and previously I used http binding with some JS to figure out what’s the next day they come to empty the bins. Now it’s so much easier and I recently pushed automation a step further by setting up a calendar with events to regulate ventilation and blinds. Works perfectly! I had to struggle a bit with iCloud Calendars and couldn’t make it work - maybe this support can be added later. I switches to Office 365 Outlook Calendar and this works fine (even thou I was blocked by MS when I did put the refresh interval too low during the tryout phase).
Could be interesting to have some more channels on the binding, such as previous event, information about the event location, multiple events on the same timeslot and support for categories.

Kudos for your work! Well done!

Hello,
I am glad to see a new binding which is much more easy in calendar configuration. Great work!

Meantime, I try to react with some icons on my HABPanel and I am not sure how can I use Commands Tags for that. Could commands tag be used for the example below?

Example:
whenewer the binding recognizes there is an event next day, with dedicated name in the calendar’s entry, a dedicated switch shall be ON and my icon on a panel will change its status.
If it ends, switch will be OFF and icon will change its status.

Is it possible with this bining?

My Items:

String CalendarName1   "Now [%s]"                                                   <calendar>  { channel="icalendar:calendar:29d480ef:current_title" } 
DateTime CalendarTimeStart1 "Starts [%1$ta, %1$te %1$tb %1$tl:%1$tM%1$tp]"              <calendar>  { channel="icalendar:calendar:29d480ef:current_start" } 
DateTime CalendarTimeEnd1 "Ends [%1$ta, %1$te %1$tb %1$tl:%1$tM%1$tp]"                  <calendar>  { channel="icalendar:calendar:29d480ef:current_end" }
//String CalendarAt1 "At [%s]"                                                            <calendar>  { caldavPersonal="calendar:Garbage type:EVENT eventNr:1 value:PLACE" } 

String CalendarName2   "Coming up [%s]"                                                 <calendar>  { channel="icalendar:calendar:29d480ef:next_title" } 
DateTime CalendarTimeStart2 "Starts [%1$ta, %1$te %1$tb %1$tl:%1$tM%1$tp]"              <calendar>  { channel="icalendar:calendar:29d480ef:next_start" } 
DateTime CalendarTimeEnd2 "Ends [%1$ta, %1$te %1$tb %1$tl:%1$tM%1$tp]"                  <calendar>  { channel="icalendar:calendar:29d480ef:next_end" }

My virtual switch:

Switch  MeetingBegins           "Meeting begins"            <switch>

…I answered the question myself :slight_smile:
Commands tags are defined in the calendar entry description. Look here:
It is imporant you have descritpion without HTML formatting.

Now I am able to change the switch item. I am not sure I will realize my example with this mathod.
Any other ideas, options how to react on the meeting planned next day?

Can someone post short guide how to connect to ios iphone calendar with this binding ? Assuming that connection works with caldav binding so i have all necessary addresses/passwords etc.

I’m afraid that this is not possible as of now.

I tried to use iCloud CalDav first and unfortunately, with all different how-tos Google could provide me in terms of reading an iCloud calendar in 3rd party applications, none of this worked out with iCalendar.

I even tried to publish a calendar to exclude that it might have been an authentication issue, but no success.

I finally published a calendar on my Microsoft Outlook account.

I would appreciate support or a working how-to for iCloud calendars thou.

Honestly in my opinion it is important to have possibility to connect to icloud calendar while OH3 is going to not support legacy bindings and caldav will not be an option :frowning:

Please check if your URL begins with http(s). Adding a published iCloud calendar just works if you replace webcal:// with https://:

icloud-config
results in

Michael,
i see similar problem (details in this post)
I have three links to coose in google:

Which one ist the correct one? None of them works for me. Conection is established, interval set to 15min and I receive the same wornings as @bruxi
I do not know what is wrong. I had this binding working for a first time with public iCal format. Than because of interval to high i received wornings. Increasing to 15min did not resolve the problem.
I am lost. Really.

I would encourage you to develop further this binding since this is much more intuitive than the older way.It has potential. Many people will swich to it for garbage collections example

Looking Forward to your reply.
JD

As the binding name suggests, the calendar has to be in iCalendar format. This format is specified in RFC 5545, this binding only shows VEVENTs from the calendar.

From the description inside the Google Calendar, the bottom two URLs are in iCalendar format. I can’t currently say why only the first download works and subsequent ones are failing. There seems to be an issue about logging the error - which i reported here a few minutes ago and now i will fix it by describing the errors a bit more. The fix for the issue will be published in OH 3.x.

Hello Michael,
for me this binding is unstable yet. I did not change anything and suddenly my item has been updated. But only for a short period of time. Afterwards ist stopped updating with the same warning above.
I can not set log in karaf as well since I do not see iCalendar bining connection

 org.openhab.binding.iCalendar

or I am simple not experience enough to find a different way to trace what is happenning :wink:

Anyway. Do not give up. People are looking fopr simple method of connection to icalandars than proposes config. files in version 1.X
Binding is the right way.

openhab> list -s
START LEVEL 100 , List Threshold: 50
 ID │ State  │ Lvl │ Version                 │ Symbolic name
────┼────────┼─────┼─────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────
 19 │ Active │  80 │ 5.3.1.201602281253      │ com.eclipsesource.jaxrs.publisher
 20 │ Active │  80 │ 2.8.2.v20180104-1110    │ com.google.gson
 21 │ Active │  80 │ 18.0.0                  │ com.google.guava
 22 │ Active │  80 │ 27.1.0.jre              │ com.google.guava
 23 │ Active │  80 │ 1.0.1                   │ com.google.guava.failureaccess
 24 │ Active │  80 │ 3.0.0.v201312141243     │ com.google.inject
 25 │ Active │  80 │ 4.8.35.v20190528-1517   │ io.github.classgraph
 26 │ Active │  80 │ 3.18.1.GA               │ javassist
 29 │ Active │  80 │ 3.5.5                   │ javax.jmdns
 31 │ Active │  80 │ 1.0.0                   │ javax.measure.unit-api
 33 │ Active │  80 │ 1.1.0.Final             │ javax.validation.api
 35 │ Active │  80 │ 2.0.1                   │ javax.ws.rs-api
 36 │ Active │  80 │ 2.9.2                   │ joda-time
 37 │ Active │  80 │ 0.5.8                   │ jollyday
 38 │ Active │  80 │ 3.2.0.v201101311130     │ org.antlr.runtime
 40 │ Active │  80 │ 1.1                     │ org.apache.commons.exec
 41 │ Active │  80 │ 2.2.0                   │ org.apache.commons.io
 42 │ Active │  80 │ 2.6                     │ org.apache.commons.lang
 51 │ Active │  80 │ 4.2.7                   │ org.apache.karaf.event
 66 │ Active │  80 │ 1.4.7.1                 │ org.apache.servicemix.bundles.xstream
 69 │ Active │  80 │ 4.14.0                  │ org.apache.xbean.bundleutils
 70 │ Active │  80 │ 4.14.0                  │ org.apache.xbean.finder
 71 │ Active │  80 │ 2.12.0.v20160420-0247   │ org.eclipse.emf.common
 72 │ Active │  80 │ 2.12.0.v20160420-0247   │ org.eclipse.emf.ecore
 73 │ Active │  80 │ 2.11.0.v20160420-0247   │ org.eclipse.emf.ecore.change
 74 │ Active │  80 │ 2.12.0.v20160420-0247   │ org.eclipse.emf.ecore.xmi
 75 │ Active │  80 │ 3.10.400.v20190516-1504 │ org.eclipse.equinox.common
104 │ Active │  80 │ 0.8.0.v20190822-0801    │ org.eclipse.lsp4j
105 │ Active │  80 │ 0.8.0.v20190822-0801    │ org.eclipse.lsp4j.jsonrpc
106 │ Active │  80 │ 2.19.0.v20190902-0728   │ org.eclipse.xtend.lib
107 │ Active │  80 │ 2.19.0.v20190902-0728   │ org.eclipse.xtend.lib.macro
108 │ Active │  80 │ 2.19.0.v20190902-0737   │ org.eclipse.xtext
109 │ Active │  80 │ 2.19.0.v20190902-0952   │ org.eclipse.xtext.common.types
110 │ Active │  80 │ 2.19.0.v20190902-0737   │ org.eclipse.xtext.ide
111 │ Active │  80 │ 2.19.0.v20190902-0737   │ org.eclipse.xtext.util
112 │ Active │  80 │ 2.19.0.v20190902-0952   │ org.eclipse.xtext.xbase
113 │ Active │  80 │ 2.19.0.v20190902-0952   │ org.eclipse.xtext.xbase.ide
114 │ Active │  80 │ 2.19.0.v20190902-0728   │ org.eclipse.xtext.xbase.lib
129 │ Active │  80 │ 1.9.6                   │ org.jvnet.mimepull
131 │ Active │  80 │ 7.1.0                   │ org.objectweb.asm.commons
132 │ Active │  80 │ 7.1.0                   │ org.objectweb.asm.tree
133 │ Active │  80 │ 2.5.0                   │ org.openhab.core
134 │ Active │  80 │ 2.5.0                   │ org.openhab.core.audio
135 │ Active │  80 │ 2.5.0                   │ org.openhab.core.auth.oauth2client
136 │ Active │  80 │ 2.5.0                   │ org.openhab.core.binding.xml
137 │ Active │  90 │ 2.5.0                   │ org.openhab.core.boot
138 │ Active │  80 │ 2.5.0                   │ org.openhab.core.config.core
139 │ Active │  80 │ 2.5.0                   │ org.openhab.core.config.discovery
140 │ Active │  80 │ 2.5.0                   │ org.openhab.core.config.discovery.mdns
141 │ Active │  80 │ 2.5.0                   │ org.openhab.core.config.dispatch
142 │ Active │  75 │ 2.5.0                   │ org.openhab.core.config.xml
143 │ Active │  80 │ 2.5.0                   │ org.openhab.core.ephemeris
144 │ Active │  80 │ 2.5.0                   │ org.openhab.core.id
145 │ Active │  80 │ 2.5.0                   │ org.openhab.core.io.console
146 │ Active │  80 │ 2.5.0                   │ org.openhab.core.io.console.karaf
147 │ Active │  80 │ 2.5.0                   │ org.openhab.core.io.http
149 │ Active │  80 │ 2.5.0                   │ org.openhab.core.io.monitor
150 │ Active │  80 │ 2.5.0                   │ org.openhab.core.io.net
151 │ Active │  80 │ 2.5.0                   │ org.openhab.core.io.rest
152 │ Active │  80 │ 2.5.0                   │ org.openhab.core.io.rest.audio
153 │ Active │  80 │ 2.5.0                   │ org.openhab.core.io.rest.core
154 │ Active │  80 │ 2.5.0                   │ org.openhab.core.io.rest.mdns
155 │ Active │  80 │ 2.5.0                   │ org.openhab.core.io.rest.optimize
156 │ Active │  80 │ 2.5.0                   │ org.openhab.core.io.rest.sitemap
157 │ Active │  80 │ 2.5.0                   │ org.openhab.core.io.rest.sse
158 │ Active │  80 │ 2.5.0                   │ org.openhab.core.io.rest.voice
159 │ Active │  80 │ 2.5.0                   │ org.openhab.core.io.transport.mdns
160 │ Active │  80 │ 2.5.0                   │ org.openhab.core.karaf
161 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.core
162 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.item
163 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.item.ide
164 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.item.runtime
165 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.lsp
166 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.persistence
167 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.persistence.ide
168 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.persistence.runtime
169 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.rule
170 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.rule.ide
171 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.rule.runtime
172 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.script
173 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.script.ide
174 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.script.runtime
175 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.sitemap
176 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.sitemap.ide
177 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.sitemap.runtime
178 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.thing
179 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.thing.ide
180 │ Active │  80 │ 2.5.0                   │ org.openhab.core.model.thing.runtime
181 │ Active │  80 │ 2.5.0                   │ org.openhab.core.persistence
182 │ Active │  80 │ 2.5.0                   │ org.openhab.core.scheduler
183 │ Active │  80 │ 2.5.0                   │ org.openhab.core.semantics
184 │ Active │  80 │ 2.5.0                   │ org.openhab.core.storage.json
185 │ Active │  80 │ 2.5.0                   │ org.openhab.core.thing
186 │ Active │  75 │ 2.5.0                   │ org.openhab.core.thing.xml
187 │ Active │  80 │ 2.5.0                   │ org.openhab.core.transform
188 │ Active │  80 │ 2.5.0                   │ org.openhab.core.ui
189 │ Active │  80 │ 2.5.0                   │ org.openhab.core.ui.icon
190 │ Active │  80 │ 2.5.0                   │ org.openhab.core.voice
191 │ Active │  80 │ 2.5.8                   │ org.openhab.ui.dashboard
200 │ Active │  80 │ 1.4.0                   │ org.threeten.extra
201 │ Active │  80 │ 1.0.3                   │ tec.uom.lib.uom-lib-common
202 │ Active │  80 │ 1.0.10                  │ tec.uom.se
205 │ Active │  80 │ 3.15.0.OH2              │ com.neuronrobotics.nrjavaserial
206 │ Active │  80 │ 5.5.0                   │ com.sun.jna
207 │ Active │  80 │ 5.5.0                   │ com.sun.jna.platform
208 │ Active │  80 │ 1.6.2                   │ com.sun.mail.javax.mail
209 │ Active │  80 │ 1.0.0                   │ io.socket.engine.io-client
210 │ Active │  80 │ 1.0.0                   │ io.socket.socket.io-client
211 │ Active │  80 │ 1.9.2                   │ jackson-core-asl
212 │ Active │  80 │ 1.9.2                   │ jackson-mapper-asl
213 │ Active │  80 │ 20180813.0.0            │ json
214 │ Active │  80 │ 1.10.0                  │ org.apache.commons.codec
215 │ Active │  80 │ 3.3.0                   │ org.apache.commons.net
216 │ Active │  80 │ 4.2.3                   │ org.apache.httpcomponents.httpclient
217 │ Active │  80 │ 4.2.3                   │ org.apache.httpcomponents.httpcore
218 │ Active │  80 │ 3.1.0.7                 │ org.apache.servicemix.bundles.commons-httpclient
219 │ Active │  80 │ 3.8.1.1                 │ org.apache.servicemix.bundles.okhttp
220 │ Active │  80 │ 1.13.0.1                │ org.apache.servicemix.bundles.okio
221 │ Active │  80 │ 2.0.0                   │ org.eclipse.californium.core
222 │ Active │  80 │ 2.0.0                   │ org.eclipse.californium.element-connector
223 │ Active │  80 │ 2.0.0                   │ org.eclipse.californium.osgi
224 │ Active │  80 │ 2.0.0                   │ org.eclipse.californium.scandium
225 │ Active │  80 │ 2.5.8                   │ org.openhab.binding.airquality
226 │ Active │  80 │ 2.5.8                   │ org.openhab.binding.astro
227 │ Active │  80 │ 2.5.8                   │ org.openhab.binding.bosesoundtouch
228 │ Active │  80 │ 2.5.8                   │ org.openhab.binding.mail
229 │ Active │  80 │ 2.5.8                   │ org.openhab.binding.systeminfo
230 │ Active │  80 │ 2.5.8                   │ org.openhab.binding.tradfri
231 │ Active │  80 │ 2.5.8                   │ org.openhab.binding.zwave
232 │ Active │  80 │ 2.5.0                   │ org.openhab.core.compat1x
233 │ Active │  80 │ 2.5.0                   │ org.openhab.core.config.discovery.usbserial
234 │ Active │  80 │ 2.5.0                   │ org.openhab.core.config.discovery.usbserial.linuxsysfs
235 │ Active │  80 │ 2.5.0                   │ org.openhab.core.config.serial
236 │ Active │  80 │ 2.5.0                   │ org.openhab.core.io.transport.serial
237 │ Active │  80 │ 2.5.0                   │ org.openhab.core.io.transport.serial.rxtx
238 │ Active │  80 │ 2.5.0                   │ org.openhab.core.io.transport.serial.rxtx.rfc2217
239 │ Active │  80 │ 2.5.8                   │ org.openhab.io.javasound
240 │ Active │  80 │ 2.5.8                   │ org.openhab.io.openhabcloud
241 │ Active │  80 │ 2.5.8                   │ org.openhab.io.webaudio
242 │ Active │  80 │ 1.14.0                  │ org.openhab.persistence.influxdb
243 │ Active │  75 │ 2.5.8                   │ org.openhab.transform.map
244 │ Active │  80 │ 2.5.8                   │ org.openhab.ui.basic
245 │ Active │  80 │ 2.5.8                   │ org.openhab.ui.habmin
246 │ Active │  80 │ 2.5.8                   │ org.openhab.ui.habpanel
247 │ Active │  80 │ 2.5.8                   │ org.openhab.ui.homebuilder
248 │ Active │  80 │ 2.5.8                   │ org.openhab.ui.iconset.classic
249 │ Active │  80 │ 2.5.8                   │ org.openhab.ui.paper
256 │ Active │  80 │ 2.9.10                  │ com.fasterxml.jackson.core.jackson-annotations
257 │ Active │  80 │ 2.9.10                  │ com.fasterxml.jackson.core.jackson-core
258 │ Active │  80 │ 2.9.10                  │ com.fasterxml.jackson.core.jackson-databind
259 │ Active │  80 │ 2.5.8                   │ org.openhab.binding.icalendar

After complete server shuttown and new start binding has started to work again.
Also Trace is working.

System:
Openhab 2.5.8
Raspberry Pi 3
Calendar Update interval: 10-15min

@wiewior: This is nice to read. An enhancement about logging the error in exact that situation already merged and should now already be available in snapshot builds. It will be included in OpenHAB 3.0.0 Milestone 2.

Please also note that filtering log messages may be case sensitive (surely depending how you filter the logs). So maybe just a case-issue may filter out too much.

I’ve installed this binding and it works for my first requirement.

But I have another featurerequest. At the moment, it is only possible to one next event. Would it be possible to have the next n events? I use the binding for notifications for garbage collection. At some dates there are two or more different types. My need is, that I can process all titles from this date inside a rule.

And a regex filter for the event like in the v1 binding. For me this v2 binding is less then 50% from the v1 binding…

Would that be possible?

Thank you for your work :slight_smile:

Warning, following is a rant (please read it in that context):

Sorry guys, this is not a replacement of caldav binding and it was never intended to be. It was too complicated for me to write a replacement. So my orientation what i’ve implemented and what other people implement is what they need. If you need further features please implement them. It is quite hard work.

@Malte: your post reads very demanding. Please note the work done here (as with the most parts of OpenHAB) is done in spare time. If you want to demand features - sorry, you need to pay a commercial vendor for that.

Also you could have explored a bit the development channels - then you would have known that multiple events and regex filters both things are already implemented.

End of rant.

2 Likes