From a4f07a2dba78d11e387b93bfd744cde0ef12032a Mon Sep 17 00:00:00 2001 From: markusbloch Date: Sat, 6 Feb 2016 09:24:21 +0000 Subject: [PATCH] YAMAHA_AVR: newFirmware will only be triggered for RX-Vx71, RX-Vx73, RX-Ax10 or RX-Ax20 as newer models don't support this anymore, shuffle/repeat status will be requested only when current input support this or input changes (Forum: #48790) git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@10734 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 3 +++ fhem/FHEM/71_YAMAHA_AVR.pm | 41 +++++++++++++++++++++++++++----------- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 0a49feace..74d9e2b32 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. + - change: YAMAHA_AVR: reading/event newFirmware will only be triggered for + RX-Vx71, RX-Vx73, RX-Ax10 or RX-Ax20 as newer models do not + support this information anymore - change: 57_Calendar: complete rewrite see http://forum.fhem.de/index.php/topic,48315.0.html - feature: new events for home automation buttons and unassigned buttons diff --git a/fhem/FHEM/71_YAMAHA_AVR.pm b/fhem/FHEM/71_YAMAHA_AVR.pm index 46586f2e7..6a8270db5 100755 --- a/fhem/FHEM/71_YAMAHA_AVR.pm +++ b/fhem/FHEM/71_YAMAHA_AVR.pm @@ -42,9 +42,6 @@ sub YAMAHA_AVR_Attr(@); sub YAMAHA_AVR_ResetTimer($;$); sub YAMAHA_AVR_Undefine($$); - - - ################################### sub YAMAHA_AVR_Initialize($) @@ -217,7 +214,20 @@ YAMAHA_AVR_GetStatus($;$) YAMAHA_AVR_SendCommand($hash, "<$zone>GetParam", "statusRequest", "toneStatus", {options => {can_fail => 1}}); } } - YAMAHA_AVR_SendCommand($hash, "GetParam", "statusRequest", "fwUpdate", {options => {can_fail => 1}}); + + # check for FW update + if(defined($hash->{MODEL})) + { + if($hash->{MODEL} =~ /^RX-(?:A\d{1,2}10|V\d{1,2}71)$/) # RX-Vx71 / RX-Ax10 have different firmware status request + { + YAMAHA_AVR_SendCommand($hash, "GetParam", "statusRequest", "fwUpdate", {options => {can_fail => 1}}); + } + elsif($hash->{MODEL} =~ /^RX-(?:A\d{1,2}20|V\d{1,2}73)$/) # RX-Vx73 / RX-Ax20 have different firmware status request + { + YAMAHA_AVR_SendCommand($hash, "GetParam", "statusRequest", "fwUpdate", {options => {can_fail => 1}}); + } + } + YAMAHA_AVR_ResetTimer($hash) unless($local == 1); @@ -310,7 +320,7 @@ YAMAHA_AVR_Set($@) (exists($hash->{helper}{DIRECT_TAG}) ? "direct:on,off " : ""). (exists($hash->{helper}{DSP_MODES}) ? "dsp:".$dsp_modes_comma." " : "")."enhancer:on,off " : ""). (exists($hash->{helper}{CURRENT_INPUT_TAG}) ? "navigateListMenu play:noArg pause:noArg stop:noArg skip:reverse,forward ". - (exists($hash->{helper}{PLAY_CONTROL}) ? "shuffle:on,off repeat:off,one,all " : "") : ""). + (($hash->{helper}{SUPPORT_SHUFFLE_REPEAT}) ? "shuffle:on,off repeat:off,one,all " : "") : ""). "sleep:off,30min,60min,90min,120min,last ". (($hash->{helper}{SUPPORT_TONE_STATUS} and exists($hash->{ACTIVE_ZONE}) and $hash->{ACTIVE_ZONE} eq "mainzone") ? "bass:slider,-6,0.5,6 treble:slider,-6,0.5,6 " : ""). (($hash->{helper}{SUPPORT_TONE_STATUS} and exists($hash->{ACTIVE_ZONE}) and ($hash->{ACTIVE_ZONE} ne "mainzone") and YAMAHA_AVR_isModel_DSP($hash)) ? "bass:slider,-10,1,10 treble:slider,-10,1,10 " : ""). @@ -1181,7 +1191,7 @@ YAMAHA_AVR_ParseResponse ($$$) { if($arg eq "playShuffle") { - delete($hash->{helper}{PLAY_CONTROL}) if(exists($hash->{helper}{PLAY_CONTROL})); + $hash->{helper}{SUPPORT_SHUFFLE_REPEAT} = 0; } elsif($arg eq "toneStatus") { @@ -1441,16 +1451,23 @@ YAMAHA_AVR_ParseResponse ($$$) if($data =~ /(.+?)<\/Src_Name>/) { + $hash->{helper}{LAST_INPUT_TAG} = $hash->{helper}{CURRENT_INPUT_TAG} if(exists($hash->{helper}{CURRENT_INPUT_TAG})); $hash->{helper}{CURRENT_INPUT_TAG} = $1; Log3 $name, 4, "YAMAHA_AVR ($name) - check for extended input informations on <$1>"; YAMAHA_AVR_SendCommand($hash, "<$1>GetParam", "statusRequest", "playInfo", {options => {can_fail => 1}}); - YAMAHA_AVR_SendCommand($hash, "<$1>GetParam", "statusRequest", "playRepeat", {options => {can_fail => 1}}); - YAMAHA_AVR_SendCommand($hash, "<$1>GetParam", "statusRequest", "playShuffle", {options => {can_fail => 1}}); + + if(!exists($hash->{helper}{LAST_INPUT_TAG}) or ($hash->{helper}{LAST_INPUT_TAG} ne $hash->{helper}{CURRENT_INPUT_TAG}) or $hash->{helper}{SUPPORT_SHUFFLE_REPEAT}) + { + YAMAHA_AVR_SendCommand($hash, "<$1>GetParam", "statusRequest", "playRepeat", {options => {can_fail => 1}}); + YAMAHA_AVR_SendCommand($hash, "<$1>GetParam", "statusRequest", "playShuffle", {options => {can_fail => 1}}); + } } else { delete($hash->{helper}{CURRENT_INPUT_TAG}) if(exists($hash->{helper}{CURRENT_INPUT_TAG})); + delete($hash->{helper}{LAST_INPUT_TAG}) if(exists($hash->{helper}{LAST_INPUT_TAG})); + $hash->{helper}{SUPPORT_SHUFFLE_REPEAT} = 0; readingsBulkUpdate($hash, "currentAlbum", "", 0); readingsBulkUpdate($hash, "currentTitle", "", 0); readingsBulkUpdate($hash, "currentChannel", "", 0); @@ -1607,7 +1624,7 @@ YAMAHA_AVR_ParseResponse ($$$) { if($data =~ /(.+?)<\/Shuffle>/) { - $hash->{helper}{PLAY_CONTROL} = 1; + $hash->{helper}{SUPPORT_SHUFFLE_REPEAT} = 1; readingsBulkUpdate($hash, "shuffle", lc($1)); } } @@ -1615,7 +1632,7 @@ YAMAHA_AVR_ParseResponse ($$$) { if($data =~ /(.+?)<\/Repeat>/) { - $hash->{helper}{PLAY_CONTROL} = 1; + $hash->{helper}{SUPPORT_SHUFFLE_REPEAT} = 1; readingsBulkUpdate($hash, "repeat", lc($1)); } } @@ -2297,7 +2314,7 @@ So here are some examples:
  • input - The selected input source according to the FHEM input commands
  • inputName - The input description as seen on the receiver display
  • mute - Reports the mute status of the receiver or zone (can be "on" or "off")
  • -
  • newFirmware - indicates if a firmware update is available (can be "available" or "unavailable")
  • +
  • newFirmware - indicates if a firmware update is available (can be "available" or "unavailable"; only available for RX-Vx71, RX-Vx73, RX-Ax10 or RX-Ax20)
  • power - Reports the power status of the receiver or zone (can be "on" or "off")
  • presence - Reports the presence status of the receiver or zone (can be "absent" or "present"). In case of an absent device, it cannot be controlled via FHEM anymore.
  • partyMode - indicates if the party mode is enabled/disabled for the whole device (in main zone) or if the current zone is enabled for party mode (other zones than main zone)
  • @@ -2569,7 +2586,7 @@ Ein paar Beispiele:
  • input - Der ausgewählte Eingang entsprechend dem FHEM-Kommando
  • inputName - Die Eingangsbezeichnung, so wie sie am Receiver eingestellt wurde und auf dem Display erscheint
  • mute - Der aktuelle Stumm-Status ("on" => Stumm, "off" => Laut)
  • -
  • newFirmware - Zeigt an, ob eine neue Firmware zum installieren bereit liegt ("available" => neue Firmware verfügbar, "unavailable" => keine neue Firmware verfügbar)
  • +
  • newFirmware - Zeigt an, ob eine neue Firmware zum installieren bereit liegt ("available" => neue Firmware verfügbar, "unavailable" => keine neue Firmware verfügbar; Event wird nur generiert für RX-Vx71, RX-Vx73, RX-Ax10 oder RX-Ax20)
  • power - Der aktuelle Betriebsstatus ("on" => an, "off" => aus)
  • presence - Die aktuelle Empfangsbereitschaft ("present" => empfangsbereit, "absent" => nicht empfangsbereit, z.B. Stromausfall)
  • partyMode - Der Status des Party Modus ( "enabled" => aktiviert, "disabled" => deaktiviert). In der Main Zone stellt dies den geräteweiten Zustand des Party Modus dar. In den einzelnen Zonen zeigt es an, ob die jeweilige Zone für den Party Modus verwendet wird.