mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
PROPLANTA: Adapted to changed date text on website
git-svn-id: https://svn.fhem.de/fhem/trunk@10167 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
2fc0b02531
commit
c0fc79ab80
@ -55,7 +55,7 @@ my $curReadingType = 0;
|
|||||||
# 6 = Time Col 3
|
# 6 = Time Col 3
|
||||||
# 7 = alternative text of image Col 2-5 (weather state)
|
# 7 = alternative text of image Col 2-5 (weather state)
|
||||||
# 8 = MinMaxNummer Col 3
|
# 8 = MinMaxNummer Col 3
|
||||||
# 9 = Date Col 2-5
|
# 9 = Date Col 2-5 / bold
|
||||||
# 10 = alternative text of Col 3 (Wind direction)
|
# 10 = alternative text of Col 3 (Wind direction)
|
||||||
my @knownNoneIDs = ( ["Temperatur", "temperature", 1]
|
my @knownNoneIDs = ( ["Temperatur", "temperature", 1]
|
||||||
,["relative Feuchte", "humidity", 1]
|
,["relative Feuchte", "humidity", 1]
|
||||||
@ -150,8 +150,8 @@ my $curReadingType = 0;
|
|||||||
,"Nord-Nordwest" => 248
|
,"Nord-Nordwest" => 248
|
||||||
);
|
);
|
||||||
|
|
||||||
sub
|
##############################################
|
||||||
get_wday($)
|
sub get_wday($)
|
||||||
{
|
{
|
||||||
my ($date) = @_;
|
my ($date) = @_;
|
||||||
my @wday_txt = qw(So Mo Di Mi Do Fr Sa);
|
my @wday_txt = qw(So Mo Di Mi Do Fr Sa);
|
||||||
@ -160,6 +160,7 @@ get_wday($)
|
|||||||
return $wday_txt [$th[6]];
|
return $wday_txt [$th[6]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##############################################
|
||||||
# here HTML::text/start/end are overridden
|
# here HTML::text/start/end are overridden
|
||||||
sub text
|
sub text
|
||||||
{
|
{
|
||||||
@ -168,8 +169,7 @@ sub text
|
|||||||
my $readingName;
|
my $readingName;
|
||||||
# Wait 1ms to reduce CPU load and hence blocking of FHEM by it (workaround until a better solution is available)
|
# Wait 1ms to reduce CPU load and hence blocking of FHEM by it (workaround until a better solution is available)
|
||||||
usleep (1000);
|
usleep (1000);
|
||||||
if ( $curTag =~ $lookupTag )
|
if ( $curTag =~ $lookupTag ) {
|
||||||
{
|
|
||||||
$curTextPos++;
|
$curTextPos++;
|
||||||
|
|
||||||
$text =~ s/^\s+//; # trim string
|
$text =~ s/^\s+//; # trim string
|
||||||
@ -186,8 +186,7 @@ sub text
|
|||||||
$text =~ s/9/9/g; # replace 9
|
$text =~ s/9/9/g; # replace 9
|
||||||
|
|
||||||
# Tag-Type 0 = Check for readings without tag-ID (current readings)
|
# Tag-Type 0 = Check for readings without tag-ID (current readings)
|
||||||
if ($curReadingType == 0)
|
if ($curReadingType == 0) {
|
||||||
{
|
|
||||||
if ($startDay == 0 && $curCol == 1 && $curTextPos == 1)
|
if ($startDay == 0 && $curCol == 1 && $curTextPos == 1)
|
||||||
{
|
{
|
||||||
foreach my $r (@knownNoneIDs)
|
foreach my $r (@knownNoneIDs)
|
||||||
@ -202,8 +201,7 @@ sub text
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Tag-Type 1 = Number Col 3
|
# Tag-Type 1 = Number Col 3
|
||||||
elsif ($curReadingType == 1)
|
elsif ($curReadingType == 1) {
|
||||||
{
|
|
||||||
if ( $curCol == 3 )
|
if ( $curCol == 3 )
|
||||||
{
|
{
|
||||||
$readingName = $curReadingName;
|
$readingName = $curReadingName;
|
||||||
@ -217,8 +215,7 @@ sub text
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Tag-Type 2 = Number Col 2-5
|
# Tag-Type 2 = Number Col 2-5
|
||||||
elsif ($curReadingType == 2)
|
elsif ($curReadingType == 2) {
|
||||||
{
|
|
||||||
if ( 1 < $curCol && $curCol <= 5 )
|
if ( 1 < $curCol && $curCol <= 5 )
|
||||||
{
|
{
|
||||||
$readingName = "fc".($startDay+$curCol-2)."_".$curReadingName;
|
$readingName = "fc".($startDay+$curCol-2)."_".$curReadingName;
|
||||||
@ -231,8 +228,7 @@ sub text
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Tag-Type 3 = Number Col 2|4|6|8
|
# Tag-Type 3 = Number Col 2|4|6|8
|
||||||
elsif ($curReadingType == 3)
|
elsif ($curReadingType == 3) {
|
||||||
{
|
|
||||||
if ( 2 <= $curCol && $curCol <= 5 )
|
if ( 2 <= $curCol && $curCol <= 5 )
|
||||||
{
|
{
|
||||||
if ( $curTextPos % 2 == 1 )
|
if ( $curTextPos % 2 == 1 )
|
||||||
@ -244,8 +240,7 @@ sub text
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Tag-Type 4 = Intensity-Text Col 2-5
|
# Tag-Type 4 = Intensity-Text Col 2-5
|
||||||
elsif ($curReadingType == 4)
|
elsif ($curReadingType == 4) {
|
||||||
{
|
|
||||||
if ( 2 <= $curCol && $curCol <= 5 )
|
if ( 2 <= $curCol && $curCol <= 5 )
|
||||||
{
|
{
|
||||||
$readingName = "fc".($startDay+$curCol-2)."_".$curReadingName;
|
$readingName = "fc".($startDay+$curCol-2)."_".$curReadingName;
|
||||||
@ -254,8 +249,7 @@ sub text
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Tag-Type 5 = Time Col 2-5
|
# Tag-Type 5 = Time Col 2-5
|
||||||
elsif ($curReadingType == 5)
|
elsif ($curReadingType == 5) {
|
||||||
{
|
|
||||||
if ( 2 <= $curCol && $curCol <= 5 )
|
if ( 2 <= $curCol && $curCol <= 5 )
|
||||||
{
|
{
|
||||||
$readingName = "fc".($startDay+$curCol-2)."_".$curReadingName;
|
$readingName = "fc".($startDay+$curCol-2)."_".$curReadingName;
|
||||||
@ -268,8 +262,7 @@ sub text
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Tag-Type 6 = Time Col 3
|
# Tag-Type 6 = Time Col 3
|
||||||
elsif ($curReadingType == 6)
|
elsif ($curReadingType == 6) {
|
||||||
{
|
|
||||||
if ( $curCol == 3 )
|
if ( $curCol == 3 )
|
||||||
{
|
{
|
||||||
$readingName = $curReadingName;
|
$readingName = $curReadingName;
|
||||||
@ -282,8 +275,7 @@ sub text
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Tag-Type 8 = MinMaxNumber Col 3
|
# Tag-Type 8 = MinMaxNumber Col 3
|
||||||
elsif ($curReadingType == 8)
|
elsif ($curReadingType == 8) {
|
||||||
{
|
|
||||||
if ( $curCol == 3 )
|
if ( $curCol == 3 )
|
||||||
{
|
{
|
||||||
$readingName = $curReadingName;
|
$readingName = $curReadingName;
|
||||||
@ -300,10 +292,8 @@ sub text
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Tag-Type 9 = Date Col 2-5
|
# Tag-Type 9 = Date Col 2-5
|
||||||
elsif ($curReadingType == 9)
|
elsif ($curReadingType == 9 && $curTag eq "b") {
|
||||||
{
|
if ( 1 < $curCol && $curCol <= 5 ) {
|
||||||
if ( 1 < $curCol && $curCol <= 5 )
|
|
||||||
{
|
|
||||||
$readingName = "fc".($startDay+$curCol-2)."_".$curReadingName;
|
$readingName = "fc".($startDay+$curCol-2)."_".$curReadingName;
|
||||||
push( @texte, $readingName."|".$text );
|
push( @texte, $readingName."|".$text );
|
||||||
}
|
}
|
||||||
@ -311,21 +301,18 @@ sub text
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##############################################
|
||||||
sub start
|
sub start
|
||||||
{
|
{
|
||||||
my ( $self, $tagname, $attr, $attrseq, $origtext ) = @_;
|
my ( $self, $tagname, $attr, $attrseq, $origtext ) = @_;
|
||||||
$curTag = $tagname;
|
$curTag = $tagname;
|
||||||
if ( $tagname eq "tr" )
|
if ( $tagname eq "tr" ) {
|
||||||
{
|
|
||||||
$curReadingType = 0;
|
$curReadingType = 0;
|
||||||
$curCol = 0;
|
$curCol = 0;
|
||||||
$curTextPos = 0;
|
$curTextPos = 0;
|
||||||
if ( defined( $attr->{id} ) )
|
if ( defined( $attr->{id} ) ) {
|
||||||
{
|
foreach my $r (@knownIDs) {
|
||||||
foreach my $r (@knownIDs)
|
if ( $$r[0] eq $attr->{id} ) {
|
||||||
{
|
|
||||||
if ( $$r[0] eq $attr->{id} )
|
|
||||||
{
|
|
||||||
$curReadingName = $$r[1];
|
$curReadingName = $$r[1];
|
||||||
$curReadingType = $$r[2];
|
$curReadingType = $$r[2];
|
||||||
last;
|
last;
|
||||||
@ -333,16 +320,13 @@ sub start
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif ($tagname eq "td")
|
elsif ($tagname eq "td") {
|
||||||
{
|
|
||||||
$curCol++;
|
$curCol++;
|
||||||
$curTextPos = 0;
|
$curTextPos = 0;
|
||||||
}
|
}
|
||||||
#wetterstate and icon
|
#wetterstate and icon - process immediately
|
||||||
elsif ($tagname eq "img" && $curReadingType == 7)
|
elsif ($tagname eq "img" && $curReadingType == 7) {
|
||||||
{
|
if ( 2 <= $curCol && $curCol <= 5 ) {
|
||||||
if ( 2 <= $curCol && $curCol <= 5 )
|
|
||||||
{
|
|
||||||
# process alternative text
|
# process alternative text
|
||||||
$readingName = "fc".($startDay+$curCol-2)."_".$curReadingName;
|
$readingName = "fc".($startDay+$curCol-2)."_".$curReadingName;
|
||||||
$text = $attr->{alt};
|
$text = $attr->{alt};
|
||||||
@ -356,9 +340,8 @@ sub start
|
|||||||
push( @texte, $readingName."Icon" . "|" . $attr->{src} );
|
push( @texte, $readingName."Icon" . "|" . $attr->{src} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#wind direction
|
#wind direction - process immediately
|
||||||
elsif ($tagname eq "img" && $curReadingType == 10 && $curCol == 3 )
|
elsif ($tagname eq "img" && $curReadingType == 10 && $curCol == 3 ) {
|
||||||
{
|
|
||||||
# process alternative text
|
# process alternative text
|
||||||
$readingName = $curReadingName;
|
$readingName = $curReadingName;
|
||||||
$text = $attr->{alt};
|
$text = $attr->{alt};
|
||||||
@ -374,13 +357,13 @@ sub start
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##############################################
|
||||||
sub end
|
sub end
|
||||||
{
|
{
|
||||||
my ( $self, $tagname, $attr, $attrseq, $origtext ) = @_;
|
my ( $self, $tagname, $attr, $attrseq, $origtext ) = @_;
|
||||||
$curTag = "";
|
$curTag = "";
|
||||||
|
|
||||||
if ( $tagname eq "tr" )
|
if ( $tagname eq "tr" ) {
|
||||||
{
|
|
||||||
$curReadingType = 0
|
$curReadingType = 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user