2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-03 19:49:02 +00:00

harmonizing according to Yamaha interface description

git-svn-id: https://svn.fhem.de/fhem/trunk@2135 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch 2012-11-17 23:55:05 +00:00
parent d5d259f953
commit b555cdda20

View File

@ -551,14 +551,36 @@ sub YAMAHA_AVR_getModel($$)
{
my ($hash, $address) = @_;
my $name = $hash->{NAME};
my $response = GetFileFromURL("http://".$address."/YamahaRemoteControl/desc.xml");
return undef unless(defined($response));
if($response =~ /<Unit_Description\s+Version="(.+?)"\s+Unit_Name="(.+?)">/)
{
$hash->{FIRMWARE} = $1;
$hash->{MODEL} = $2;
my $response;
my $desc_url;
$response = YAMAHA_AVR_SendCommand($address, "<YAMAHA_AV cmd=\"GET\"><System><Unit_Desc>GetParam</Unit_Desc></System></YAMAHA_AV>");
if(defined($response) and $response =~ /<URL>(.+?)<\/URL>/)
{
$desc_url = $1;
}
else
{
$desc_url = "/YamahaRemoteControl/desc.xml";
}
$response = YAMAHA_AVR_SendCommand($address, "<YAMAHA_AV cmd=\"GET\"><System><Config>GetParam</Config></System></YAMAHA_AV>");
if(defined($response) and $response =~ /<Model_Name>(.+?)<\/Model_Name>.*<System_ID>(.+?)<\/System_ID>.*<Version>(.+?)<\/Version>/)
{
$hash->{MODEL} = $1;
$hash->{SYSTEM_ID} = $2;
$hash->{FIRMWARE} = $3;
}
else
{
return undef;
}
$response = GetFileFromURL("http://".$address.$desc_url);
return undef unless(defined($response));
while($response =~ /<Menu Func="Subunit" Title_1="(.+?)" YNC_Tag="(.+?)">/gc)
{