From 6bf783a4877096df64c17d61c8c7087fe833aef0 Mon Sep 17 00:00:00 2001 From: borisneubert <> Date: Sun, 19 Jan 2014 20:36:51 +0000 Subject: [PATCH] Calendar: - Undefined return values and empty strings from GetFileFromURLQuiet() are error conditions. - Do not retry download of ical file immediately; wait until the next scheduled time instead. - STATE is "No data" on error. git-svn-id: https://svn.fhem.de/fhem/trunk@4695 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/57_Calendar.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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; }