From 686e81c2bd87ac71d52eec0e1fbafc85b008b6ca Mon Sep 17 00:00:00 2001 From: markooldenburg <> Date: Thu, 2 Jun 2016 11:47:46 +0000 Subject: [PATCH] 74_AMAD: new Feature change current volume + or - value git-svn-id: https://svn.fhem.de/fhem/trunk@11594 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 2 ++ fhem/FHEM/74_AMAD.pm | 22 +++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index ebe8aa838..b6edcf094 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. + - feature: 74_AMAD: new Feature change current volume + or - value + set TABLET volume -5 - updated: 74_AMAD: New Minor Release 2.2 real state for deviceState Reading, Support for Amazon Music Player and Spotify Player, Keep Alive funktion for Android 6 diff --git a/fhem/FHEM/74_AMAD.pm b/fhem/FHEM/74_AMAD.pm index 3b98c34c6..6103e8e7c 100644 --- a/fhem/FHEM/74_AMAD.pm +++ b/fhem/FHEM/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($) {