71_PHILIPS_AUDIO: Player readings fix.

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@14003 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
ra666ack 2017-04-16 07:06:25 +00:00
parent 9df3dec1ec
commit ddf87d0e1b
2 changed files with 7 additions and 6 deletions

View File

@ -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_PHILIPS_AUDIO: Player readings fix.
- feature: 71_PHILIPS_AUDIO: Module rewritten for better usability. - feature: 71_PHILIPS_AUDIO: Module rewritten for better usability.
New commands. See documentation. New commands. See documentation.
- update: 38_CO20: identify devices by id / serial number - update: 38_CO20: identify devices by id / serial number

View File

@ -1269,9 +1269,9 @@ sub PHILIPS_AUDIO_ParseResponse
} }
else else
{ {
delete $hash->{READINGS}{$_} foreach (grep /player/, keys %{$hash->{READINGS}});
readingsBulkUpdate($hash, "playerPlaying", "no"); readingsBulkUpdate($hash, "playerPlaying", "no");
readingsBulkUpdate($hash, "input", "-"); readingsBulkUpdate($hash, "input", "-");
delete $hash->{READINGS}{$_} foreach (grep /player/, keys %{$hash->{READINGS}});
} }
} }
} }
@ -1279,9 +1279,9 @@ sub PHILIPS_AUDIO_ParseResponse
{ {
if($data =~ /STOP/) if($data =~ /STOP/)
{ {
delete $hash->{READINGS}{$_} foreach (grep /player/, keys %{$hash->{READINGS}});
readingsBulkUpdate($hash, "playerPlaying", "no"); readingsBulkUpdate($hash, "playerPlaying", "no");
readingsBulkUpdate($hash, "input", "-"); readingsBulkUpdate($hash, "input", "-");
delete $hash->{READINGS}{$_} foreach (grep /player/, keys %{$hash->{READINGS}});
} }
} }
elsif($cmd =~ m/^(volumeStraight|volumeUp|volumeDown)/) elsif($cmd =~ m/^(volumeStraight|volumeUp|volumeDown)/)
@ -1300,11 +1300,12 @@ sub PHILIPS_AUDIO_ParseResponse
if($1 eq "NOWPLAY") if($1 eq "NOWPLAY")
{ {
# New player status information available # New player status information available
readingsBulkUpdate($hash, "playerPlaying", "yes");
PHILIPS_AUDIO_SendCommand($hash, "/nowplay", "","nowplay", "noArg"); PHILIPS_AUDIO_SendCommand($hash, "/nowplay", "","nowplay", "noArg");
} }
elsif($1 eq "ELAPSE") elsif($1 eq "ELAPSE")
{ {
readingsBulkUpdate($hash, "playerPlaying", "yes");
if($data =~ /'value':(.+),/) if($data =~ /'value':(.+),/)
{ {
# Sometimes the device does not refresh the ELAPSE -> NOWPLAY request # Sometimes the device does not refresh the ELAPSE -> NOWPLAY request
@ -1396,11 +1397,10 @@ sub PHILIPS_AUDIO_ParseResponse
} }
else else
{ {
delete $hash->{READINGS}{$_} foreach (grep /player/, keys %{$hash->{READINGS}});
readingsBulkUpdate($hash, "playerPlaying", "no"); readingsBulkUpdate($hash, "playerPlaying", "no");
$hash->{helper}{playerState} = "home"; $hash->{helper}{playerState} = "home";
readingsBulkUpdate($hash, "playerState", "home"); readingsBulkUpdate($hash, "playerState", "home");
delete $hash->{READINGS}{$_} foreach (grep /player/, keys %{$hash->{READINGS}});
#readingsBulkUpdate($hash, "input", "-");
} }
} }
} }