--- 70_PIONEERAVR.pm.orig 2019-03-19 14:44:27.993016200 +0100 +++ 70_PIONEERAVR_an.pm 2019-03-25 23:38:02.799159400 +0100 @@ -111,10 +111,12 @@ 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,21 @@ } Log3 $name, 5, "PIONEERAVR $name: set $cmd ".dq($arg); my $pioneerVol = (80.5 + $arg)*2; - 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 +1838,21 @@ } Log3 $name, 5, "PIONEERAVR $name: set $cmd ".dq($arg); my $pioneerVol = sprintf "%d", $arg * 1.85; - 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" ) { @@ -3631,6 +3661,7 @@