71_YAMAHA_NP: Fixed tuner readings during standby

git-svn-id: https://svn.fhem.de/fhem/trunk@13667 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
ra666ack
2017-03-11 11:22:24 +00:00
parent 96aba79ab6
commit b3e240f61e
2 changed files with 31 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # 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. # Do not insert empty lines here, update check depends on it.
- bugfix: 71_YAMAHA_NP: Fixed tuner readings in standby.
- bugfix: 42_Nextion: mult. fixes - page10 / disconnect / init - bugfix: 42_Nextion: mult. fixes - page10 / disconnect / init
- bugfix: 71_YAMAHA_NP: Fixed volume slider - bugfix: 71_YAMAHA_NP: Fixed volume slider
- bugfix: 95_Dashboard: fixed issue with csrf token that prevents - bugfix: 95_Dashboard: fixed issue with csrf token that prevents

View File

@@ -1854,9 +1854,9 @@ sub YAMAHA_NP_ParseResponse
if ($hash->{helper}{tuner}{band} eq "FM") if ($hash->{helper}{tuner}{band} eq "FM")
{ {
my $id = ""; my $id = "-";
my $frequency = ""; my $frequency = "-";
my $tunerInfo1 = ""; my $tunerInfo1 = "-";
if($data =~ /<FM><Preset><Preset_Sel>(.+)<\/Preset_Sel><\/Preset><Tuning><Freq>(.+)<\/Freq>(.*)<\/FM/) if($data =~ /<FM><Preset><Preset_Sel>(.+)<\/Preset_Sel><\/Preset><Tuning><Freq>(.+)<\/Freq>(.*)<\/FM/)
{ {
@@ -1865,21 +1865,29 @@ sub YAMAHA_NP_ParseResponse
if($data =~ /<Program_Service>(.*)<\/Program_Service>/) if($data =~ /<Program_Service>(.*)<\/Program_Service>/)
{ {
readingsBulkUpdate($hash, "tunerInfo1" , ($1 ? YAMAHA_NP_html2txt($1) : "")); readingsBulkUpdate($hash, "tunerInfo1" , ($1 ? YAMAHA_NP_html2txt($1) : "-"));
$tunerInfo1 = $1; $tunerInfo1 = $1;
} }
if($data =~ /<Radio_Text_A>(.*)<\/Radio_Text_A>/) if($data =~ /<Radio_Text_A>(.*)<\/Radio_Text_A>/)
{ {
readingsBulkUpdate($hash, "tunerInfo2_A" , ($1 ? YAMAHA_NP_html2txt($1) : "")); readingsBulkUpdate($hash, "tunerInfo2_A" , ($1 ? YAMAHA_NP_html2txt($1) : "-"));
} }
if($data =~ /<Radio_Text_B>(.*)<\/Radio_Text_B>/) if($data =~ /<Radio_Text_B>(.*)<\/Radio_Text_B>/)
{ {
readingsBulkUpdate($hash, "tunerInfo2_B" , ($1 ? YAMAHA_NP_html2txt($1) : "")); readingsBulkUpdate($hash, "tunerInfo2_B" , ($1 ? YAMAHA_NP_html2txt($1) : "-"));
} }
if($data =~ /<Tuning><Freq>(.*)<\/Freq><\/Tuning>/) if($data =~ /<Tuning><Freq>(.*)<\/Freq><\/Tuning>/)
{ {
$frequency = $1 ? $1 : ""; if(ReadingsVal($name, "power","") eq "off")
$frequency =~ s/(\d{2})$/.$1/; # Insert '.' to frequency {
# Bug in the firmware. Last tuned frequency is send also in Standby mode.
$frequency = "-";
}
else
{
$frequency = $1 ? $1 : "";
$frequency =~ s/(\d{2})$/.$1/; # Insert '.' to frequency
}
readingsBulkUpdate($hash, "tunerFrequency", $frequency." MHz"); readingsBulkUpdate($hash, "tunerFrequency", $frequency." MHz");
} }
# No presets stored # No presets stored
@@ -1913,18 +1921,28 @@ sub YAMAHA_NP_ParseResponse
elsif($hash->{helper}{tuner}{band} eq "DAB") elsif($hash->{helper}{tuner}{band} eq "DAB")
{ {
my ($fq,$br,$qu,$am,$ch,$es,$dp,$sId) = ("-","-","-","-","-","-","DAB+",""); my ($fq,$br,$qu,$am,$ch,$es,$dp,$sId) = ("-","-","-","-","-","-","DAB+","");
if($data =~ /<Signal_Info><Freq>(.+)<\/Freq>/)
if($data =~ /<Signal_Info><Freq>(.+)<\/Freq>/)
{ {
$fq = $1; $fq = $1;
$fq =~ s/(\d{3})$/.$1/; # Insert '.' to frequency $fq =~ s/(\d{3})$/.$1/; # Insert '.' to frequency
} }
$br = $1 if($data =~ /<Bit_Rate>(.+)<\/Bit_Rate>/); $br = $1 if($data =~ /<Bit_Rate>(.+)<\/Bit_Rate>/);
$qu = $1 if($data =~ /<Quality>(.+)<\/Quality>/); $qu = $1 if($data =~ /<Quality>(.+)<\/Quality>/);
$am = $1 if($data =~ /<Audio_Mode>(.+)<\/Audio_Mode>/); $am = $1 if($data =~ /<Audio_Mode>(.+)<\/Audio_Mode>/);
$ch = $1 if($data =~ /<Ch_Label>(.*)<\/Ch_Label>/); $ch = $1 if($data =~ /<Ch_Label>(.*)<\/Ch_Label>/);
$ch = "-" if($ch eq "");
$es = YAMAHA_NP_html2txt($1) if($data =~ /<Ensemble_Label>(.*)<\/Ensemble_Label>/); $es = YAMAHA_NP_html2txt($1) if($data =~ /<Ensemble_Label>(.*)<\/Ensemble_Label>/);
$es = "-" if($es eq "");
$dp = "DAB" if($data =~ /<DAB_PLUS>Negate<\/DAB_PLUS>/); $dp = "DAB" if($data =~ /<DAB_PLUS>Negate<\/DAB_PLUS>/);
if($fq eq "-")
{
$am = "-";
$dp = "-";
$qu = "-";
}
# remember station name # remember station name
my $stName = "-"; my $stName = "-";
@@ -1933,11 +1951,11 @@ sub YAMAHA_NP_ParseResponse
if($data =~ /<DLS>(.*)<\/DLS>/) if($data =~ /<DLS>(.*)<\/DLS>/)
{ {
readingsBulkUpdate($hash, "tunerInfo1" , ($1 ? YAMAHA_NP_html2txt($1) : "")); readingsBulkUpdate($hash, "tunerInfo1" , ($1 ? YAMAHA_NP_html2txt($1) : "-"));
} }
if($data =~ /<Service_Label>(.*)<\/Service_Label>/) if($data =~ /<Service_Label>(.*)<\/Service_Label>/)
{ {
$stName = $1 ? YAMAHA_NP_html2txt($1) : ""; $stName = $1 ? YAMAHA_NP_html2txt($1) : "-";
readingsBulkUpdate($hash, "tunerStation", $stName); readingsBulkUpdate($hash, "tunerStation", $stName);
} }
if($data =~ /<ID>(.+)<\/ID>/) if($data =~ /<ID>(.+)<\/ID>/)