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));