2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

FRITZFON: new

git-svn-id: https://svn.fhem.de/fhem/trunk@7016 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
tpoitzsch 2014-11-18 20:08:11 +00:00
parent d389f6092f
commit 2ee23300a6

View File

@ -41,9 +41,18 @@ use Blocking;
sub FRITZFON_Log($$$);
sub FRITZFON_Init($);
sub FRITZFON_Init_Reading($$$@);
sub FRITZFON_Ring($$);
sub FRITZFON_Exec($$);
my %fonModel = (
'0x01' => "MT-D"
, '0x03' => "MT-F"
, '0x04' => "C3"
, '0x05' => "C4"
, '0x08' => "M2"
);
sub ##########################################
FRITZFON_Log($$$)
{
@ -198,7 +207,7 @@ FRITZFON_Init($)
{
# Dect-Telefonname
FRITZFON_Init_Reading($hash,
"dect".$_."_name",
"dect".$_,
"ctlmgr_ctl r telcfg settings/Foncontrol/User".$_."/Name");
# Dect-Interne Nummer
FRITZFON_Init_Reading($hash,
@ -213,16 +222,28 @@ FRITZFON_Init($)
"dect".$_."_imagePath ",
"ctlmgr_ctl r telcfg settings/Foncontrol/User".$_."/ImagePath ");
# Handset manufacturer
FRITZFON_Init_Reading($hash,
my $brand = FRITZFON_Init_Reading($hash,
"dect".$_."_manufacturer",
"ctlmgr_ctl r dect settings/Handset".($_-1)."/Manufacturer");
if ($brand eq "AVM")
{
# Firmware Version
FRITZFON_Init_Reading($hash,
"dect".$_."_fwVersion",
"ctlmgr_ctl r dect settings/Handset".($_-1)."/FWVersion");
# Phone Model
FRITZFON_Init_Reading($hash
, "dect".$_."_model"
, "ctlmgr_ctl r dect settings/Handset".($_-1)."/Model"
, "model");
}
}
foreach (0..3)
foreach (1..3)
{
# Analog-Telefonname
if (FRITZFON_Init_Reading($hash,
"fon".$_."_name",
"ctlmgr_ctl r telcfg settings/MSN/Port".$_."/Name"))
"fon".$_,
"ctlmgr_ctl r telcfg settings/MSN/Port".($_-1)."/Name"))
{
readingsBulkUpdate($hash, "fon".$_."_intern", $_);
}
@ -231,11 +252,17 @@ FRITZFON_Init($)
}
sub ##########################################
FRITZFON_Init_Reading($$$)
FRITZFON_Init_Reading($$$@)
{
my ($hash, $rName, $cmd) = @_;
my ($hash, $rName, $cmd, $replace) = @_;
my $result = FRITZFON_Exec( $hash, $cmd);
chomp ($result);
if ($result) {
if ($replace eq "model")
{
$result = $fonModel{$result}
if defined $fonModel{$result};
}
readingsBulkUpdate($hash, $rName, $result);
} elsif (defined $hash->{READINGS}{$rName} ) {
delete $hash->{READINGS}{$rName};
@ -243,7 +270,6 @@ FRITZFON_Init_Reading($$$)
return $result;
}
sub ##########################################
FRITZFON_Ring($$)
{