mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-06 12:18:46 +00:00
YAMAHA_AVR: fixing special charset conversion for current* readings. minor code changes at logging and regex
git-svn-id: https://svn.fhem.de/fhem/trunk@10155 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
ad71c7810c
commit
7aaf0572e9
@ -32,6 +32,7 @@ package main;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Time::HiRes qw(gettimeofday sleep);
|
||||
use Encode qw(decode encode);
|
||||
use HttpUtils;
|
||||
|
||||
sub YAMAHA_AVR_Get($@);
|
||||
@ -949,6 +950,7 @@ YAMAHA_AVR_HandleCmdQueue($)
|
||||
|
||||
if(not($hash->{helper}{RUNNING_REQUEST}) and @{$hash->{helper}{CMD_QUEUE}})
|
||||
{
|
||||
Log3 $name, 5, "YAMAHA_AVR ($name) - no commands currently running, but queue has pending commands. preparing new request";
|
||||
my $params = {
|
||||
url => "http://".$address."/YamahaRemoteControl/ctrl",
|
||||
timeout => AttrVal($name, "request-timeout", 4),
|
||||
@ -965,6 +967,7 @@ YAMAHA_AVR_HandleCmdQueue($)
|
||||
unless(defined($request))
|
||||
{
|
||||
# still request in queue, but not mentioned to be executed now
|
||||
Log3 $name, 5, "YAMAHA_AVR ($name) - still requests in queue, but no command shall be executed at the moment. Retry in 1 second.";
|
||||
RemoveInternalTimer("YAMAHA_AVR_HandleCmdQueue:$name");
|
||||
InternalTimer(gettimeofday()+1,"YAMAHA_AVR_HandleCmdQueue", "YAMAHA_AVR_HandleCmdQueue:$name", 0);
|
||||
return undef;
|
||||
@ -1178,13 +1181,13 @@ YAMAHA_AVR_ParseResponse ($$$)
|
||||
}
|
||||
elsif($arg eq "systemConfig")
|
||||
{
|
||||
if($data =~ /<Model_Name>(.+?)<\/Model_Name>.*<System_ID>(.+?)<\/System_ID>.*<Version>.*<Main>(.+?)<\/Main>.*<Sub>(.+?)<\/Sub>.*?<\/Version>/)
|
||||
if($data =~ /<Model_Name>(.+?)<\/Model_Name>.*?<System_ID>(.+?)<\/System_ID>.*?<Version>.*?<Main>(.+?)<\/Main>.*?<Sub>(.+?)<\/Sub>.*?<\/Version>/)
|
||||
{
|
||||
$hash->{MODEL} = $1;
|
||||
$hash->{SYSTEM_ID} = $2;
|
||||
$hash->{FIRMWARE} = $3." ".$4;
|
||||
}
|
||||
elsif($data =~ /<Model_Name>(.+?)<\/Model_Name>.*<System_ID>(.+?)<\/System_ID>.*<Version>(.+?)<\/Version>/)
|
||||
elsif($data =~ /<Model_Name>(.+?)<\/Model_Name>.*?<System_ID>(.+?)<\/System_ID>.*?<Version>(.+?)<\/Version>/)
|
||||
{
|
||||
$hash->{MODEL} = $1;
|
||||
$hash->{SYSTEM_ID} = $2;
|
||||
@ -1627,7 +1630,7 @@ YAMAHA_AVR_ParseResponse ($$$)
|
||||
{
|
||||
# list must be checked again in 1 second.
|
||||
Log3 $name, 5 ,"YAMAHA_AVR ($name) - menu is busy. retrying in 1 second";
|
||||
YAMAHA_AVR_SendCommand($hash,"<YAMAHA_AV cmd=\"GET\"><[CURRENT_INPUT_TAG]><List_Info>GetParam</List_Info></[CURRENT_INPUT_TAG]></YAMAHA_AV>", $cmd, $arg,{options => {not_before => (gettimeofday()+1), last_layer => $menu_layer}});
|
||||
YAMAHA_AVR_SendCommand($hash,"<YAMAHA_AV cmd=\"GET\"><[CURRENT_INPUT_TAG]><List_Info>GetParam</List_Info></[CURRENT_INPUT_TAG]></YAMAHA_AV>", $cmd, $arg,{options => {not_before => (gettimeofday()+1), last_layer => $menu_layer, at_first => 1}});
|
||||
}
|
||||
|
||||
# avoid statusRequest during menu browsing
|
||||
@ -1891,13 +1894,16 @@ sub YAMAHA_AVR_html2txt($)
|
||||
$string =~ s/&/&/g;
|
||||
$string =~ s/ / /g;
|
||||
$string =~ s/'/'/g;
|
||||
$string =~ s/(\xe4|ä)/ä/g;
|
||||
$string =~ s/(\xc4|Ä)/Ä/g;
|
||||
$string =~ s/(\xf6|ö)/ö/g;
|
||||
$string =~ s/(\xd6|Ö)/Ö/g;
|
||||
$string =~ s/(\xfc|ü)/ü/g;
|
||||
$string =~ s/(\xdc|Ü)/Ü/g;
|
||||
$string =~ s/(\xdf|ß)/ß/g;
|
||||
|
||||
$string = decode('UTF-8', $string);
|
||||
|
||||
$string =~ s/ä/ä/g;
|
||||
$string =~ s/Ä/Ä/g;
|
||||
$string =~ s/ö/ö/g;
|
||||
$string =~ s/Ö/Ö/g;
|
||||
$string =~ s/ü/ü/g;
|
||||
$string =~ s/Ü/Ü/g;
|
||||
$string =~ s/ß/ß/g;
|
||||
|
||||
$string =~ s/<[^>]+>//g;
|
||||
|
||||
@ -1905,7 +1911,7 @@ sub YAMAHA_AVR_html2txt($)
|
||||
$string =~ s/</</g;
|
||||
|
||||
$string =~ s/(^\s+|\s+$)//g;
|
||||
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user