From d1cfa20b025524b7866d161ad348800d4b9d11b8 Mon Sep 17 00:00:00 2001
From: martins <>
Date: Thu, 7 Feb 2019 21:39:00 +0000
Subject: [PATCH] 98_Verkehrsinfo.pm: add attribut disable
git-svn-id: https://svn.fhem.de/fhem/trunk@18521 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/CHANGED | 1 +
fhem/FHEM/98_Verkehrsinfo.pm | 18 +++++++++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/fhem/CHANGED b/fhem/CHANGED
index d245e9ba1..a44aa800e 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -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.
+ - feature: 98_Verkehrsinfo.pm: add attribut timeout
- feature: 12_HProtocolGateway: added 843 protocol for PMS-IB P20
- feature: 12_HProtocolTank: added Product to calculate 15 degrees volume
- new: 70_ZoneMinder: fetching Event-Details via API after event received
diff --git a/fhem/FHEM/98_Verkehrsinfo.pm b/fhem/FHEM/98_Verkehrsinfo.pm
index e647ce709..aaeb0d9e2 100644
--- a/fhem/FHEM/98_Verkehrsinfo.pm
+++ b/fhem/FHEM/98_Verkehrsinfo.pm
@@ -25,6 +25,9 @@
############################################################################
#
# Changelog:
+# 2019-02-07, v2.5
+# Feature: Attribut timeout added
+#
# 2019-01-12, v2.4
# Bugfix: Attribut disable InternalTimer parameter 4 = 0, nonblocking
# Bugfix: Verkehrsinfo_GetUpdate, skip InternalTimer start if the Attribut disable != 0
@@ -126,7 +129,7 @@ sub Verkehrsinfo_Initialize($) {
$hash->{AttrList} =
"filter_exclude filter_include orderby "
. "msg_format:road,head,both "
- . "disable:1,0 "
+ . "disable:1,0 timeout "
. $readingFnAttributes;
}
@@ -162,7 +165,7 @@ sub Verkehrsinfo_Define($$) {
if ($hash->{url} =~ /verkehrsinfo.de/i){
my $param = {
url => "https://www.verkehrsinfo.de/httpsmobil/index.php?c=1&lat=&lon=",
- timeout => 5,
+ timeout => AttrVal($hash->{name},"timeout","5"),
hash => $hash,
callback => \&Verkehrsinfo_HttpNbDefineZone
};
@@ -300,6 +303,11 @@ sub Verkehrsinfo_Attr(@) {
}
}
+ elsif($attr_name eq "timeout" && ($attr_value !~ /\d+/ || $attr_value eq "0")) {
+ my $err = "Verkehrsinfo: Ungültiger timeout in attr $name $attr_name $attr_value: $@";
+ Log3 $name, 3, $err;
+ return $err;
+ }
}
elsif ( $cmd eq "del" ) {
if ( $attr_name eq "disable" ) {
@@ -577,7 +585,7 @@ sub Verkehrsinfo_GetUpdate($) {
my $param = {
url => $hash->{url},
- timeout => 5,
+ timeout => AttrVal($name,"timeout","5"),
hash => $hash,
callback => \&Verkehrsinfo_HttpNbUpdateData
};
@@ -733,6 +741,8 @@ sub Verkehrsinfo_hf_orderby ($@) {
Using this parameter you can format the output, regarding streets, direction or both.