PROPLANTA: new values

git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@6843 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
tpoitzsch
2014-10-31 19:14:10 +00:00
parent 2917f2fbdb
commit b3a16adf71

View File

@@ -22,7 +22,9 @@ my $curTextPos = 0;
my $curReadingType = 0; my $curReadingType = 0;
my %intensity = ( "keine" => 0 my %intensity = ( "keine" => 0
,"nein" => 0
,"gering" => 1 ,"gering" => 1
,"ja" => 1
,"mäßig" => 2 ,"mäßig" => 2
,"stark" => 3 ,"stark" => 3
); );
@@ -43,6 +45,8 @@ my $curReadingType = 0;
,["TMAX", "high_c", 2] ,["TMAX", "high_c", 2]
,["TMIN", "low_c", 2] ,["TMIN", "low_c", 2]
,["VERDUNST", "evapor", 4] ,["VERDUNST", "evapor", 4]
,["TAUBILDUNG", "dew", 4]
,["BF", "frost", 4]
,["T_0", "0000_c", 2] ,["T_0", "0000_c", 2]
,["T_3", "0300_c", 2] ,["T_3", "0300_c", 2]
,["T_6", "0600_c", 2] ,["T_6", "0600_c", 2]
@@ -165,6 +169,7 @@ sub start
sub end sub end
{ {
$curTag = ""; $curTag = "";
if ( $tagname eq "tr" ) if ( $tagname eq "tr" )
{ {
$curReadingType = 0 $curReadingType = 0
@@ -245,7 +250,7 @@ sub PROPLANTA_Set($@)
my ( $hash, @a ) = @_; my ( $hash, @a ) = @_;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $reUINT = '^([\\+]?\\d+)$'; my $reUINT = '^([\\+]?\\d+)$';
my $usage = "Unknown argument $a[1], choose one of captureWeatherData:noArg "; my $usage = "Unknown argument $a[1], choose one of update:noArg ";
return $usage if ( @a < 2 ); return $usage if ( @a < 2 );
@@ -256,7 +261,7 @@ sub PROPLANTA_Set($@)
{ {
return $usage; return $usage;
} }
when ("captureweatherdata") when ("update")
{ {
PROPLANTA_Log $hash, 3, "set command: " . $a[1]; PROPLANTA_Log $hash, 3, "set command: " . $a[1];
PROPLANTA_Start($hash); PROPLANTA_Start($hash);
@@ -365,32 +370,22 @@ sub PROPLANTA_Done($)
return unless ( defined($string) ); return unless ( defined($string) );
# all term are separated by "|" , the first is the name of the instance # all term are separated by "|" , the first is the name of the instance
my ( $name, @values ) = split( "\\|", $string ); my ( $name, %values ) = split( "\\|", $string );
my $hash = $defs{$name}; my $hash = $defs{$name};
return unless (defined($hash->{NAME})); return unless ( defined($hash->{NAME}) );
# delete the marker for running process # delete the marker for running process
delete( $hash->{helper}{RUNNING} ); delete( $hash->{helper}{RUNNING} );
my $rdName = "";
# Wetterdaten speichern # Wetterdaten speichern
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
readingsBulkUpdate($hash,"state","Connected"); readingsBulkUpdate($hash,"state","T: ".$values{temperature}." H: ".$values{humidity}." W: ".$values{wind} );
my $x = 0; my $x = 0;
foreach my $text (@values) while (my ($rName, $rValue) = each(%values) )
{ {
$x++; readingsBulkUpdate( $hash, $rName, $rValue );
if ( $x % 2 == 1 ) PROPLANTA_Log $hash, 5, "tag:$rName value:$rValue";
{
$rdName = $text;
}
else
{
readingsBulkUpdate( $hash, $rdName, $text );
PROPLANTA_Log $hash, 5, "tag:$rdName value:$text";
}
} }
readingsEndUpdate( $hash, 1 ); readingsEndUpdate( $hash, 1 );
@@ -458,10 +453,10 @@ sub PROPLANTA_Timer($)
<ul> <ul>
<br/> <br/>
<code>set &lt;name&gt; captureWeatherData</code> <code>set &lt;name&gt; update</code>
<br/> <br/>
<ul> <ul>
The weather data are immediately polled. The weather data are immediately polled from the website.
</ul><br/> </ul><br/>
</ul> </ul>