mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
57_Calendar: cutoffOlderThan also removes recurring events when the series has ended.
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@17421 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1351769c53
commit
28b12765f2
@ -96,9 +96,12 @@ my %functions_set = ( "on" => 0,
|
||||
"dimto" => 1,
|
||||
"on-till" => 1,
|
||||
"on-for-timer" => 1,
|
||||
"all_units_off" => 0,
|
||||
"all_units_on" => 0,
|
||||
"all_lights_off" => 0,
|
||||
"all_lights_on" => 0,
|
||||
);
|
||||
|
||||
|
||||
my %models = (
|
||||
lm12 => 'dimmer',
|
||||
lm15 => 'switch',
|
||||
|
@ -2814,12 +2814,24 @@ sub Calendar_UpdateCalendar($$) {
|
||||
foreach my $v (grep { $_->{type} eq "VEVENT" } @{$root->{entries}}) {
|
||||
|
||||
# totally skip outdated calendar entries
|
||||
if($cutoffOlderThan) {
|
||||
if(!$v->isRecurring()) {
|
||||
# non recurring event
|
||||
next if(
|
||||
defined($cutoffOlderThan) &&
|
||||
$v->hasKey("DTEND") &&
|
||||
$v->tm($v->value("DTEND")) < $cutoff &&
|
||||
!$v->hasKey("RRULE")
|
||||
$v->tm($v->value("DTEND")) < $cutoff
|
||||
);
|
||||
} else {
|
||||
# recurring event, inspect
|
||||
my $rrule= $v->value("RRULE");
|
||||
my @rrparts= split(";", $rrule);
|
||||
my %r= map { split("=", $_); } @rrparts;
|
||||
if(exists($r{"UNTIL"})) {
|
||||
next if($v->tm($r{"UNTIL"}) < $cutoff)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#main::Debug "Merging " . $v->asString();
|
||||
my $found= 0;
|
||||
@ -3493,10 +3505,10 @@ sub CalendarEventsAsHtml($;$) {
|
||||
<p>
|
||||
|
||||
<li><code>cutoffOlderThan <timespec></code><br>
|
||||
This attribute cuts off all non-recurring calendar events that ended a timespan cutoffOlderThan
|
||||
This attribute cuts off all calendar events that ended a timespan cutoffOlderThan
|
||||
before the last update of the calendar. The purpose of setting this attribute is to save memory.
|
||||
Such calendar events cannot be accessed at all from FHEM. Calendar events are not cut off if
|
||||
they are recurring or if they have no end time (DTEND).
|
||||
they are recurring with no end of series (UNTIL) or if they have no end time (DTEND).
|
||||
</li><p>
|
||||
|
||||
<li><code>onCreateEvent <perl-code></code><br>
|
||||
@ -3952,9 +3964,10 @@ sub CalendarEventsAsHtml($;$) {
|
||||
<p>
|
||||
|
||||
<li><code>cutoffOlderThan <timespec></code><br>
|
||||
Dieses Attribut schneidet alle nicht wiederkehrenden Termine weg, die eine Zeitspanne cutoffOlderThan
|
||||
Dieses Attribut schneidet alle Termine weg, die eine Zeitspanne cutoffOlderThan
|
||||
vor der letzten Aktualisierung des Kalenders endeten. Der Zweck dieses Attributs ist es Speicher zu
|
||||
sparen. Auf solche Termine kann gar nicht mehr aus FHEM heraus zugegriffen werden. Serientermine und
|
||||
sparen. Auf solche Termine kann gar nicht mehr aus FHEM heraus zugegriffen
|
||||
werden. Serientermine ohne Ende (UNTIL) und
|
||||
Termine ohne Endezeitpunkt (DTEND) werden nicht weggeschnitten.
|
||||
</li><p>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user