2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +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:
ststrobel 2014-04-09 06:06:51 +00:00
parent d020277a89
commit 7fd2789c27

View File

@ -26,7 +26,9 @@
# 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-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;
@ -77,6 +79,7 @@ sub HTTPMOD_Initialize($)
"requestData.* " .
"disable:0,1 " .
"noShutdown:0,1 " .
"timeout " .
$readingFnAttributes;
}
@ -109,8 +112,8 @@ sub HTTPMOD_Define($$)
# for non blocking HTTP Get
$hash->{callback} = \&HTTPMOD_Read;
$hash->{timeout} = 2;
#$hash->{loglevel} = 3;
$hash->{timeout} = AttrVal($name, "timeout", 2);
#$hash->{timeout} = 2;
# initial request after 2 secs, there timer is set to interval for further update
InternalTimer(gettimeofday()+2, "HTTPMOD_GetUpdate", $hash, 0);
@ -251,7 +254,7 @@ sub HTTPMOD_GetUpdate($)
delete $hash->{data};
}
if (AttrVal($name, "noShutdown", undef)) {
if (AttrVal($name, "noShutdown", undef)) {
$hash->{noshutdown} = 1;
} else {
delete $hash->{noshutdown};