2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-15 22:26:04 +00:00

FRITZBOX: clean up

git-svn-id: https://svn.fhem.de/fhem/trunk@8852 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
tpoitzsch 2015-06-28 16:57:33 +00:00
parent 86d448514d
commit 7257fe9fe6

View File

@ -1494,28 +1494,29 @@ sub FRITZBOX_Readout_Aborted($)
sub FRITZBOX_Readout_Format($$$) sub FRITZBOX_Readout_Format($$$)
{ {
my ($hash, $format, $readout) = @_; my ($hash, $format, $readout) = @_;
return $readout $readout = "" unless defined $readout;
unless defined $format;
return $readout return $readout unless defined $format;
unless $readout ne "" && $format ne "" ; return $readout unless $readout ne "" && $format ne "" ;
if ($format eq "aldays") { if ($format eq "aldays") {
if ($readout eq "0") { if ($readout eq "0") {
$readout = "once"; $readout = "once";
} elsif ($readout >= 127) { }
elsif ($readout >= 127) {
$readout = "daily"; $readout = "daily";
} else { }
else {
my $bitStr = $readout; my $bitStr = $readout;
$readout = ""; $readout = "";
foreach (sort {$a <=> $b} keys %alarmDays) foreach (sort {$a <=> $b} keys %alarmDays) {
{
$readout .= (($bitStr & $_) == $_) ? $alarmDays{$_}." " : ""; $readout .= (($bitStr & $_) == $_) ? $alarmDays{$_}." " : "";
} }
chop $readout; chop $readout;
} }
}
} elsif ($format eq "alnumber") { elsif ($format eq "alnumber") {
my $intern = $readout; my $intern = $readout;
if (1 <= $readout && $readout <=2) { if (1 <= $readout && $readout <=2) {
$readout = "FON $intern"; $readout = "FON $intern";
@ -1529,58 +1530,53 @@ sub FRITZBOX_Readout_Format($$$)
} }
$readout .= " (".$hash->{fhem}{$intern}{name}.")" $readout .= " (".$hash->{fhem}{$intern}{name}.")"
if defined $hash->{fhem}{$intern}{name}; if defined $hash->{fhem}{$intern}{name};
}
} elsif ($format eq "altime") { elsif ($format eq "altime") {
$readout =~ s/(\d\d)(\d\d)/$1:$2/; $readout =~ s/(\d\d)(\d\d)/$1:$2/;
}
} elsif ($format eq "deviceip") { elsif ($format eq "deviceip") {
$readout = $landevice{$readout}." ($readout)" $readout = $landevice{$readout}." ($readout)"
if defined $landevice{$readout}; if defined $landevice{$readout};
}
} elsif ($format eq "model") { elsif ($format eq "model") {
$readout = $fonModel{$readout} if defined $fonModel{$readout}; $readout = $fonModel{$readout} if defined $fonModel{$readout};
}
} elsif ($format eq "mohtype") { elsif ($format eq "mohtype") {
$readout = $mohtype[$readout] if defined $mohtype[$readout]; $readout = $mohtype[$readout] if defined $mohtype[$readout];
$readout = "" if $readout eq "er"; $readout = "" if $readout eq "er";
}
} elsif ($format eq "nounderline") { elsif ($format eq "nounderline") {
$readout =~ s/_/ /g; $readout =~ s/_/ /g;
}
} elsif ($format eq "onoff") { elsif ($format eq "onoff") {
$readout =~ s/er//; $readout =~ s/er//;
$readout =~ s/no-emu//; $readout =~ s/no-emu//;
$readout =~ s/0/off/; $readout =~ s/0/off/;
$readout =~ s/1/on/; $readout =~ s/1/on/;
}
} elsif ($format eq "radio") { elsif ($format eq "radio") {
if (defined $hash->{fhem}{radio}{$readout}) if (defined $hash->{fhem}{radio}{$readout}) {
{
$readout = $hash->{fhem}{radio}{$readout}; $readout = $hash->{fhem}{radio}{$readout};
} }
else else {
{
$readout .= " (unknown)"; $readout .= " (unknown)";
} }
}
} elsif ($format eq "ringtone") { elsif ($format eq "ringtone") {
$readout = $ringTone{$readout}; $readout = $ringTone{$readout};
}
} elsif ($format eq "secondsintime") { elsif ($format eq "secondsintime") {
if ($readout < 243600) if ($readout < 243600) {
{
$readout = sprintf "%d:%02d", int $readout/3600, int( ($readout %3600) / 60); $readout = sprintf "%d:%02d", int $readout/3600, int( ($readout %3600) / 60);
} }
else else {
{
$readout = sprintf "%dd %d:%02d", int $readout/24/3600, int ($readout%24*3600)/3600, int( ($readout %3600) / 60); $readout = sprintf "%dd %d:%02d", int $readout/24/3600, int ($readout%24*3600)/3600, int( ($readout %3600) / 60);
} }
} elsif ($format eq "usertype") { }
elsif ($format eq "usertype") {
$readout = $userType{$readout}; $readout = $userType{$readout};
} }
$readout = "" unless defined $readout;
return $readout; return $readout;
} }
@ -2691,7 +2687,7 @@ sub FRITZBOX_Ring_Run_Web($)
@webCmdArray = (); @webCmdArray = ();
if (int (@FritzFons) == 0 && $ttsLink) { if (int (@FritzFons) == 0 && $ttsLink) {
FRITZBOX_Log $hash, 3, "No Fritz!Fon identified, parameter 'say:' will be ignored." FRITZBOX_Log $hash, 3, "No Fritz!Fon identified, parameter 'say:' will be ignored.";
} }
# Creation fhemRadioStation for ttsLink # Creation fhemRadioStation for ttsLink
elsif (int (@FritzFons) && $ttsLink && $hash->{fhem}{radio}{$fhemRadioStation} ne "FHEM") { elsif (int (@FritzFons) && $ttsLink && $hash->{fhem}{radio}{$fhemRadioStation} ne "FHEM") {