2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

99_sonos2mqttUtils.pm:bugfix volume control

git-svn-id: https://svn.fhem.de/fhem/trunk@24637 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Otto123 2021-06-15 14:19:41 +00:00
parent 5d146219f9
commit df59862249

View File

@ -82,14 +82,14 @@ if (grep { $_ eq $cmd } @easycmd) {return lc( qq($topic { "command": "$cmd" }) )
# special volume handling fading: second value is startvalue, if -1 start is actual value # special volume handling fading: second value is startvalue, if -1 start is actual value
if($cmd eq 'volume') { if($cmd eq 'volume') {
$vol = $arr[1];
if ($arr[2]) { if ($arr[2]) {
if ($arr[2] == -1) { $vol = ReadingsNum($NAME,'volume',0) } else { $vol = $arr[2] } if ($arr[2] == -1) { $arr[2] = ReadingsNum($NAME,'volume',0) }
my $d = abs $arr[1] - $vol; my $d = abs $arr[1] - $arr[2];
my $s = $arr[1] <=> $vol; my $s = $arr[1] <=> $arr[2];
if ($d) { for (1..$d) { fhem("sleep $_;set $NAME volume {([$NAME:volume]+$s)}") } } $arr[1] = $arr[2];
if ($d) { for (1..$d) { $vol = $arr[1] + $_*$s; fhem("sleep $_;set $NAME volume $vol") } }
} }
return qq($topic { "command": "volume", "input": $vol }) return qq($topic { "command": "volume", "input": $arr[1] })
} }
if ($cmd eq 'play') { if ($cmd eq 'play') {