mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
added Attribute timeout to HTTPMOD
git-svn-id: https://svn.fhem.de/fhem/trunk@5494 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d020277a89
commit
7fd2789c27
@ -26,7 +26,9 @@
|
|||||||
# 2014-1-6 extended error handling and added documentation
|
# 2014-1-6 extended error handling and added documentation
|
||||||
# 2014-1-15 added readingsExpr to allow some computation on raw values before put in readings
|
# 2014-1-15 added readingsExpr to allow some computation on raw values before put in readings
|
||||||
# 2014-3-13 added noShutdown and disable attributes
|
# 2014-3-13 added noShutdown and disable attributes
|
||||||
# 2014-4-8 fixed noShutdown check
|
# 2014-4-8 fixed noShutdown check
|
||||||
|
# 2014-4-9 added Attribute timeout as suggested by Frank
|
||||||
|
#
|
||||||
|
|
||||||
package main;
|
package main;
|
||||||
|
|
||||||
@ -77,6 +79,7 @@ sub HTTPMOD_Initialize($)
|
|||||||
"requestData.* " .
|
"requestData.* " .
|
||||||
"disable:0,1 " .
|
"disable:0,1 " .
|
||||||
"noShutdown:0,1 " .
|
"noShutdown:0,1 " .
|
||||||
|
"timeout " .
|
||||||
$readingFnAttributes;
|
$readingFnAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,8 +112,8 @@ sub HTTPMOD_Define($$)
|
|||||||
|
|
||||||
# for non blocking HTTP Get
|
# for non blocking HTTP Get
|
||||||
$hash->{callback} = \&HTTPMOD_Read;
|
$hash->{callback} = \&HTTPMOD_Read;
|
||||||
$hash->{timeout} = 2;
|
$hash->{timeout} = AttrVal($name, "timeout", 2);
|
||||||
#$hash->{loglevel} = 3;
|
#$hash->{timeout} = 2;
|
||||||
|
|
||||||
# initial request after 2 secs, there timer is set to interval for further update
|
# initial request after 2 secs, there timer is set to interval for further update
|
||||||
InternalTimer(gettimeofday()+2, "HTTPMOD_GetUpdate", $hash, 0);
|
InternalTimer(gettimeofday()+2, "HTTPMOD_GetUpdate", $hash, 0);
|
||||||
@ -251,7 +254,7 @@ sub HTTPMOD_GetUpdate($)
|
|||||||
delete $hash->{data};
|
delete $hash->{data};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AttrVal($name, "noShutdown", undef)) {
|
if (AttrVal($name, "noShutdown", undef)) {
|
||||||
$hash->{noshutdown} = 1;
|
$hash->{noshutdown} = 1;
|
||||||
} else {
|
} else {
|
||||||
delete $hash->{noshutdown};
|
delete $hash->{noshutdown};
|
||||||
|
Loading…
Reference in New Issue
Block a user