From 2bd67871c7e809b46fa4adcedbe33e2b07286c98 Mon Sep 17 00:00:00 2001 From: markusbloch <> Date: Wed, 22 Aug 2018 13:32:46 +0000 Subject: [PATCH] YAMAHA_AVR: fix set command remoteControl tunerPresetUp/tunerPResetDown and tunerFrequency for DAB-based models (Forum: #51954) git-svn-id: https://svn.fhem.de/fhem/trunk@17190 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 2 ++ fhem/FHEM/71_YAMAHA_AVR.pm | 54 +++++++++++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 361830a56..64d201978 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # 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: fix set commands remoteControl tunerPresetUp, + tunerPresetDown and tunerFrequency for DAB based models - added: 98_systemd_watchdog: tested and moved from contrib - bugfix: 36_Vallox: Initialization bug fixed - added: 00_MQTT: ability for client notifications: on connect, diff --git a/fhem/FHEM/71_YAMAHA_AVR.pm b/fhem/FHEM/71_YAMAHA_AVR.pm index 92906b4c2..cf34e3e54 100755 --- a/fhem/FHEM/71_YAMAHA_AVR.pm +++ b/fhem/FHEM/71_YAMAHA_AVR.pm @@ -818,11 +818,39 @@ YAMAHA_AVR_Set($@) } elsif($a[2] eq "tunerPresetUp") { - YAMAHA_AVR_SendCommand($hash,"Up", $what, $a[2]); + if($hash->{helper}{SUPPORT_DAB}) + { + if(ReadingsVal($name, "tunerFrequencyBand", "FM") eq "DAB") + { + YAMAHA_AVR_SendCommand($hash,"Up", $what, $a[2]); + } + else + { + YAMAHA_AVR_SendCommand($hash,"Up", $what, $a[2]); + } + } + else + { + YAMAHA_AVR_SendCommand($hash,"Up", $what, $a[2]); + } } elsif($a[2] eq "tunerPresetDown") { - YAMAHA_AVR_SendCommand($hash,"Down", $what, $a[2]); + if($hash->{helper}{SUPPORT_DAB}) + { + if(ReadingsVal($name, "tunerFrequencyBand", "FM") eq "DAB") + { + YAMAHA_AVR_SendCommand($hash,"Down", $what, $a[2]); + } + else + { + YAMAHA_AVR_SendCommand($hash,"Down", $what, $a[2]); + } + } + else + { + YAMAHA_AVR_SendCommand($hash,"Down", $what, $a[2]); + } } else { @@ -940,13 +968,28 @@ YAMAHA_AVR_Set($@) if($a[2] =~ /^\d+(?:(?:\.|,)\d{1,2})?$/) { $a[2] =~ s/,/./; + if((defined($a[3]) and $a[3] eq "AM" )) # AM Band { - YAMAHA_AVR_SendCommand($hash,"AM".$a[2]."0kHz", $what, $a[2], {options => {can_fail => 1}}); + if($hash->{helper}{SUPPORT_DAB}) + { + return "no AM band supported by DAB based models"; + } + else + { + YAMAHA_AVR_SendCommand($hash,"AM".$a[2]."0kHz", $what, $a[2], {options => {can_fail => 1}}); + } } else # FM Band { - YAMAHA_AVR_SendCommand($hash,"FM".($a[2] * 100)."2MHz", $what, $a[2], {options => {can_fail => 1}}); + if($hash->{helper}{SUPPORT_DAB}) + { + YAMAHA_AVR_SendCommand($hash,"".($a[2] * 100)."2MHz", $what, $a[2], {options => {can_fail => 1}}); + } + else + { + YAMAHA_AVR_SendCommand($hash,"FM".($a[2] * 100)."2MHz", $what, $a[2], {options => {can_fail => 1}}); + } } } else @@ -2342,6 +2385,9 @@ YAMAHA_AVR_ParseXML($$$) # check for hdmi output command $hash->{helper}{SUPPORT_HDMI_OUT} = ($data =~ // ? 1 : 0); + # check for DAB support + $hash->{helper}{SUPPORT_DAB} = ($data =~ // ? 1 : 0); + # uncomment line for zone detection testing # #$hash->{helper}{ZONES} .= "|Zone_2";