From 8e6b7b834e2a3cf53d89a5b324e376e7e02a8bbd Mon Sep 17 00:00:00 2001 From: StefanStrobel <> Date: Sat, 10 Aug 2019 12:51:48 +0000 Subject: [PATCH] 98_HTTPMOD.pm: enhanced documentation git-svn-id: https://svn.fhem.de/fhem/trunk@19978 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_HTTPMOD.pm | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/fhem/FHEM/98_HTTPMOD.pm b/fhem/FHEM/98_HTTPMOD.pm index edaf81ab3..6ed203a2d 100755 --- a/fhem/FHEM/98_HTTPMOD.pm +++ b/fhem/FHEM/98_HTTPMOD.pm @@ -161,6 +161,7 @@ # 2019-01-12 special handling when extractAllJSON is set to 2 # 2019-01-13 check for featurelevl > 5.9 # 2019-02-13 remove Warning when checking for extractAllJSON == 2, new attribute extractAllJSONPrefix as regex filter +# 2019-03-06 enhanced documentation # # @@ -2790,8 +2791,7 @@ sub HTTPMOD_Read($$$) ####################################### # Aufruf aus InternalTimer mit "queue:$name" # oder direkt mit $direct:$name -sub -HTTPMOD_HandleSendQueue($) +sub HTTPMOD_HandleSendQueue($) { my (undef,$name) = split(':', $_[0]); my $hash = $defs{$name}; @@ -2955,8 +2955,7 @@ HTTPMOD_HandleSendQueue($) ##################################### -sub -HTTPMOD_AddToQueue($$$$$;$$$$){ +sub HTTPMOD_AddToQueue($$$$$;$$$$){ my ($hash, $url, $header, $data, $type, $value, $count, $ignoreredirects, $prio) = @_; my $name = $hash->{NAME}; @@ -3055,7 +3054,7 @@ HTTPMOD_AddToQueue($$$$$;$$$$){ to define how values are parsed from the HTTP response and in which readings they are stored.
(The old syntax attr readingsNameX and attr readingsRegexX is still supported but it can go away in a future version of HTTPMOD so the new one with attr readingXName - and attr readingXRegex should be preferred. + and attr readingXRegex should be preferred)

Example for a PoolManager 5:


- The regular expressions used will take the value that matches a capture group. This is the part of the regular expression inside (). - In the above example "([\d\.]+)" refers to numerical digits or points between double quotation marks. Only the string consiting of digits and points - will match inside (). This piece is assigned to the reading. + This example uses regular expressions to parse the HTTP response. A regular expression describes what text is around the value that is supposed to be assigned to a reading. The value itself has to match the so called capture group of the regular expression. That is the part of the regular expression inside (). + In the above example "([\d\.]+)" refers to numerical digits or points between double quotation marks. Only the string consisting of digits and points will match inside (). This piece is assigned to the reading. You can also use regular expressions that have several capture groups which might be helpful when parsing tables. In this case an attribute like