From f14d2ad32e2cecabbe3f8a4faa7355912ceccbe2 Mon Sep 17 00:00:00 2001 From: markusbloch <> Date: Tue, 6 May 2014 16:59:09 +0000 Subject: [PATCH] YAMAHA_AVR: current* readings will be erased in case they not apply; added currentTitle for input TUNER (by Norbert Wedegaertner) git-svn-id: https://svn.fhem.de/fhem/trunk@5765 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 3 ++ fhem/FHEM/71_YAMAHA_AVR.pm | 85 ++++++++++++++++++++++++-------------- 2 files changed, 58 insertions(+), 30 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index fc8312d60..dd6086870 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,8 @@ # 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. + - feature: YAMAHA_AVR current* readings will be erased in case they + not applicable + - feature: YAMAHA_AVR currentTitle available for TUNER - feature: new Method: SYSMON_getValues([desired keys]) - feature: JSONMETER: hourly statistics - feature: configdb: new command search diff --git a/fhem/FHEM/71_YAMAHA_AVR.pm b/fhem/FHEM/71_YAMAHA_AVR.pm index 8acbea700..454c426af 100755 --- a/fhem/FHEM/71_YAMAHA_AVR.pm +++ b/fhem/FHEM/71_YAMAHA_AVR.pm @@ -169,37 +169,62 @@ YAMAHA_AVR_GetStatus($;$) { Log3 $name, 4, "YAMAHA_AVR $name: check for extended informations"; - my $infos = YAMAHA_AVR_SendCommand($hash, "<$1>GetParam"); + my $infos = YAMAHA_AVR_SendCommand($hash, "<$1>GetParam"); - if($infos =~ /.*?(.+?)<\/Artist>.*?<\/Meta_Info>/) - { - readingsBulkUpdate($hash, "currentArtist", YAMAHA_AVR_html2txt($1)); - } - - if($infos =~ /.*?(.+?)<\/Station>.*?<\/Meta_Info>/) - { - readingsBulkUpdate($hash, "currentStation", YAMAHA_AVR_html2txt($1)); - } - elsif($infos =~ /.*?(.+?)<\/Program_Service>.*?<\/Meta_Info>/) - { - readingsBulkUpdate($hash, "currentStation", YAMAHA_AVR_html2txt($1)); - } - - if($infos =~ /.*?(.+?)<\/Channel>.*?<\/Meta_Info>/) - { - readingsBulkUpdate($hash, "currentChannel", $1); - } - - if($infos =~ /.*?(.+?)<\/Album>.*?<\/Meta_Info>/) - { - readingsBulkUpdate($hash, "currentAlbum", YAMAHA_AVR_html2txt($1)); - } - - if($infos =~ /.*?(.+?)<\/Song>.*?<\/Meta_Info>/) - { - readingsBulkUpdate($hash, "currentTitle", YAMAHA_AVR_html2txt($1)); - } - + if($infos =~ /.*?(.+?)<\/Artist>.*?<\/Meta_Info>/) + { + readingsBulkUpdate($hash, "currentArtist", YAMAHA_AVR_html2txt($1)); + } + else + { + readingsBulkUpdate($hash, "currentArtist", "", 0); + } + + if($infos =~ /.*?(.+?)<\/Station>.*?<\/Meta_Info>/) + { + readingsBulkUpdate($hash, "currentStation", YAMAHA_AVR_html2txt($1)); + } + elsif($infos =~ /.*?(.+?)<\/Program_Service>.*?<\/Meta_Info>/) + { + readingsBulkUpdate($hash, "currentStation", YAMAHA_AVR_html2txt($1)); + } + else + { + readingsBulkUpdate($hash, "currentStation", "", 0); + } + + + if($infos =~ /.*?(.+?)<\/Channel>.*?<\/Meta_Info>/) + { + readingsBulkUpdate($hash, "currentChannel", $1); + } + else + { + readingsBulkUpdate($hash, "currentChannel", "", 0); + } + + if($infos =~ /.*?(.+?)<\/Album>.*?<\/Meta_Info>/) + { + readingsBulkUpdate($hash, "currentAlbum", YAMAHA_AVR_html2txt($1)); + } + else + { + readingsBulkUpdate($hash, "currentAlbum", "", 0); + } + + if($infos =~ /.*?(.+?)<\/Song>.*?<\/Meta_Info>/) + { + readingsBulkUpdate($hash, "currentTitle", YAMAHA_AVR_html2txt($1)); + } + elsif($infos =~ /.*?(.+?)<\/Radio_Text_A>.*?<\/Meta_Info>/) + { + readingsBulkUpdate($hash, "currentTitle", YAMAHA_AVR_html2txt($1)); + } + else + { + readingsBulkUpdate($hash, "currentTitle", "", 0); + } + if($infos =~ /(.+?)<\/Playback_Info>/) { readingsBulkUpdate($hash, "playStatus", lc($1));