mschlenstedt / LoxBerry-Plugin-Weather4Lox

A LoxBerry Plugin: http://plugins.loxberry.de/plugin/weather4lox/
Apache License 2.0
10 stars 9 forks source link

Visual Crossing: Data not truncated for Miniserver #92

Closed mr-manuel closed 1 year ago

mr-manuel commented 1 year ago

When using the Visual Crossing service for the hourly forecast the past forecast data is not removed from the emulation (http://loxberry:6066/forecast/) for the miniserver.

07.02.2023; Tue;    13; 6.60;   6.6;    2;  262;    6;  0;  0;  0;  0;  0;  0.0;    1029;   33; 0;  1;  455.00;
07.02.2023; Tue;    00; -6.70;  -13.00; 16; 103;    16; 50; 50; 50; 0;  0;  0.0;    1030;   71; 0;  8;  0.00;
07.02.2023; Tue;    01; -8.10;  -12.70; 9;  80; 9;  80; 80; 80; 0;  0;  0.0;    1028;   80; 0;  8;  0.00;
07.02.2023; Tue;    02; -9.00;  -14.70; 12; 20; 12; 100;    100;    100;    0;  0;  0.0;    1028;   83; 0;  22; 0.00;
07.02.2023; Tue;    03; -8.70;  -14.80; 13; 77; 13; 43; 43; 43; 0;  0;  0.0;    1031;   79; 0;  8;  0.00;
07.02.2023; Tue;    04; -9.50;  -13.00; 6;  350;    6;  25; 25; 25; 0;  0;  0.0;    1031;   79; 0;  8;  0.00;
07.02.2023; Tue;    05; -10.10; -13.50; 5;  360;    5;  25; 25; 25; 0;  0;  0.0;    1032;   84; 0;  8;  0.00;
07.02.2023; Tue;    06; -10.90; -10.90; 4;  360;    4;  50; 50; 50; 0;  0;  0.0;    1033;   90; 0;  8;  0.00;
07.02.2023; Tue;    07; -8.20;  -11.40; 6;  271;    6;  25; 25; 25; 0;  0;  0.0;    1033;   85; 0;  8;  0.00;
07.02.2023; Tue;    08; -8.80;  -12.40; 6;  308;    6;  25; 25; 25; 0;  0;  0.0;    1033;   82; 0;  8;  11.00;
07.02.2023; Tue;    09; -7.80;  -10.80; 5;  311;    5;  25; 25; 25; 0;  0;  0.0;    1033;   80; 0;  8;  23.00;
07.02.2023; Tue;    10; -5.20;  -7.60;  5;  345;    5;  25; 25; 25; 0;  0;  0.0;    1033;   66; 0;  8;  107.00;
07.02.2023; Tue;    11; -3.00;  -5.30;  5;  353;    5;  25; 25; 25; 0;  0;  0.0;    1032;   57; 0;  8;  417.00;
07.02.2023; Tue;    12; -1.40;  -3.20;  5;  81; 5;  0;  0;  0;  0;  0;  0.0;    1032;   48; 0;  1;  491.00;
07.02.2023; Tue;    13; 0.50;   0.50;   4;  16; 4;  2;  2;  2;  0;  0;  0.0;    1031;   38; 0;  1;  508.00;
07.02.2023; Tue;    14; -4.10;  -4.10;  3;  15; 3;  0;  0;  0;  0;  0;  0.0;    1036;   50; 0;  1;  466.00;
07.02.2023; Tue;    15; -3.70;  -3.70;  3;  13; 3;  0;  0;  0;  0;  0;  0.0;    1035;   47; 0;  1;  379.00;
07.02.2023; Tue;    16; -3.60;  -5.70;  5;  29; 5;  0;  0;  0;  0;  0;  0.0;    1034;   53; 0;  1;  248.00;
07.02.2023; Tue;    17; -4.20;  -6.90;  6;  38; 6;  0;  0;  0;  0;  0;  0.0;    1034;   65; 0;  1;  96.00;
07.02.2023; Tue;    18; -5.30;  -9.00;  7;  46; 7;  0;  0;  0;  0;  0;  0.0;    1035;   65; 0;  1;  4.00;
07.02.2023; Tue;    19; -5.90;  -9.70;  7;  63; 7;  18; 18; 18; 0;  0;  0.0;    1035;   67; 0;  1;  0.00;
07.02.2023; Tue;    20; -6.20;  -9.60;  6;  58; 6;  16; 16; 16; 0;  4;  0.0;    1035;   65; 0;  1;  0.00;
07.02.2023; Tue;    21; -6.40;  -9.60;  6;  63; 6;  2;  2;  2;  0;  4;  0.0;    1035;   63; 0;  1;  0.00;
07.02.2023; Tue;    22; -6.70;  -9.80;  6;  66; 6;  0;  0;  0;  0;  4;  0.0;    1036;   64; 0;  1;  0.00;
07.02.2023; Tue;    23; -7.30;  -10.70; 6;  76; 6;  0;  0;  0;  0;  4;  0.0;    1036;   67; 0;  1;  0.00;

With other weather services selected it's correct.

07.02.2023; Tue;    13; 6.80;   6.8;    2;  265;    5;  0;  0;  0;  0;  0;  0.0;    1029;   33; 0;  1;  464.00;
07.02.2023; Tue;    14; -0.40;  -0.40;  1;  183;    1;  8;  8;  8;  0;  0;  0.0;    1036;   60; 0;  1;  -9999.00;
07.02.2023; Tue;    15; 0.40;   0.40;   1;  146;    1;  5;  5;  5;  0;  0;  0.0;    1035;   58; 0;  1;  -9999.00;
07.02.2023; Tue;    16; 0.20;   0.20;   1;  120;    1;  2;  2;  2;  0;  0;  0.0;    1034;   63; 0;  1;  -9999.00;
07.02.2023; Tue;    17; -1.70;  -1.70;  2;  79; 2;  1;  1;  1;  0;  0;  0.0;    1035;   69; 0;  1;  -9999.00;
07.02.2023; Tue;    18; -4.40;  -4.40;  3;  52; 3;  1;  1;  1;  0;  0;  0.0;    1036;   73; 0;  1;  -9999.00;
07.02.2023; Tue;    19; -5.10;  -5.10;  2;  26; 2;  13; 13; 13; 0;  0;  0.0;    1037;   79; 0;  1;  -9999.00;
07.02.2023; Tue;    20; -6.10;  -6.10;  2;  45; 2;  16; 16; 16; 0;  0;  0.0;    1038;   79; 0;  1;  -9999.00;
07.02.2023; Tue;    21; -6.70;  -6.70;  2;  65; 2;  17; 17; 17; 0;  0;  0.0;    1038;   77; 0;  1;  -9999.00;
07.02.2023; Tue;    22; -7.30;  -7.30;  3;  77; 3;  17; 17; 17; 0;  0;  0.0;    1039;   76; 0;  1;  -9999.00;
07.02.2023; Tue;    23; -7.80;  -7.80;  3;  72; 3;  16; 16; 16; 0;  0;  0.0;    1040;   75; 0;  1;  -9999.00;

Would it make sense to check this also in the datatoloxone.pl?

If yes then I would change https://github.com/mschlenstedt/LoxBerry-Plugin-Weather4Lox/blob/d27ed616dce95ec7e82a3223e59d9e9ee478f32b/bin/datatoloxone.pl#L1544-L1556 to

      @fields = split(/\|/,$_);

      $hfcdate = DateTime->new(
            year      => @fields[6],
            month     => @fields[3],
            day       => @fields[2],
            hour      => @fields[7],
            minute    => @fields[8],
      );

      if ( DateTime->compare($epochdate, $hfcdate) == 1 ) { next; } # Exclude already past forecasts

      if ( $i >= 168 ) { last; } # Stop after 168 datasets

      #chomp $_;
mr-manuel commented 1 year ago

The change was merged with https://github.com/mschlenstedt/LoxBerry-Plugin-Weather4Lox/pull/90/commits/7d7b0c671be49eebd3c84f10bc96e442816276c4. If this is not intended please let me know.