diff --git a/fhem/FHEM/57_Calendar.pm b/fhem/FHEM/57_Calendar.pm index 44d2e58cd..610a85958 100644 --- a/fhem/FHEM/57_Calendar.pm +++ b/fhem/FHEM/57_Calendar.pm @@ -816,6 +816,12 @@ sub Calendar_GetUpdate($) { $hash->{fhem}{lstUpdtTs}= $t; $hash->{fhem}{lastUpdate}= FmtDateTime($t); + $t+= $hash->{fhem}{interval}; + $hash->{fhem}{nxtUpdtTs}= $t; + $hash->{fhem}{nextUpdate}= FmtDateTime($t); + + $hash->{STATE}= "No data"; + Log3 $hash, 4, "Calendar " . $hash->{NAME} . ": Updating..."; my $type = $hash->{fhem}{type}; my $url= $hash->{fhem}{url}; @@ -840,7 +846,7 @@ sub Calendar_GetUpdate($) { } - if(!defined($ics)) { + if(!defined($ics) or ("$ics" eq "")) { Log3 $hash, 1, "Calendar " . $hash->{NAME} . ": Could not retrieve file at URL"; return 0; } @@ -897,10 +903,6 @@ sub Calendar_GetUpdate($) { readingsBulkUpdate($hash, "stateChanged", join(";", @changed)); readingsEndUpdate($hash, 1); # DoTrigger, because sub is called by a timer instead of dispatch - $t+= $hash->{fhem}{interval}; - $hash->{fhem}{nxtUpdtTs}= $t; - $hash->{fhem}{nextUpdate}= FmtDateTime($t); - return 1; }