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: svn://svn.code.sf.net/p/fhem/code/trunk@4695 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert
2014-01-19 20:36:51 +00:00
parent c5d633dd00
commit 2734cb516d

View File

@@ -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;
}