59_Wunderground: fix regex for PWS

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@13508 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2017-02-25 11:55:10 +00:00
parent ab68e7ef0c
commit 60205f23da

View File

@ -279,6 +279,7 @@ sub Wunderground_GetStatus($;$) {
$features .= "/lang:" . $hash->{LANG}; $features .= "/lang:" . $hash->{LANG};
$features .= "/pws:$pws" if ( defined($pws) ); $features .= "/pws:$pws" if ( defined($pws) );
$features .= "/bestfct:$bestfct" if ( defined($bestfct) ); $features .= "/bestfct:$bestfct" if ( defined($bestfct) );
$hash->{FEATURES} = $features;
Wunderground_SendCommand( $hash, $features ); Wunderground_SendCommand( $hash, $features );
@ -340,7 +341,7 @@ sub Wunderground_Define($$$) {
$hash->{QUERY} = @$a[3]; $hash->{QUERY} = @$a[3];
$hash->{QUERY} = "pws:" . $hash->{QUERY} $hash->{QUERY} = "pws:" . $hash->{QUERY}
if ( $hash->{QUERY} =~ /^[A-Z]{3,}\d{2,}$/ ); if ( $hash->{QUERY} =~ /^[A-Z]{3,}\d{1,}$/ );
if ( $init_done && !defined( $hash->{OLDDEF} ) ) { if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
fhem 'attr ' . $name . ' stateReadings temp_c humidity'; fhem 'attr ' . $name . ' stateReadings temp_c humidity';
@ -404,8 +405,11 @@ sub Wunderground_SendCommand($$) {
timeout => AttrVal( $name, "timeout", "3" ), timeout => AttrVal( $name, "timeout", "3" ),
hash => $hash, hash => $hash,
method => "GET", method => "GET",
header => header => {
"agent: FHEM-Wunderground/1.0.0\r\nUser-Agent: FHEM-Wunderground/1.0.0\r\nAccept: application/json", agent => 'FHEM-Wunderground/1.0.0',
'User-Agent' => 'FHEM-Wunderground/1.0.0',
Accept => 'application/json',
},
httpversion => "1.1", httpversion => "1.1",
callback => \&Wunderground_ReceiveCommand, callback => \&Wunderground_ReceiveCommand,
} }
@ -1027,7 +1031,8 @@ sub Wunderground_Undefine($$$) {
Example: Example:
<ul><br> <ul><br>
<code> <code>
define WUweather Wunderground d123ab11bb2c3456 IBAYERNM70<br> define WUweather Wunderground d123ab11bb2c3456 EDDF<br>
define WUweather Wunderground d123ab11bb2c3456 pws:IBAYERNM70<br>
define WUweather Wunderground d123ab11bb2c3456 Germany/Berlin<br> define WUweather Wunderground d123ab11bb2c3456 Germany/Berlin<br>
</code><br> </code><br>
</ul> </ul>