76_SolarForecast: add temporary Migrate Getter x_migrate, Implementation of a Messaging System

git-svn-id: https://svn.fhem.de/fhem/trunk@29539 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
DS_Starter
2025-01-19 21:16:06 +00:00
parent d2e2ea4d35
commit 2fe7147ece
2 changed files with 34 additions and 32 deletions

View File

@@ -580,7 +580,7 @@ my $allwidgets = 'icon|sortable|uzsu|knob|noArg|time|text|slider|multiple|select
my %msgs = (); # Initialisierung Mitteilungssystem my %msgs = (); # Initialisierung Mitteilungssystem
my %svicons = ( # Schweregrad Icons Mitteilungssystem my %svicons = ( # Schweregrad Icons Mitteilungssystem
'0' => 'message_mail@grey', # Standard Mitteilungs-Icon 0 - keine Mitteilung '0' => 'message_mail@grey', # Standard Mitteilungs-Icon 0 - keine Mitteilung
'1' => 'message_postbox_mail@darkorange', # Standard Mitteilungs-Icon 1 - Mitteilung '1' => 'message_mail_open@darkorange', # Standard Mitteilungs-Icon 1 - Mitteilung
'2' => 'message_attention@darkorange', # Standard Mitteilungs-Icon 2 - Warnung '2' => 'message_attention@darkorange', # Standard Mitteilungs-Icon 2 - Warnung
'3' => 'message_attention@red', # Standard Mitteilungs-Icon 3 - Fehler / Problem '3' => 'message_attention@red', # Standard Mitteilungs-Icon 3 - Fehler / Problem
); );
@@ -961,8 +961,8 @@ my %htitles = (
DE => qq{Öffne das Wiki} }, DE => qq{Öffne das Wiki} },
outpmsg => { EN => qq{Messages are available - press the button to open them}, outpmsg => { EN => qq{Messages are available - press the button to open them},
DE => qq{Mitteilungen sind vorhanden - drücke die Taste um sie zu öffnen} }, DE => qq{Mitteilungen sind vorhanden - drücke die Taste um sie zu öffnen} },
nomsgfo => { EN => qq{there is no message available}, nomsgfo => { EN => qq{there are no new messages},
DE => qq{es ist keine Mitteilung vorhanden} }, DE => qq{es sind keine neuen Mitteilungen vorhanden} },
scaresps => { EN => qq{API request successful}, scaresps => { EN => qq{API request successful},
DE => qq{API Abfrage erfolgreich} }, DE => qq{API Abfrage erfolgreich} },
dwfcrsu => { EN => qq{Weather data are up to date according to used DWD model}, dwfcrsu => { EN => qq{Weather data are up to date according to used DWD model},
@@ -1302,6 +1302,7 @@ my %hfspvh = (
# $data{$name}{dwdcatalog} # temporärer Speicher DWD Stationskatalog # $data{$name}{dwdcatalog} # temporärer Speicher DWD Stationskatalog
# $data{$name}{strings} # temporärer Speicher Stringkonfiguration # $data{$name}{strings} # temporärer Speicher Stringkonfiguration
# $data{$name}{aidectree}{object} # AI Decision Tree Object # $data{$name}{aidectree}{object} # AI Decision Tree Object
# $data{$name}{messages} # Speicher Mitteilungssystem
################################################################ ################################################################
# Init Fn # Init Fn
@@ -13783,16 +13784,16 @@ sub __fillupMessages {
if (!ReadingsVal ($name, '.migrated', 0)) { if (!ReadingsVal ($name, '.migrated', 0)) {
$midx++; $midx++;
$msgs{$midx}{SV} = 1; $data{$name}{messages}{$midx}{SV} = 1;
$msgs{$midx}{DE} = 'Die gespeicherten PV Daten können mit "get ... x_migrate" in ein neues Format umgesetzt werden welches den Median Ansatz bei der PV Prognose aktiviert und nutzt.'; $data{$name}{messages}{$midx}{DE} = 'Die gespeicherten PV Daten können mit "get ... x_migrate" in ein neues Format umgesetzt werden welches den Median Ansatz bei der PV Prognose aktiviert und nutzt.';
$msgs{$midx}{DE} .= '<br>Mit einem späteren Update des Moduls erfolgt diese Umstellung automatisch.'; $data{$name}{messages}{$midx}{DE} .= '<br>Mit einem späteren Update des Moduls erfolgt diese Umstellung automatisch.';
$msgs{$midx}{EN} = 'The stored PV data can be converted with “get ... x_migrate” into a new format which activates and uses the median approach in the PV forecast.'; $data{$name}{messages}{$midx}{EN} = 'The stored PV data can be converted with “get ... x_migrate” into a new format which activates and uses the median approach in the PV forecast.';
$msgs{$midx}{EN} .= '<br>With a later update of the module, this changeover will take place automatically.'; $data{$name}{messages}{$midx}{EN} .= '<br>With a later update of the module, this changeover will take place automatically.';
} }
if ($midx) { if ($midx) {
my @aidx = map { $_ } (1..$midx); # größte vorhandene Severity finden my @aidx = map { $_ } (1..$midx); # größte vorhandene Severity finden
my @values = map { $msgs{$_}{SV} } @aidx; my @values = map { $data{$name}{messages}{$_}{SV} } @aidx;
$max_sv = max(@values); $max_sv = max(@values);
} }
@@ -18209,16 +18210,16 @@ sub outputMessages {
my $hc = 0; my $hc = 0;
for my $key (sort keys %msgs) { for my $key (sort keys %{$data{$name}{messages}}) {
$hc++; $hc++;
my $enmsg = encode ("utf8", $msgs{$key}{$lang}); my $enmsg = encode ("utf8", $data{$name}{messages}{$key}{$lang});
$out .= qq{<tr>}; $out .= qq{<tr>};
$out .= qq{<td style="padding: 5px; text-align: center"> $key </td>}; $out .= qq{<td style="padding: 5px; text-align: center"> $key </td>};
$out .= qq{<td style="padding: 5px;"> </td>}; $out .= qq{<td style="padding: 5px;"> </td>};
$out .= qq{<td style="padding: 5px; text-align: center"> $msgs{$key}{SV} </td>}; $out .= qq{<td style="padding: 5px; text-align: center"> $data{$name}{messages}{$key}{SV} </td>};
$out .= qq{<td style="padding: 5px;"> </td>}; $out .= qq{<td style="padding: 5px;"> </td>};
$out .= qq{<td style="padding-right: 5px; text-align: left"> $enmsg </td>}; $out .= qq{<td style="padding-right: 5px; text-align: left"> $enmsg </td>};
$out .= qq{</tr>}; $out .= qq{</tr>};
if ($hc < $midx) { # Zwischenzeile if ($hc < $midx) { # Zwischenzeile

View File

@@ -580,7 +580,7 @@ my $allwidgets = 'icon|sortable|uzsu|knob|noArg|time|text|slider|multiple|select
my %msgs = (); # Initialisierung Mitteilungssystem my %msgs = (); # Initialisierung Mitteilungssystem
my %svicons = ( # Schweregrad Icons Mitteilungssystem my %svicons = ( # Schweregrad Icons Mitteilungssystem
'0' => 'message_mail@grey', # Standard Mitteilungs-Icon 0 - keine Mitteilung '0' => 'message_mail@grey', # Standard Mitteilungs-Icon 0 - keine Mitteilung
'1' => 'message_postbox_mail@darkorange', # Standard Mitteilungs-Icon 1 - Mitteilung '1' => 'message_mail_open@darkorange', # Standard Mitteilungs-Icon 1 - Mitteilung
'2' => 'message_attention@darkorange', # Standard Mitteilungs-Icon 2 - Warnung '2' => 'message_attention@darkorange', # Standard Mitteilungs-Icon 2 - Warnung
'3' => 'message_attention@red', # Standard Mitteilungs-Icon 3 - Fehler / Problem '3' => 'message_attention@red', # Standard Mitteilungs-Icon 3 - Fehler / Problem
); );
@@ -961,8 +961,8 @@ my %htitles = (
DE => qq{&#214;ffne das Wiki} }, DE => qq{&#214;ffne das Wiki} },
outpmsg => { EN => qq{Messages are available - press the button to open them}, outpmsg => { EN => qq{Messages are available - press the button to open them},
DE => qq{Mitteilungen sind vorhanden - dr&#252;cke die Taste um sie zu &#246;ffnen} }, DE => qq{Mitteilungen sind vorhanden - dr&#252;cke die Taste um sie zu &#246;ffnen} },
nomsgfo => { EN => qq{there is no message available}, nomsgfo => { EN => qq{there are no new messages},
DE => qq{es ist keine Mitteilung vorhanden} }, DE => qq{es sind keine neuen Mitteilungen vorhanden} },
scaresps => { EN => qq{API request successful}, scaresps => { EN => qq{API request successful},
DE => qq{API Abfrage erfolgreich} }, DE => qq{API Abfrage erfolgreich} },
dwfcrsu => { EN => qq{Weather data are up to date according to used DWD model}, dwfcrsu => { EN => qq{Weather data are up to date according to used DWD model},
@@ -1302,6 +1302,7 @@ my %hfspvh = (
# $data{$name}{dwdcatalog} # temporärer Speicher DWD Stationskatalog # $data{$name}{dwdcatalog} # temporärer Speicher DWD Stationskatalog
# $data{$name}{strings} # temporärer Speicher Stringkonfiguration # $data{$name}{strings} # temporärer Speicher Stringkonfiguration
# $data{$name}{aidectree}{object} # AI Decision Tree Object # $data{$name}{aidectree}{object} # AI Decision Tree Object
# $data{$name}{messages} # Speicher Mitteilungssystem
################################################################ ################################################################
# Init Fn # Init Fn
@@ -13783,16 +13784,16 @@ sub __fillupMessages {
if (!ReadingsVal ($name, '.migrated', 0)) { if (!ReadingsVal ($name, '.migrated', 0)) {
$midx++; $midx++;
$msgs{$midx}{SV} = 1; $data{$name}{messages}{$midx}{SV} = 1;
$msgs{$midx}{DE} = 'Die gespeicherten PV Daten können mit "get ... x_migrate" in ein neues Format umgesetzt werden welches den Median Ansatz bei der PV Prognose aktiviert und nutzt.'; $data{$name}{messages}{$midx}{DE} = 'Die gespeicherten PV Daten können mit "get ... x_migrate" in ein neues Format umgesetzt werden welches den Median Ansatz bei der PV Prognose aktiviert und nutzt.';
$msgs{$midx}{DE} .= '<br>Mit einem späteren Update des Moduls erfolgt diese Umstellung automatisch.'; $data{$name}{messages}{$midx}{DE} .= '<br>Mit einem späteren Update des Moduls erfolgt diese Umstellung automatisch.';
$msgs{$midx}{EN} = 'The stored PV data can be converted with “get ... x_migrate” into a new format which activates and uses the median approach in the PV forecast.'; $data{$name}{messages}{$midx}{EN} = 'The stored PV data can be converted with “get ... x_migrate” into a new format which activates and uses the median approach in the PV forecast.';
$msgs{$midx}{EN} .= '<br>With a later update of the module, this changeover will take place automatically.'; $data{$name}{messages}{$midx}{EN} .= '<br>With a later update of the module, this changeover will take place automatically.';
} }
if ($midx) { if ($midx) {
my @aidx = map { $_ } (1..$midx); # größte vorhandene Severity finden my @aidx = map { $_ } (1..$midx); # größte vorhandene Severity finden
my @values = map { $msgs{$_}{SV} } @aidx; my @values = map { $data{$name}{messages}{$_}{SV} } @aidx;
$max_sv = max(@values); $max_sv = max(@values);
} }
@@ -18209,16 +18210,16 @@ sub outputMessages {
my $hc = 0; my $hc = 0;
for my $key (sort keys %msgs) { for my $key (sort keys %{$data{$name}{messages}}) {
$hc++; $hc++;
my $enmsg = encode ("utf8", $msgs{$key}{$lang}); my $enmsg = encode ("utf8", $data{$name}{messages}{$key}{$lang});
$out .= qq{<tr>}; $out .= qq{<tr>};
$out .= qq{<td style="padding: 5px; text-align: center"> $key </td>}; $out .= qq{<td style="padding: 5px; text-align: center"> $key </td>};
$out .= qq{<td style="padding: 5px;"> </td>}; $out .= qq{<td style="padding: 5px;"> </td>};
$out .= qq{<td style="padding: 5px; text-align: center"> $msgs{$key}{SV} </td>}; $out .= qq{<td style="padding: 5px; text-align: center"> $data{$name}{messages}{$key}{SV} </td>};
$out .= qq{<td style="padding: 5px;"> </td>}; $out .= qq{<td style="padding: 5px;"> </td>};
$out .= qq{<td style="padding-right: 5px; text-align: left"> $enmsg </td>}; $out .= qq{<td style="padding-right: 5px; text-align: left"> $enmsg </td>};
$out .= qq{</tr>}; $out .= qq{</tr>};
if ($hc < $midx) { # Zwischenzeile if ($hc < $midx) { # Zwischenzeile