diff --git a/fhem/CHANGED b/fhem/CHANGED
index 81764b4f7..623088536 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
+ - feature: 57_Calendar: reduce memory footprint (forum #74481)
- bugfix: 74_AMADDevice: fix openurl bug
- bugfix: 49_SSCam: "uninitialized value in pattern ..." on fhem start
- feature: 49_SSCam: V2.4.0, new commands "snapinfo" and
diff --git a/fhem/FHEM/57_Calendar.pm b/fhem/FHEM/57_Calendar.pm
index 4daf3844d..6b50aa42b 100644
--- a/fhem/FHEM/57_Calendar.pm
+++ b/fhem/FHEM/57_Calendar.pm
@@ -1567,7 +1567,7 @@ sub Calendar_Initialize($) {
$hash->{SetFn} = "Calendar_Set";
$hash->{AttrFn} = "Calendar_Attr";
$hash->{NotifyFn}= "Calendar_Notify";
- $hash->{AttrList}= "update:sync,async,none hideOlderThan hideLaterThan onCreateEvent SSLVerify:0,1 $readingFnAttributes";
+ $hash->{AttrList}= "update:sync,async,none removevcalendar:0,1 hideOlderThan hideLaterThan onCreateEvent SSLVerify:0,1 $readingFnAttributes";
}
@@ -2224,8 +2224,9 @@ sub Calendar_Cleanup($) {
delete($hash->{".fhem"}{removeall});
delete($hash->{".fhem"}{serialized});
delete($hash->{".fhem"}{subprocess});
-
+
my $name= $hash->{NAME};
+ delete($hash->{".fhem"}{iCalendar}) if(AttrVal($name,"removevcalendar",0));
Log3 $hash, 4, "Calendar $name: process ended.";
}
@@ -2436,7 +2437,11 @@ sub Calendar_UpdateCalendar($$) {
}
foreach my $v (grep { $_->{type} eq "VEVENT" } @{$root->{entries}}) {
- #main::Debug "Merging " . $v->asString();
+
+ # totally skip outdated calendar entries
+ next if ($v->tm($v->value("DTEND")) < time() && $v->valueOrDefault("RRULE", "") eq "");
+
+ #main::Debug "Merging " . $v->asString();
my $found= 0;
my $added= 0; # flag to prevent multiple additions
$n++;
@@ -2880,7 +2885,12 @@ sub CalendarAsHtml($;$) {
background and FHEM will not block during updates. If this attribute is set to
none
, the calendar will not be updated at all.
- + +
removevcalendar 0|1
get <name> vcalendar
is then no longer possible.
+ +
hideOlderThan <timespec>
hideLaterThan <timespec>
@@ -3274,7 +3284,13 @@ sub CalendarAsHtml($;$) {
nicht blockieren. Wenn dieses Attribut auf none
gesetzt ist, wird der
Kalender überhaupt nicht aktualisiert.
- + +
removevcalendar 0|1
get <name> vcalendar
ist dann nicht mehr möglich.
+ +
hideOlderThan <timespec>
hideLaterThan <timespec>
@@ -3308,7 +3324,7 @@ sub CalendarAsHtml($;$) {
SSLVerify