From 7ee82eabbb7df27f64195f8885166b451c4603ba Mon Sep 17 00:00:00 2001 From: markusbloch Date: Tue, 26 Sep 2017 09:09:28 +0000 Subject: [PATCH] YAMAHA_AVR: generate readings for tuner in DAB mode (Forum: #76789) git-svn-id: https://svn.fhem.de/fhem/trunk@15139 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/71_YAMAHA_AVR.pm | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 4880ec0f6..55a50faf0 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # 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. + - bugfix: 71_YAMAHA_AVR: generate readings for tuner in DAB mode - bugfix: 93_DbLog: V2.22.7, bugfix in configCheck for PostgreSQL - feature: 10_MYSENSORS_DEVICE: updated to latest MYSENSORS version - feature: 50_TelegramBot: hide cmd in favorites/changed favorites confirm diff --git a/fhem/FHEM/71_YAMAHA_AVR.pm b/fhem/FHEM/71_YAMAHA_AVR.pm index 26f74818d..88f3c07a5 100755 --- a/fhem/FHEM/71_YAMAHA_AVR.pm +++ b/fhem/FHEM/71_YAMAHA_AVR.pm @@ -58,6 +58,7 @@ YAMAHA_AVR_Initialize($) "disable:0,1 ". "disabledForIntervals ". "request-timeout:1,2,3,4,5 ". + "radioTitleDelimiter ". "model ". "volumeSteps:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 ". "volumeMax ". @@ -1816,6 +1817,10 @@ YAMAHA_AVR_ParseResponse($$$) { readingsBulkUpdate($hash, "currentStation", YAMAHA_AVR_html2txt($1)); } + elsif($data =~ /.*?.*?(.+?)<\/Service_Label>.*?<\/DAB>.*?<\/Meta_Info>/) + { + readingsBulkUpdate($hash, "currentStation", YAMAHA_AVR_html2txt($1)); + } else { readingsBulkUpdateIfChanged($hash, "currentStation", ""); @@ -1852,8 +1857,8 @@ YAMAHA_AVR_ParseResponse($$$) my $tmp = $1; if($data =~ /.*?(.+?)<\/Radio_Text_A>.*?(.+?)<\/Radio_Text_B>.*?<\/Meta_Info>/) - { - readingsBulkUpdate($hash, "currentTitle", YAMAHA_AVR_html2txt($1." ".$2)); + { + readingsBulkUpdate($hash, "currentTitle", YAMAHA_AVR_html2txt(trim($1)." ".trim($2))); } else { @@ -1864,6 +1869,10 @@ YAMAHA_AVR_ParseResponse($$$) { readingsBulkUpdate($hash, "currentTitle", YAMAHA_AVR_html2txt($1)); } + elsif($data =~ /.*?(.+?)<\/DLS>.*?<\/DAB>/) + { + readingsBulkUpdate($hash, "currentTitle", YAMAHA_AVR_html2txt($1)); + } else { readingsBulkUpdateIfChanged($hash, "currentTitle", ""); @@ -1880,7 +1889,7 @@ YAMAHA_AVR_ParseResponse($$$) readingsBulkUpdate($hash, "playStatus", "playing"); } - if($data =~ /.*?(\d+?)<\/Val>(\d+?)<\/Exp>(.*?)<\/Unit><\/Current>.*?<\/Tuning>/ or (YAMAHA_AVR_isModel_DSP($hash) and $data =~ /.*?(\d+?)<\/Val>(\d+?)<\/Exp>(.*?)<\/Unit><\/Freq>.*?<\/Tuning>/)) + if($data =~ /.*?(?:)?(\d+?)<\/Val>(\d+?)<\/Exp>(.*?)<\/Unit>(?:<\/Current>)?.*<\/Tuning>/ or (YAMAHA_AVR_isModel_DSP($hash) and $data =~ /.*?(\d+?)<\/Val>(\d+?)<\/Exp>(.*?)<\/Unit><\/Freq>.*?<\/Tuning>/)) { readingsBulkUpdate($hash, "currentStationFrequency", sprintf("%.$2f", ($1 / (10 ** $2)))." $3"); readingsBulkUpdate($hash, "tunerFrequency", sprintf("%.$2f", ($1 / (10 ** $2))));