mknx/smarthome — pull request #58 by ohinckel (2013-12-01 00:57:36+00:00)
Title: iCal plugin: Calendar registry and item configuration

When using the `ical` plugin you can only access a calendar using `sh.ical('uri')`. This function will retrieve the calendar URL and return the events for the current and the next day.

When using this more often (e.g. in several logics) multiple request will be issued to retrieve the calendar (possibly at the same time, which is not necessary).

This patch add the following features:
* configure calendars in the plugin configuration to automatically keep them up to date
* configure calendars by using aliases to access them instead of URIs
* connect calendars to items to set them true or false in case an event is taken place

The calendar can be configured in the plugin configuration using the `calendar` setting. This can be used to configure the URI of the calendars. Additionally an alias can be specified for the calendar. Example:

```
[ical]
...
calendars = http://example.com/private.ics | public:http://example.com/public.ics | holidays:http://example.com/holidays.ics
cycle = 3600
```

This will register two calendars, which will be automatically kept up to date (using the specified cycle interval - default to 3600).

You still can access these calendars using the URIs (e.g. `sh.ical('http://example.com/public.ics')`) - but instead of requesting the ICS file, the cached calendar data is used. Using the configured alias is also possible (e.g. `sh.ical('public')`).

If you request other calendars, which are not configured in the plugin configuration, they will be read each time you access them.

Additionally you can configure a connection between an item and a calendar using the `ical_calendar` settings in you items configuration:

```
[[holidays]]
type = bool
#ical_calendar = http://example.com/holidays.ics
ical_calendar = holidays
```

This will automatically register the specified calendar and will automatically keep them up to date. If you don't want to use the URIs in the items configuration, you can also use the calendar alias instead, which makes more sense.