From b459f6264a5906c0bfc3e7ea64acfb50540d6119 Mon Sep 17 00:00:00 2001
From: Marko Oldenburg <fhemdevelopment@cooltux.net>
Date: Mon, 2 Jan 2023 09:27:41 +0100
Subject: [PATCH] fix regex for sun and moon set and rise

---
 controls_Weather.txt                     |  2 +-
 lib/FHEM/APIs/Weather/wundergroundAPI.pm | 18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/controls_Weather.txt b/controls_Weather.txt
index 4b868d0..f4de39e 100644
--- a/controls_Weather.txt
+++ b/controls_Weather.txt
@@ -1,4 +1,4 @@
 UPD 2022-12-30_12:22:17 54815 FHEM/59_Weather.pm
 UPD 2022-12-30_12:22:17 49883 lib/FHEM/APIs/Weather/DarkSkyAPI.pm
 UPD 2022-12-30_12:22:17 32101 lib/FHEM/APIs/Weather/OpenWeatherMapAPI.pm
-UPD 2022-12-30_13:17:00 36076 lib/FHEM/APIs/Weather/wundergroundAPI.pm
+UPD 2023-01-02_09:25:12 36090 lib/FHEM/APIs/Weather/wundergroundAPI.pm
diff --git a/lib/FHEM/APIs/Weather/wundergroundAPI.pm b/lib/FHEM/APIs/Weather/wundergroundAPI.pm
index b729217..9b95fac 100644
--- a/lib/FHEM/APIs/Weather/wundergroundAPI.pm
+++ b/lib/FHEM/APIs/Weather/wundergroundAPI.pm
@@ -492,13 +492,13 @@ sub _ProcessingRetrieveData {
                     my $i = 0;
                     while ( $i < $days ) {
                         $data->{moonriseTimeLocal}[$i] =~
-                          s/^(....-..-..T..:..).*/$1/;
+                          s/^(....-..-..T..:..:..).*/$1/x;
                         $data->{moonsetTimeLocal}[$i] =~
-                          s/^(....-..-..T..:..).*/$1/;
+                          s/^(....-..-..T..:..:..).*/$1/x;
                         $data->{sunriseTimeLocal}[$i] =~
-                          s/^(....-..-..T..:..).*/$1/;
+                          s/^(....-..-..T..:..:..).*/$1/x;
                         $data->{sunsetTimeLocal}[$i] =~
-                          s/^(....-..-..T..:..).*/$1/;
+                          s/^(....-..-..T..:..:..).*/$1/x;
 
                         push(
                             @{ $self->{cached}{forecast}{daily} },
@@ -507,7 +507,10 @@ sub _ProcessingRetrieveData {
                                 'moonPhase'     => $data->{moonPhase}[$i],
                                 'moonPhaseCode' => $data->{moonPhaseCode}[$i],
                                 'moonPhaseDay'  => $data->{moonPhaseDay}[$i],
-                                'moonriseTime'  => _strftimeWrapper(
+                                'narrative'     => $data->{narrative}[$i],
+                                'precipProbability'     => $data->{qpf}[$i],
+                                'precipProbabilitySnow' => $data->{qpfSnow}[$i],
+                                'moonriseTime'          => _strftimeWrapper(
                                     "%a, %e %b %Y %H:%M",
                                     localtime(
                                         main::time_str2num(
@@ -523,10 +526,7 @@ sub _ProcessingRetrieveData {
                                         )
                                     )
                                 ),
-                                'narrative'         => $data->{narrative}[$i],
-                                'precipProbability' => $data->{qpf}[$i],
-                                'precipProbabilitySnow' => $data->{qpfSnow}[$i],
-                                'sunriseTime'           => _strftimeWrapper(
+                                'sunriseTime' => _strftimeWrapper(
                                     "%a, %e %b %Y %H:%M",
                                     localtime(
                                         main::time_str2num(
-- 
2.47.2