From c04c886ba7eedc3ada435cf378160d487b7e17b7 Mon Sep 17 00:00:00 2001 From: Wzut <> Date: Mon, 8 Jan 2018 18:45:38 +0000 Subject: [PATCH] 73_MPD.pm : fix not working mute reading git-svn-id: https://svn.fhem.de/fhem/trunk@15830 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/73_MPD.pm | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/fhem/FHEM/73_MPD.pm b/fhem/FHEM/73_MPD.pm index c76cec043..64f1d15ab 100644 --- a/fhem/FHEM/73_MPD.pm +++ b/fhem/FHEM/73_MPD.pm @@ -207,11 +207,11 @@ sub MPD_updateConfig($) if ($hash->{".volume"} eq "0") { # ist Mute aktiv oder soll sie mit Absicht 0 sein ? # neuen Restore Wert zu Sicherheit erfinden - $hash->{".mute"} = 50; + $hash->{"mute"} = 50; } else { # wir haben irgend eine Lautstärke - $hash->{".mute"} = -1; + $hash->{"mute"} = -1; if (ReadingsVal($name,"mute","on") eq "on") { # das passt so nicht zusammen ! readingsSingleUpdate($hash,"mute","off",1); @@ -559,18 +559,16 @@ sub MPD_Set($@) if ($cmd eq "mute") { - my $mute_state = ReadingsVal($name,"mute","off"); + my $mute_state = ReadingsVal($name,"mute",""); my $mute = $mute_state; - if (($subcmd eq "on") && ($mute_state eq "off")){ $vol_new = "0"; $hash->{".mute"} = $vol_now; $mute="on"; } - elsif (($subcmd eq "off") && ($mute_state eq "on")) { $vol_new = $hash->{".mute"}; $hash->{".mute"} = -1; $mute="off"; } + if (($subcmd eq "on") && ($mute_state eq "off")){ $vol_new = "0"; $hash->{"mute"} = $vol_now; $mute="on"; } + elsif (($subcmd eq "off") && ($mute_state eq "on")) { $vol_new = $hash->{"mute"}; $hash->{"mute"} = -1; $mute="off"; } elsif ($subcmd eq "toggle") { - if ($mute_state eq "on") - { $vol_new = $hash->{".mute"}; $hash->{".mute"} = -1; $mute="off";} - else - { $vol_new = "0"; $hash->{".mute"} = $vol_now; $mute="on";} + if ($mute_state eq "on") { $vol_new = $hash->{"mute"}; $hash->{"mute"} = -1; $mute="off";} + elsif ($mute_state eq "off") { $vol_new = "0"; $hash->{"mute"} = $vol_now; $mute="on";} } - readingsSingleUpdate($hash,"mute",$mute,1) if ($mute ne $mute_state); + readingsSingleUpdate($hash,"mute",$mute,1); } # muessen wir die Laustärke verändern ?