mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-12 16:46:35 +00:00
71_YAMAHA_NP: Fixed volume slider bahavior
git-svn-id: https://svn.fhem.de/fhem/trunk@13653 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
497812f944
commit
ee0764db16
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# 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.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- bugfix: 71_YAMAHA_NP: Fixed volume slider
|
||||||
- bugfix: 95_Dashboard: fixed issue with csrf token that prevents
|
- bugfix: 95_Dashboard: fixed issue with csrf token that prevents
|
||||||
ajax request to succeed
|
ajax request to succeed
|
||||||
- feature: 71_YAMAHA_NP: Code rewritten for improved usabiliy. See docs.
|
- feature: 71_YAMAHA_NP: Code rewritten for improved usabiliy. See docs.
|
||||||
|
@ -449,13 +449,13 @@ sub YAMAHA_NP_Get
|
|||||||
}
|
}
|
||||||
elsif($what eq "deviceInfo")
|
elsif($what eq "deviceInfo")
|
||||||
{
|
{
|
||||||
return "DeviceInfo:\n ".
|
my $deviceInfo = join("\n", map {sprintf("%-15s: %-15s", $_, $hash->{helper}{dInfo}{$_})} sort keys %{$hash->{helper}{dInfo}});
|
||||||
join("\n ", map {"$_: $hash->{helper}{dInfo}{$_}"} sort keys %{$hash->{helper}{dInfo}});
|
return "Device info:\n\n$deviceInfo";
|
||||||
}
|
}
|
||||||
elsif($what eq "favoriteList" )
|
elsif($what eq "favoriteList" )
|
||||||
{
|
{
|
||||||
return "No favorites defined" if(!$hash->{helper}{fav});
|
return "No favorites defined" if(!$hash->{helper}{fav});
|
||||||
my $favoriteList = "Favorite list:\n"
|
my $favoriteList = "Favorite list:\n\n"
|
||||||
."name :input -> stream\n";
|
."name :input -> stream\n";
|
||||||
foreach my $fav (sort keys%{$hash->{helper}{fav}})
|
foreach my $fav (sort keys%{$hash->{helper}{fav}})
|
||||||
{
|
{
|
||||||
@ -1637,7 +1637,9 @@ sub YAMAHA_NP_ParseResponse
|
|||||||
{
|
{
|
||||||
|
|
||||||
$hash->{MODEL} = $1;
|
$hash->{MODEL} = $1;
|
||||||
$hash->{FIRMWARE} = $3;
|
$hash->{helper}{dInfo}{MODEL} = $1;
|
||||||
|
$hash->{FIRMWARE} = $3;
|
||||||
|
$hash->{helper}{dInfo}{FIRMWARE} = $3;
|
||||||
$hash->{helper}{dInfo}{SYSTEM_ID} = $2;
|
$hash->{helper}{dInfo}{SYSTEM_ID} = $2;
|
||||||
readingsBulkUpdate($hash, ".volumeStraightMin" , int($4));
|
readingsBulkUpdate($hash, ".volumeStraightMin" , int($4));
|
||||||
readingsBulkUpdate($hash, ".volumeStraightMax" , int($5));
|
readingsBulkUpdate($hash, ".volumeStraightMax" , int($5));
|
||||||
@ -1670,14 +1672,19 @@ sub YAMAHA_NP_ParseResponse
|
|||||||
if($data =~ /<Volume><Lvl>(.+?)<\/Lvl><Mute>(.+?)<\/Mute><\/Volume>/)
|
if($data =~ /<Volume><Lvl>(.+?)<\/Lvl><Mute>(.+?)<\/Mute><\/Volume>/)
|
||||||
{
|
{
|
||||||
readingsBulkUpdate($hash, "mute", lc($2));
|
readingsBulkUpdate($hash, "mute", lc($2));
|
||||||
readingsBulkUpdate($hash, "volumeStraight", ($1));
|
|
||||||
if($1 eq "0")
|
if($1 eq "0")
|
||||||
{
|
{
|
||||||
readingsBulkUpdate($hash, "mute", "on");
|
readingsBulkUpdate($hash, "mute", "on");
|
||||||
# Bug in the NP firmware. Even if volume = 0. Mute remains off.
|
# Bug in the NP firmware. Even if volume = 0. Mute remains off.
|
||||||
}
|
}
|
||||||
readingsBulkUpdate($hash, "volumeStraight", ($1));
|
|
||||||
readingsBulkUpdate($hash, "volume", YAMAHA_NP_volume_abs2rel($hash, $1));
|
# Surpress Readings update during smooth volume change
|
||||||
|
$hash->{helper}{volumeChangeProcessing} = "0" if(not defined($hash->{helper}{volumeChangeProcessing}));
|
||||||
|
if ($hash->{helper}{volumeChangeProcessing} eq "0")
|
||||||
|
{
|
||||||
|
readingsBulkUpdate($hash, "volumeStraight", ($1));
|
||||||
|
readingsBulkUpdate($hash, "volume", YAMAHA_NP_volume_abs2rel($hash, $1));
|
||||||
|
}
|
||||||
|
|
||||||
if($hash->{helper}{power} eq "on" && (ReadingsVal($name, "volumeStraight", "") eq "0" || ReadingsVal($name, "mute", "") eq "on"))
|
if($hash->{helper}{power} eq "on" && (ReadingsVal($name, "volumeStraight", "") eq "0" || ReadingsVal($name, "mute", "") eq "on"))
|
||||||
{
|
{
|
||||||
@ -2067,7 +2074,7 @@ sub YAMAHA_NP_ParseResponse
|
|||||||
if($data =~ /<UDN>(.+)<\/UDN>/)
|
if($data =~ /<UDN>(.+)<\/UDN>/)
|
||||||
{
|
{
|
||||||
my @uuid = split(/:/, $1);
|
my @uuid = split(/:/, $1);
|
||||||
$hash->{helper}{dInfo}{UNIQUE_DEVICE_NAME} = uc($uuid[1]);
|
$hash->{helper}{dInfo}{UUID} = uc($uuid[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data =~ s/[\n\t\r]//g;# replace \n\t\r by ""
|
$data =~ s/[\n\t\r]//g;# replace \n\t\r by ""
|
||||||
@ -2237,26 +2244,32 @@ sub YAMAHA_NP_ParseResponse
|
|||||||
|
|
||||||
if($hash->{helper}{volumeChangeDir} eq "EQUAL")
|
if($hash->{helper}{volumeChangeDir} eq "EQUAL")
|
||||||
{
|
{
|
||||||
readingsBulkUpdate($hash, "volumeStraight", $hash->{helper}{targetVolume});
|
$hash->{helper}{volumeChangeProcessing} = "0";
|
||||||
|
readingsBulkUpdate($hash, "volumeStraight", $hash->{helper}{targetVolume});
|
||||||
readingsBulkUpdate($hash, "volume", YAMAHA_NP_volume_abs2rel($hash, $hash->{helper}{targetVolume}));
|
readingsBulkUpdate($hash, "volume", YAMAHA_NP_volume_abs2rel($hash, $hash->{helper}{targetVolume}));
|
||||||
}
|
}
|
||||||
elsif($hash->{helper}{volumeChangeDir} =~ m/(UP|DOWN)/)
|
elsif($hash->{helper}{volumeChangeDir} =~ m/(UP|DOWN)/)
|
||||||
{
|
{
|
||||||
# Reset timer in order to avoid status request collisions
|
$hash->{helper}{volumeChangeProcessing} = "1";
|
||||||
# due to recursive volume change call
|
if($hash->{helper}{volumeChangeDir} eq "UP")
|
||||||
YAMAHA_NP_ResetTimer($hash);
|
{
|
||||||
if ($hash->{helper}{volumeChangeDir} eq "UP") {$volumeStraight += 1;}
|
$volumeStraight += 1;
|
||||||
elsif($hash->{helper}{volumeChangeDir} eq "DOWN"){$volumeStraight -= 1;}
|
}
|
||||||
readingsBulkUpdate($hash, "volumeStraight", $volumeStraight);
|
elsif($hash->{helper}{volumeChangeDir} eq "DOWN")
|
||||||
|
{
|
||||||
|
$volumeStraight -= 1;
|
||||||
|
}
|
||||||
|
readingsBulkUpdate($hash, "volumeStraight", $volumeStraight);
|
||||||
readingsBulkUpdate($hash, "volume", YAMAHA_NP_volume_abs2rel($hash, $volumeStraight));
|
readingsBulkUpdate($hash, "volume", YAMAHA_NP_volume_abs2rel($hash, $volumeStraight));
|
||||||
YAMAHA_NP_SendCmd($hash, "PUT:System,Volume,Lvl:$volumeStraight", "volume", $volumeStraight, 0);
|
YAMAHA_NP_SendCmd($hash, "PUT:System,Volume,Lvl:$volumeStraight", "volume", $volumeStraight, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
readingsBulkUpdate($hash, "volumeStraight", $hash->{helper}{targetVolume});
|
readingsBulkUpdate($hash, "volumeStraight", $hash->{helper}{targetVolume});
|
||||||
readingsBulkUpdate($hash, "volume", YAMAHA_NP_volume_abs2rel($hash, $hash->{helper}{targetVolume}));
|
readingsBulkUpdate($hash, "volume", YAMAHA_NP_volume_abs2rel($hash, $hash->{helper}{targetVolume}));
|
||||||
$hash->{helper}{volumeChangeDir} = "EQUAL";
|
$hash->{helper}{volumeChangeDir} = "EQUAL";
|
||||||
|
$hash->{helper}{volumeChangeProcessing} = "0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user