2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 23:06:37 +00:00

YAMAHA_AVR: RX-V481D always reports FM and DAB tuner information together.

git-svn-id: https://svn.fhem.de/fhem/trunk@17547 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch 2018-10-16 18:17:01 +00:00
parent d12941e60f
commit 24f9ad29a8

View File

@ -1884,7 +1884,12 @@ YAMAHA_AVR_ParseResponse($$$)
readingsBulkUpdateIfChanged($hash, "currentArtist", "");
}
if($data =~ /<Meta_Info>.*?<Station>(.+?)<\/Station>.*?<\/Meta_Info>/)
if($data =~ /<Band>DAB<\/Band>/ and $data =~ /<Meta_Info>.*?<Service_Label>(.+?)<\/Service_Label>.*?<\/Meta_Info>/) # RX-481D provides always Meta-Info for DAB and Tuner
{
readingsBulkUpdate($hash, "currentStation", YAMAHA_AVR_html2txt($1));
}
elsif($data =~ /<Meta_Info>.*?<Station>(.+?)<\/Station>.*?<\/Meta_Info>/)
{
readingsBulkUpdate($hash, "currentStation", YAMAHA_AVR_html2txt($1));
}
@ -1892,7 +1897,7 @@ YAMAHA_AVR_ParseResponse($$$)
{
readingsBulkUpdate($hash, "currentStation", YAMAHA_AVR_html2txt($1));
}
elsif($data =~ /<DAB>.*?<Meta_Info>.*?<Service_Label>(.+?)<\/Service_Label>.*?<\/Meta_Info>.*?<\/DAB>/)
elsif($data =~ /<Meta_Info>.*?<Station>(.+?)<\/Station>.*?<\/Meta_Info>/)
{
readingsBulkUpdate($hash, "currentStation", YAMAHA_AVR_html2txt($1));
}
@ -1919,7 +1924,11 @@ YAMAHA_AVR_ParseResponse($$$)
readingsBulkUpdateIfChanged($hash, "currentAlbum", "");
}
if($data =~ /<Meta_Info>.*?<Song>(.+?)<\/Song>.*?<\/Meta_Info>/)
if($data =~ /<Band>DAB<\/Band>/ and $data =~ /<Meta_Info>.*?<DLS>(.+?)<\/DLS>.*?<\/Meta_Info>/) # RX-481D provides always Meta-Info for DAB and FM
{
readingsBulkUpdate($hash, "currentTitle", YAMAHA_AVR_html2txt($1));
}
elsif($data =~ /<Meta_Info>.*?<Song>(.+?)<\/Song>.*?<\/Meta_Info>/)
{
readingsBulkUpdate($hash, "currentTitle", YAMAHA_AVR_html2txt($1));
}
@ -1944,10 +1953,14 @@ YAMAHA_AVR_ParseResponse($$$)
{
readingsBulkUpdate($hash, "currentTitle", YAMAHA_AVR_html2txt($1));
}
elsif($data =~ /<DAB>.*?<DLS>(.+?)<\/DLS>.*?<\/DAB>/)
elsif($data =~ /<Meta_Info>.*?<Radio_Text>(.+?)<\/Radio_Text>.*?<\/Meta_Info>/) # RX-V481D
{
readingsBulkUpdate($hash, "currentTitle", YAMAHA_AVR_html2txt($1));
}
else
{
readingsBulkUpdateIfChanged($hash, "currentTitle", "");
@ -1964,12 +1977,14 @@ YAMAHA_AVR_ParseResponse($$$)
readingsBulkUpdate($hash, "playStatus", "playing");
}
if($data =~ /<Tuning>.*?<Freq>(?:<Current>)?<Val>(\d+?)<\/Val><Exp>(\d+?)<\/Exp><Unit>(.*?)<\/Unit>(?:<\/Current>)?.*<\/Tuning>/ or $data =~ /<DAB>.*?<Signal_Info>.*?<Freq><Val>(\d+?)<\/Val><Exp>(\d+?)<\/Exp><Unit>(.*?)<\/Unit><\/Freq>.*<\/Signal_Info>.*<\/DAB>/ or(YAMAHA_AVR_isModel_DSP($hash) and $data =~ /<Tuning>.*?<Freq><Val>(\d+?)<\/Val><Exp>(\d+?)<\/Exp><Unit>(.*?)<\/Unit><\/Freq>.*?<\/Tuning>/))
if(($data =~ /<Band>DAB<\/Band>/ and $data =~ /<DAB>.*?<Signal_Info>.*?<Freq><Val>(\d+?)<\/Val><Exp>(\d+?)<\/Exp><Unit>(.*?)<\/Unit><\/Freq>.*?<\/Signal_Info>.*?<\/DAB>/) or # RX-481D provides always Meta-Info for DAB and FM
($data =~ /<Tuning>.*?<Freq>(?:<Current>)?<Val>(\d+?)<\/Val><Exp>(\d+?)<\/Exp><Unit>(.*?)<\/Unit>(?:<\/Current>)?.*?<\/Tuning>/) or
(YAMAHA_AVR_isModel_DSP($hash) and $data =~ /<Tuning>.*?<Freq><Val>(\d+?)<\/Val><Exp>(\d+?)<\/Exp><Unit>(.*?)<\/Unit><\/Freq>.*?<\/Tuning>/))
{
readingsBulkUpdate($hash, "currentStationFrequency", sprintf("%.$2f", ($1 / (10 ** $2)))." $3");
readingsBulkUpdate($hash, "tunerFrequency", sprintf("%.$2f", ($1 / (10 ** $2))));
if($data =~ /<(?:Tuning|DAB)>.*?<Band>(.+?)<\/Band>.*?<\/(?:Tuning|DAB)>/)
if($data =~ /<Band>(.+?)<\/Band>/)
{
readingsBulkUpdate($hash, "tunerFrequencyBand", uc($1));
}