2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-17 11:26:03 +00:00

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
This commit is contained in:
borisneubert 2014-01-19 20:36:51 +00:00
parent 8d16e24e57
commit 6bf783a487

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