From 02a519ec5a4d1cc88e8e76a63fd1f867e08cd284 Mon Sep 17 00:00:00 2001 From: 50watt <> Date: Thu, 30 May 2019 13:21:14 +0000 Subject: [PATCH] 70_PIONEERAVR.pm: added alternative volume control provided by adn77 git-svn-id: https://svn.fhem.de/fhem/trunk@19496 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/70_PIONEERAVR.pm | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/fhem/FHEM/70_PIONEERAVR.pm b/fhem/FHEM/70_PIONEERAVR.pm index ef48b7126..987f7006c 100644 --- a/fhem/FHEM/70_PIONEERAVR.pm +++ b/fhem/FHEM/70_PIONEERAVR.pm @@ -111,10 +111,12 @@ sub PIONEERAVR_Initialize($) { logTraffic:0,1,2,3,4,5 statusUpdateReconnect:enable,disable statusUpdateStart:enable,disable + volumeLimit volumeLimitStraight disable:0,1 connectionCheck:off,30,45,60,75,90,105,120 timeout:1,2,3,4,5,7,10,15 + alternateVolumeControl:enable,disable ); use warnings 'qw'; $hash->{AttrList} = join( " ", @attrList ) . " " . $readingFnAttributes; @@ -1811,7 +1813,22 @@ PIONEERAVR_Set($@) } Log3 $name, 5, "PIONEERAVR $name: set $cmd ".dq($arg); my $pioneerVol = (80.5 + $arg)*2; - PIONEERAVR_Write( $hash, sprintf "%03dVL", $pioneerVol); +## PIONEERAVR_Write( $hash, sprintf "%03dVL", $pioneerVol); + + if ( AttrVal( $name, "alternateVolumeControl", "disable" ) eq "enable" ) { + my $vol = ReadingsVal( $name, "volumeStraight", 12 ); + if ( $arg > $vol ) { + for ( my $i=0; $i<($arg-$vol); $i++ ) { + PIONEERAVR_Write( $hash, sprintf "VU" ); + } + }elsif( $arg < $vol ){ + for ( my $i=0; $i<($vol-$arg); $i++ ) { + PIONEERAVR_Write( $hash, sprintf "VD" ); + } + } + }else{ + PIONEERAVR_Write( $hash, sprintf "%03dVL", $pioneerVol); + } return undef; ####Volume (0 - 100) in % ####according to http://www.fhemwiki.de/wiki/DevelopmentGuidelinesAV @@ -1822,7 +1839,21 @@ PIONEERAVR_Set($@) } Log3 $name, 5, "PIONEERAVR $name: set $cmd ".dq($arg); my $pioneerVol = sprintf "%d", $arg * 1.85; - PIONEERAVR_Write( $hash, sprintf "%03dVL", $pioneerVol); +## PIONEERAVR_Write( $hash, sprintf "%03dVL", $pioneerVol); + if ( AttrVal( $name, "alternateVolumeControl", "disable" ) eq "enable" ) { + my $vol = ReadingsVal( $name, "volume", 10 ); + if ( $arg > $vol ){ + for ( my $i=0; $i<($arg-$vol); $i++ ) { + PIONEERAVR_Write( $hash, sprintf "VU" ); + } + }elsif( $arg < $vol ){ + for ( my $i=0; $i<($vol-$arg); $i++ ) { + PIONEERAVR_Write( $hash, sprintf "VD" ); + } + } + }else{ + PIONEERAVR_Write( $hash, sprintf "%03dVL", $pioneerVol); + } return undef; ####tone (on|bypass) } elsif ( $cmd eq "tone" ) { @@ -3686,6 +3717,7 @@ sub RC_layout_PioneerAVR() {
  • tunerFrequency - Tuner frequency
  • volume - Current value of volume (0%-100%)
  • volumeStraight - Current value of volume os displayed in the display of the Pioneer AV Receiver
  • +
  • alternateVolumeControl <enable|disable> - Enables/disables alternate volume control for devices that don't support direct volume setting (e.g. VSX-52x/VSX-82x)


  • @@ -3967,6 +3999,7 @@ sub RC_layout_PioneerAVR() {
  • tunerFrequency - Tunerfrequenz
  • volume - Eingestellte Lautstärke (0%-100%)
  • volumeStraight - Eingestellte Lautstärke, so wie sie auch am Display des Pioneer AV Receivers angezeigt wird
  • +
  • alternateVolumeControl <enable|disable> - Aktiviert/deaktiviert alternative Lautst?eeinstellung für Gerate, die keine direktes Setzen der Lautst?e zulassen (z.B. VSX-52x/VSX-82x)