From 393478fe23573ceb9a354eecc60286de1b83fe1d Mon Sep 17 00:00:00 2001 From: LeonGaultier Date: Sat, 20 Jul 2019 13:59:38 +0000 Subject: [PATCH] 77_UWZ: remove last InternalTimer Fn parameter git-svn-id: https://svn.fhem.de/fhem/trunk@19869 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/77_UWZ.pm | 41 ++++++++++++++++++++--------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 77b73d805..16e5b2d64 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. + - change: 77_UWZ: remove last InternalTimer Fn parameter - feature: 14_SD_WS.pm: crc calculation fixes and new protocol for Atech wireless weather station added new sensor TECVANCE TV-4848 diff --git a/fhem/FHEM/77_UWZ.pm b/fhem/FHEM/77_UWZ.pm index 877eec0d8..9b422cfb9 100644 --- a/fhem/FHEM/77_UWZ.pm +++ b/fhem/FHEM/77_UWZ.pm @@ -166,6 +166,7 @@ BEGIN { BlockingKill init_done FW_httpheader + HttpUtils_BlockingGet deviceEvents) ); } @@ -844,27 +845,25 @@ sub JSONAcquire($$) { Log $hash, 4, "Start capturing of $URL"; - my $err_log = ""; - my $agent = LWP::UserAgent->new( - env_proxy => 1, - keep_alive => 1, - protocols_allowed => ['http'], - timeout => 10 - ); - my $request = HTTP::Request->new( GET => $URL ); - my $response = $agent->request($request); - $err_log = "Can't get $URL -- " . $response->status_line - unless ( $response->is_success ); + my $param = { + url => "$URL", + timeout => 5, + hash => $hash, + method => "GET", + header => "", + }; - if ( $err_log ne "" ) { - readingsSingleUpdate( $hash, "lastConnection", $response->status_line, - 1 ); + my ( $err, $data ) = HttpUtils_BlockingGet($param); + + if ( $err ne "" ) { + my $err_log = "Can't get $URL -- " . $err; + readingsSingleUpdate( $hash, "lastConnection", $err, 1 ); Log $hash, 1, "Error: $err_log"; - return "Error|Error " . $response->status_line; + return "Error|Error " . $err; } - Log $hash, 4, length( $response->content ) . " characters captured"; - return $response->content; + Log $hash, 4, length($data) . " characters captured: $data"; + return $data; } ##################################### @@ -880,7 +879,7 @@ sub Start($) { RemoveInternalTimer($hash); InternalTimer( gettimeofday() + $hash->{INTERVAL}, - "UWZ_Start", $hash, 1 ); + "UWZ_Start", $hash ); return undef if ( IsDisabled($name) ); readingsSingleUpdate( $hash, 'currentIntervalMode', 'normal', 0 ); } @@ -2542,7 +2541,7 @@ sub IntervalAtWarnLevel($) { RemoveInternalTimer($hash); InternalTimer( gettimeofday() + $hash->{INTERVALWARN}, - "UWZ_Start", $hash, 1 ); + "UWZ_Start", $hash ); Log $hash, 4, "restart internal timer with interval $hash->{INTERVALWARN}"; @@ -2552,7 +2551,7 @@ sub IntervalAtWarnLevel($) { RemoveInternalTimer($hash); InternalTimer( gettimeofday() + $hash->{INTERVALWARN}, - "UWZ_Start", $hash, 1 ); + "UWZ_Start", $hash ); Log $hash, 4, "restart internal timer with interval $hash->{INTERVALWARN}"; @@ -3624,7 +3623,7 @@ sub UWZSearchAreaID($$) { ], "release_status": "stable", "license": "GPL_2", - "version": "v2.2.0", + "version": "v2.2.2", "author": [ "Marko Oldenburg " ],