mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-20 13:26:02 +00:00
PROPLANTA: new attribute forecastDays
git-svn-id: https://svn.fhem.de/fhem/trunk@7122 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
62d19355ff
commit
ecb5ff80d7
@ -367,7 +367,7 @@ sub PROPLANTA_Initialize($)
|
|||||||
$hash->{DefFn} = "PROPLANTA_Define";
|
$hash->{DefFn} = "PROPLANTA_Define";
|
||||||
$hash->{UndefFn} = "PROPLANTA_Undef";
|
$hash->{UndefFn} = "PROPLANTA_Undef";
|
||||||
$hash->{SetFn} = "PROPLANTA_Set";
|
$hash->{SetFn} = "PROPLANTA_Set";
|
||||||
$hash->{AttrList} = "INTERVAL URL disable:0,1 " . $readingFnAttributes;
|
$hash->{AttrList} = "INTERVAL URL disable:0,1 forecastDays:4,7,11,14 " . $readingFnAttributes;
|
||||||
}
|
}
|
||||||
###################################
|
###################################
|
||||||
sub PROPLANTA_Define($$)
|
sub PROPLANTA_Define($$)
|
||||||
@ -522,6 +522,7 @@ sub PROPLANTA_Run($)
|
|||||||
return unless (defined($hash->{NAME}));
|
return unless (defined($hash->{NAME}));
|
||||||
my $readingStartTime = time();
|
my $readingStartTime = time();
|
||||||
|
|
||||||
|
my $fcDays = AttrVal( $name, 'forecastDays', 14 );
|
||||||
my $attrURL = AttrVal( $name, 'URL', "" );
|
my $attrURL = AttrVal( $name, 'URL', "" );
|
||||||
if ($attrURL eq "")
|
if ($attrURL eq "")
|
||||||
{
|
{
|
||||||
@ -560,6 +561,7 @@ sub PROPLANTA_Run($)
|
|||||||
if @MyProplantaParser::texte == 0;
|
if @MyProplantaParser::texte == 0;
|
||||||
foreach (@URL_days)
|
foreach (@URL_days)
|
||||||
{
|
{
|
||||||
|
last unless $_ < $fcDays;
|
||||||
$response = PROPLANTA_HtmlAcquire($hash,$URL . $_);
|
$response = PROPLANTA_HtmlAcquire($hash,$URL . $_);
|
||||||
$MyProplantaParser::startDay = $_;
|
$MyProplantaParser::startDay = $_;
|
||||||
if ($response !~ /^Error\|/)
|
if ($response !~ /^Error\|/)
|
||||||
@ -609,8 +611,15 @@ sub PROPLANTA_Done($)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
my $x = 0;
|
my $x = 0;
|
||||||
|
my $fcDays = AttrVal( $name, 'forecastDays', 14 );
|
||||||
while (my ($rName, $rValue) = each(%values) )
|
while (my ($rName, $rValue) = each(%values) )
|
||||||
{
|
{
|
||||||
|
if ($fcDays < 14 && $rName =~ /^fc(\d+)_/)
|
||||||
|
{
|
||||||
|
my $rFcDay = $rName;
|
||||||
|
$rFcDay =~ s/^fc(\d+)_/$1/;
|
||||||
|
next unless $rFcDay < $fcDays;
|
||||||
|
}
|
||||||
readingsBulkUpdate( $hash, $rName, $rValue );
|
readingsBulkUpdate( $hash, $rName, $rValue );
|
||||||
PROPLANTA_Log $hash, 5, "reading:$rName value:$rValue";
|
PROPLANTA_Log $hash, 5, "reading:$rName value:$rValue";
|
||||||
}
|
}
|
||||||
@ -740,6 +749,10 @@ PROPLANTA_Html($)
|
|||||||
<b>Attributes</b>
|
<b>Attributes</b>
|
||||||
<ul>
|
<ul>
|
||||||
<br>
|
<br>
|
||||||
|
<li><code>forecastDays <4-14></code>
|
||||||
|
<br>
|
||||||
|
Number of days for which the forecast data shall be fetched. Default is 14 days (incl. today).
|
||||||
|
</li><br>
|
||||||
<li><code>INTERVAL <seconds></code>
|
<li><code>INTERVAL <seconds></code>
|
||||||
<br>
|
<br>
|
||||||
Poll interval for weather data in seconds (default 3600 = 1 hour)
|
Poll interval for weather data in seconds (default 3600 = 1 hour)
|
||||||
@ -833,6 +846,10 @@ PROPLANTA_Html($)
|
|||||||
<b>Attribute</b>
|
<b>Attribute</b>
|
||||||
<ul>
|
<ul>
|
||||||
<br>
|
<br>
|
||||||
|
<li><code>forecastDays <4-14></code>
|
||||||
|
<br>
|
||||||
|
Anzahl Tage, für die die Vorhersage ausgelesen werden soll. Standard ist 14 Tage (inkl. heute).
|
||||||
|
</li><br>
|
||||||
<li><code>INTERVAL <Abfrageinterval></code>
|
<li><code>INTERVAL <Abfrageinterval></code>
|
||||||
<br>
|
<br>
|
||||||
Abfrageinterval in Sekunden (Standard 3600 = 1 Stunde)
|
Abfrageinterval in Sekunden (Standard 3600 = 1 Stunde)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user