mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-06 12:18:46 +00:00
bugfix: 77_UWZ: fix Issues 472183 and 473982
git-svn-id: https://svn.fhem.de/fhem/trunk@11829 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d1adadf96d
commit
7b28bd659d
@ -1,5 +1,6 @@
|
||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||
# Do not insert empty lines here, update check depends on it.
|
||||
- bugfix: 77_UWZ: fix Issues 472183 and 473982
|
||||
- updated: 77_UWZ: New Minor Release 1.4 multi languarge support, more Maps,
|
||||
Routine for search AreaID
|
||||
- updated: 74_AMAD: transmissionERROR Reading only expertMode is set
|
||||
|
@ -60,7 +60,7 @@ use vars qw($readingFnAttributes);
|
||||
|
||||
use vars qw(%defs);
|
||||
my $MODUL = "UWZ";
|
||||
my $version = "1.4.0"; # ungerade Entwicklerversion Bsp.: 1.1, 1.3, 2.5
|
||||
my $version = "1.4.1"; # ungerade Entwicklerversion Bsp.: 1.1, 1.3, 2.5
|
||||
|
||||
my $countrycode = "DE";
|
||||
my $plz = "77777";
|
||||
@ -737,15 +737,15 @@ sub UWZ_Run($) {
|
||||
"9" => "gelb", # <===== FIX HERE
|
||||
"10" => "orange",
|
||||
"11" => "rot",
|
||||
"12" => "violet" );
|
||||
"12" => "violett" );
|
||||
|
||||
foreach my $single_warning (@{ $uwz_warnings->{'results'} }) {
|
||||
|
||||
UWZ_Log $hash, 4, "Warn_".$i."_Type: ".$single_warning->{'type'};
|
||||
$message .= "Warn_".$i."_Type|".$single_warning->{'type'}."|";
|
||||
|
||||
UWZ_Log $hash, 4, "Warn_".$i."_uwzLevel: ".UWZ_GetUWZLevel($hash,UWZ_GetSeverityColor($hash,$single_warning->{'payload'}{'levelName'}));
|
||||
$message .= "Warn_".$i."_uwzLevel|".UWZ_GetUWZLevel($hash,UWZ_GetSeverityColor($hash,$single_warning->{'payload'}{'levelName'}))."|";
|
||||
UWZ_Log $hash, 4, "Warn_".$i."_uwzLevel: ".UWZ_GetUWZLevel($hash,$single_warning->{'payload'}{'levelName'});
|
||||
$message .= "Warn_".$i."_uwzLevel|".UWZ_GetUWZLevel($hash,$single_warning->{'payload'}{'levelName'})."|";
|
||||
|
||||
UWZ_Log $hash, 4, "Warn_".$i."_Severity: ".$single_warning->{'severity'};
|
||||
$message .= "Warn_".$i."_Severity|".$single_warning->{'severity'}."|";
|
||||
@ -781,8 +781,8 @@ sub UWZ_Run($) {
|
||||
"3" => "Warnstufe Orange (Unwetterwarnung)",
|
||||
"4" => "Warnstufe Rot (Unwetterwarnung)",
|
||||
"5" => "Warnstufe Violett (Unwetterwarnung)");
|
||||
UWZ_Log $hash, 4, "Warn_".$i."_uwzLevel_Str: ".$uwzlevelname{ UWZ_GetUWZLevel($hash,UWZ_GetSeverityColor($hash,$single_warning->{'payload'}{'levelName'})) };
|
||||
$message .= "Warn_".$i."_uwzLevel_Str|".$uwzlevelname{ UWZ_GetUWZLevel($hash,UWZ_GetSeverityColor($hash,$single_warning->{'payload'}{'levelName'})) }."|";
|
||||
UWZ_Log $hash, 4, "Warn_".$i."_uwzLevel_Str: ".$uwzlevelname{ UWZ_GetUWZLevel($hash,$single_warning->{'payload'}{'levelName'}) };
|
||||
$message .= "Warn_".$i."_uwzLevel_Str|".$uwzlevelname{ UWZ_GetUWZLevel($hash,$single_warning->{'payload'}{'levelName'}) }."|";
|
||||
|
||||
|
||||
} else {
|
||||
@ -794,8 +794,8 @@ sub UWZ_Run($) {
|
||||
"3" => "Alert level Orange",
|
||||
"4" => "Alert level Red",
|
||||
"5" => "Alert level Violet");
|
||||
UWZ_Log $hash, 4, "Warn_".$i."_uwzLevel_Str: ".$uwzlevelname{ UWZ_GetUWZLevel($hash,UWZ_GetSeverityColor($hash,$single_warning->{'payload'}{'levelName'})) };
|
||||
$message .= "Warn_".$i."_uwzLevel_Str|".$uwzlevelname{ UWZ_GetUWZLevel($hash,UWZ_GetSeverityColor($hash,$single_warning->{'payload'}{'levelName'})) }."|";
|
||||
UWZ_Log $hash, 4, "Warn_".$i."_uwzLevel_Str: ".$uwzlevelname{ UWZ_GetUWZLevel($hash,$single_warning->{'payload'}{'levelName'}) };
|
||||
$message .= "Warn_".$i."_uwzLevel_Str|".$uwzlevelname{ UWZ_GetUWZLevel($hash,$single_warning->{'payload'}{'levelName'}) }."|";
|
||||
|
||||
}
|
||||
|
||||
@ -825,7 +825,7 @@ sub UWZ_Run($) {
|
||||
# end language by AttrVal
|
||||
|
||||
UWZ_Log $hash, 4, "Warn_".$i."_IconURL: http://www.unwetterzentrale.de/images/icons/".$typenames{ $single_warning->{'type'} }."-".$single_warning->{'severity'}.".gif";
|
||||
$message .= "Warn_".$i."_IconURL|http://www.unwetterzentrale.de/images/icons/".$typenames{ $single_warning->{'type'} }."-".UWZ_GetSeverityColor($hash, $single_warning->{'payload'}{'levelName'} ).".gif|";
|
||||
$message .= "Warn_".$i."_IconURL|http://www.unwetterzentrale.de/images/icons/".$typenames{ $single_warning->{'type'} }."-".UWZ_GetSeverityColor($hash, UWZ_GetUWZLevel($hash,$single_warning->{'payload'}{'levelName'} )).".gif|";
|
||||
|
||||
|
||||
|
||||
@ -1033,7 +1033,7 @@ sub UWZAsHtmlMovie($$) {
|
||||
} else {
|
||||
# language by AttrVal
|
||||
if ( $hash->{CountryCode} ~~ [ 'DE', 'AT', 'CH' ] ) {
|
||||
$ret .= 'unbekannte Landbezeichnung';
|
||||
$ret .= 'unbekannte Filmbezeichnung';
|
||||
} else {
|
||||
$ret .='unknown movie setting';
|
||||
}
|
||||
@ -1083,26 +1083,39 @@ sub UWZAsHtmlKarteLand($$) {
|
||||
|
||||
#####################################
|
||||
sub UWZ_GetSeverityColor($$) {
|
||||
my ($name,$warnname) = @_;
|
||||
my @alert = split(/_/,$warnname);
|
||||
if ( $alert[1] eq "forewarn" ) {
|
||||
return "gelb";
|
||||
} else {
|
||||
return $alert[2];
|
||||
}
|
||||
my ($name,$uwzlevel) = @_;
|
||||
my $alertcolor = "";
|
||||
|
||||
my %UWZSeverity = ( "0" => "gruen",
|
||||
"1" => "orange",
|
||||
"2" => "gelb",
|
||||
"3" => "orange",
|
||||
"4" => "rot",
|
||||
"5" => "violett");
|
||||
|
||||
return $UWZSeverity{$uwzlevel};
|
||||
}
|
||||
|
||||
|
||||
#####################################
|
||||
sub UWZ_GetUWZLevel($$) {
|
||||
my ($name,$severitycolor) = @_;
|
||||
my %UWZSeverity = ( "green" => "0",
|
||||
"darkgreen" => "1",
|
||||
"gelb" => "2",
|
||||
"orange" => "3",
|
||||
"red" => "4",
|
||||
"violet" => "5");
|
||||
return $UWZSeverity{$severitycolor};
|
||||
my ($name,$warnname) = @_;
|
||||
my @alert = split(/_/,$warnname);
|
||||
|
||||
if ( $alert[0] eq "notice" ) {
|
||||
return "1";
|
||||
} elsif ( $alert[1] eq "forewarn" ) {
|
||||
return "2";
|
||||
} else {
|
||||
|
||||
my %UWZSeverity = ( "green" => "0",
|
||||
"yellow" => "2",
|
||||
"orange" => "3",
|
||||
"red" => "4",
|
||||
"violet" => "5");
|
||||
|
||||
return $UWZSeverity{$alert[2]};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1130,7 +1143,9 @@ sub UWZSearchLatLon($$) {
|
||||
use Data::Dumper;
|
||||
use Encode qw(decode encode);
|
||||
|
||||
my $search = XMLin($response->content, KeyAttr => { city => 'id' }, ForceArray => [ 'city' ]);
|
||||
my $uwzxmlparser = XML::Simple->new();
|
||||
#my $xmlres = $parser->XMLin(
|
||||
my $search = $uwzxmlparser->XMLin($response->content, KeyAttr => { city => 'id' }, ForceArray => [ 'city' ]);
|
||||
|
||||
my $ret = '<html><table><tr><td>';
|
||||
|
||||
@ -1953,4 +1968,4 @@ sub UWZSearchAreaID($$) {
|
||||
</ul>
|
||||
|
||||
=end html_DE
|
||||
=cut
|
||||
=cut
|
||||
|
Loading…
x
Reference in New Issue
Block a user