2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

Sonos: Correct handling of device-modifying

git-svn-id: https://svn.fhem.de/fhem/trunk@14715 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Reinerlein 2017-07-14 10:39:57 +00:00
parent fb00e9f1f9
commit 877e875e22
3 changed files with 25 additions and 3 deletions

View File

@ -51,6 +51,9 @@
# Changelog (last 4 entries only, see Wiki for complete changelog)
#
# SVN-History:
# 14.07.2017
# Änderung in der ControlPoint.pm: Es wurden zuviele Suchantworten berücksichtigt.
# Bei einem Modify wird von Fhem nur die DefFn aufgerufen (und nicht vorher UndefFn). Dadurch blieben Reste, die aber vor einer Definition aufgeräumt werden müssen. Resultat war eine 100%-CPU-Last.
# 09.07.2017
# BulkUpdate: Beginn und Ende sind nun sicher davor einen vom SubProzess gestarteten BulkUpdate vorzeitig zu beenden.
# 05.07.2017
@ -877,7 +880,18 @@ sub SONOS_FhemWebCallback($) {
sub SONOS_Define($$) {
my ($hash, $def) = @_;
my @a = split("[ \t]+", $def);
# Check if we just want a modify...
if ($hash->{NAME}) {
SONOS_Log undef, 1, 'Modify Device: '.$hash->{NAME};
# Alle Timer entfernen...
RemoveInternalTimer($hash);
# SubProzess beenden, und Verbindung kappen...
SONOS_StopSubProcess($hash);
}
# check syntax
return 'Usage: define <name> SONOS [[[[upnplistener] interval] waittime] delaytime]' if($#a < 1 || $#a > 5);
my $name = $a[0];
@ -9765,7 +9779,7 @@ sub SONOS_getSonosPlayerByRoomName($) {
# Parameter hash = hash of the master, name
#
########################################################################################
sub SONOS_Undef ($$) {
sub SONOS_Undef($$) {
my ($hash, $name) = @_;
# Alle Timer entfernen...

View File

@ -207,6 +207,14 @@ sub SONOSPLAYER_Initialize ($) {
########################################################################################
sub SONOSPLAYER_Define ($$) {
my ($hash, $def) = @_;
# Check if we just want a modify...
if ($hash->{NAME}) {
SONOS_Log undef, 1, 'Modify SonosPlayer-Device: '.$hash->{NAME};
# Alle Timer entfernen...
RemoveInternalTimer($hash);
}
# define <name> SONOSPLAYER <udn>
# e.g.: define Sonos_Wohnzimmer SONOSPLAYER RINCON_000EFEFEFEF401400

View File

@ -418,7 +418,7 @@ sub _receiveSearchResponse {
last;
}
if ($search->{_friendlyName} && $search->{_friendlyName}) {
if ($search->{_friendlyName} && $buf =~ $search->{_friendlyName}) {
$found = 1;
last;
}