mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-15 22:26:04 +00:00
60_allergy.pm: fixed error handling for server replies
git-svn-id: https://svn.fhem.de/fhem/trunk@13588 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
57645504a2
commit
6dcf0cf635
@ -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.
|
||||
- bugfix: 60_allergy.pm: fixed error handling for server replies
|
||||
- update: 38_netatmo.pm: 3 stations minimum for PUBLIC statistics
|
||||
- update: 74_AMAD: new Version 2.6.11, add startDaydream and more media
|
||||
commands
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
# 60_allergy.pm
|
||||
#
|
||||
# 2016 Markus Moises < vorname at nachname . de >
|
||||
# 2017 Markus Moises < vorname at nachname . de >
|
||||
#
|
||||
# This module provides allergy forecast data
|
||||
#
|
||||
@ -36,18 +36,16 @@ sub allergy_Initialize($) {
|
||||
my ($hash) = @_;
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
$hash->{DefFn} = "allergy_Define";
|
||||
$hash->{UndefFn} = "allergy_Undefine";
|
||||
$hash->{GetFn} = "allergy_Get";
|
||||
$hash->{AttrList} = "disable:0,1 ".
|
||||
"ignoreList ".
|
||||
"updateIgnored:1 ".
|
||||
"updateEmpty:1 ".
|
||||
"levelsFormat ".
|
||||
"weekdaysFormat ".
|
||||
$readingFnAttributes;
|
||||
|
||||
|
||||
$hash->{DefFn} = "allergy_Define";
|
||||
$hash->{UndefFn} = "allergy_Undefine";
|
||||
$hash->{GetFn} = "allergy_Get";
|
||||
$hash->{AttrList} = "disable:0,1 ".
|
||||
"ignoreList ".
|
||||
"updateIgnored:1 ".
|
||||
"updateEmpty:1 ".
|
||||
"levelsFormat ".
|
||||
"weekdaysFormat ".
|
||||
$readingFnAttributes;
|
||||
}
|
||||
|
||||
sub allergy_Define($$$) {
|
||||
@ -60,6 +58,7 @@ sub allergy_Define($$$) {
|
||||
|
||||
$hash->{helper}{ZIPCODE} = $a[2];
|
||||
$hash->{helper}{INTERVAL} = 10800;
|
||||
$hash->{ERROR} = 0;
|
||||
|
||||
my $req = eval
|
||||
{
|
||||
@ -163,10 +162,14 @@ sub allergy_Parse($$$)
|
||||
if( $err )
|
||||
{
|
||||
Log3 $name, 1, "$name: URL error: ".$err;
|
||||
$hash->{STATE} = "error";
|
||||
my $nextupdate = gettimeofday()+( (900*$hash->{ERROR}) + 90 );
|
||||
InternalTimer($nextupdate, "allergy_GetUpdate", $hash, 1);
|
||||
$hash->{STATE} = "error" if($hash->{ERROR} > 1);
|
||||
$hash->{ERROR} = $hash->{ERROR}+1;
|
||||
return undef;
|
||||
}
|
||||
|
||||
$hash->{ERROR} = 0;
|
||||
Log3 $name, 5, "Received XML data ".$data;
|
||||
|
||||
my $xml = new XML::Simple();
|
||||
@ -442,4 +445,4 @@ sub allergy_utf8clean($) {
|
||||
</ul>
|
||||
|
||||
=end html_DE
|
||||
=cut
|
||||
=cut
|
Loading…
x
Reference in New Issue
Block a user