openhab1-addons icon indicating copy to clipboard operation
openhab1-addons copied to clipboard

[CalDav][personal] Events get ACTIVE at the wrong time

Open cweitkamp opened this issue 6 years ago • 2 comments

In my area it is usual to put the trashcan beside the street on the day before it will be picked up by the lorry. I have set up a calendar to trigger a reminder notification in the evening on the day before. I use a rule to compare the current date against the start date of an UPCOMING event. This works very nice. I additionally want to show an item in a sitemap on the day itself. This item is linked to an ACTIVE event. The item never shows up in time in my sitemap and is visible longer then expected. It always has a delay. The UPCOMING event doesn't switch to ACTIVE in time. It looks like the scheduler for this job is running at the wrong time.

The appointment in the calendar is a full-time entry from 2018-04-30T00:00 to 2018-05-01T00:00. I attached the ics file.

caldavio.cfg

caldavio:waste:reloadInterval=1440
caldavio:waste:preloadTime=10080

waste.items

DateTime wasteEventBegin "Begin [%1$tA, %1$td.%1$tm.%1$tY]" <calendar> {
    caldavPersonal="calendar:waste type:ACTIVE eventNr:1 value:START"
}
DateTime wasteEventEnd "End [%1$tA, %1$td.%1$tm.%1$tY]" <calendar> {
    caldavPersonal="calendar:waste type:ACTIVE eventNr:1 value:END"
}

DateTime wasteUpcoming1EventBegin "Begin [%1$tA, %1$td.%1$tm.%1$tY]" <calendar> {
    caldavPersonal="calendar:waste type:UPCOMING eventNr:1 value:START"
}
DateTime wasteUpcoming1EventEnd "End [%1$tA, %1$td.%1$tm.%1$tY]" <calendar> {
    caldavPersonal="calendar:waste type:UPCOMING eventNr:1 value:END"
}

events.log

2018-04-28 11:57:08.692 [vent.ItemStateChangedEvent] - wasteEventBegin changed from NULL to UNDEF
2018-04-28 11:57:08.728 [vent.ItemStateChangedEvent] - wasteEventEnd changed from NULL to UNDEF
2018-04-28 11:57:08.751 [vent.ItemStateChangedEvent] - wasteUpcoming1EventBegin changed from NULL to UNDEF
2018-04-28 11:57:08.753 [vent.ItemStateChangedEvent] - wasteUpcoming1EventEnd changed from NULL to UNDEF
2018-04-28 11:57:48.196 [vent.ItemStateChangedEvent] - wasteUpcoming1EventBegin changed from UNDEF to 2018-04-30T00:00:00.000+0200
2018-04-28 11:57:48.198 [vent.ItemStateChangedEvent] - wasteUpcoming1EventEnd changed from UNDEF to 2018-05-01T00:00:00.000+0200
...
2018-04-30 11:57:50.504 [vent.ItemStateChangedEvent] - wasteEventBegin changed from UNDEF to 2018-04-30T00:00:00.000+0200
2018-04-30 11:57:54.009 [vent.ItemStateChangedEvent] - wasteEventEnd changed from UNDEF to 2018-05-01T00:00:00.000+0200
2018-04-30 11:57:54.143 [vent.ItemStateChangedEvent] - wasteUpcoming1EventBegin changed from 2018-04-30T00:00:00.000+0200 to 2018-05-02T00:00:00.000+0200
2018-04-30 11:57:54.145 [vent.ItemStateChangedEvent] - wasteUpcoming1EventEnd changed from 2018-05-01T00:00:00.000+0200 to 2018-05-03T00:00:00.000+0200
...
2018-05-01 11:57:54.790 [vent.ItemStateChangedEvent] - wasteEventBegin changed from 2018-04-30T00:00:00.000+0200 to UNDEF
2018-05-01 11:57:54.826 [vent.ItemStateChangedEvent] - wasteEventEnd changed from 2018-05-01T00:00:00.000+0200 to UNDEF

openhab.log

2018-04-30 00:00:36.676 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 00:57:45.037 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 01:57:39.157 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 02:57:44.238 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 03:57:39.771 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 04:57:41.962 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 05:57:38.193 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 06:57:44.631 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 07:57:44.401 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 08:57:44.595 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 09:57:41.501 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 10:57:41.839 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 11:57:50.076 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 12:57:42.019 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 13:57:33.026 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 13:57:57.825 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 14:57:51.445 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 15:57:46.333 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 16:57:52.606 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 17:57:50.240 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 18:57:49.738 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 19:57:54.230 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 20:57:52.696 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 21:57:52.101 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 22:57:56.726 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)
2018-04-30 23:57:51.325 [INFO ] [nhab.io.caldav.internal.job.EventJob] - event BEGIN for: 9f582e2bc8fc6815e1056a1ba825362d([email protected]/00:00-01.05.2018/00:00)

// Edit: I appended todays logs to complete the cycle.

cweitkamp avatar Apr 30 '18 14:04 cweitkamp

It looks like the EventJob using an reloadInterval=1440 - once per hour - has no effect on the items. The state of items only change at the time when the calendar is reloaded preloadTime=10080 - once per day.

cweitkamp avatar Feb 28 '19 11:02 cweitkamp

"It looks like the EventJob using an reloadInterval=1440 - once per hour - has no effect on the items. The state of items only change at the time when the calendar is reloaded preloadTime=10080 - once per day."

The underlying mechanism is similar (but not identical) to what I observe as well in https://github.com/openhab/openhab1-addons/issues/5744

Tobster77 avatar Feb 28 '19 14:02 Tobster77