diff --git a/74_AMAD.pm b/74_AMAD.pm index 3b98c34..6103e8e 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -37,7 +37,7 @@ use TcpServerUtils; use Encode qw(encode); -my $modulversion = "2.2.0"; +my $modulversion = "2.2.1"; my $flowsetversion = "2.2.0"; @@ -626,10 +626,26 @@ sub AMAD_SelectSetCmd($$@) { elsif( lc $cmd eq 'volume' ) { my $vol = join( " ", @data ); + + if( $vol =~ /^\+(.*)/ or $vol =~ /^-(.*)/ ) { + + if( $vol =~ /^\+(.*)/ ) { + + $vol =~ s/^\+//g; + $vol = ReadingsVal( $name, "volume", 15 ) + $vol; + } + + elsif( $vol =~ /^-(.*)/ ) { + + $vol =~ s/^-//g; + printf $vol; + $vol = ReadingsVal( $name, "volume", 15 ) - $vol; + } + } my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setVolume?volume=$vol"; - return AMAD_HTTP_POST( $hash, $url ); + return AMAD_HTTP_POST( $hash, $url ); } elsif( lc $cmd eq 'volumenotification' ) { @@ -1548,7 +1564,7 @@ sub AMAD_decrypt($) {