mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-07 19:04:20 +00:00
contrib/98_SB_PLAYER.pm: do not query disconnected players
git-svn-id: https://svn.fhem.de/fhem/trunk@14557 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
fb5ac0e12c
commit
0ad10f8776
@ -1449,6 +1449,12 @@ sub SB_PLAYER_Parse( $$ ) {
|
|||||||
# CD 0031 end
|
# CD 0031 end
|
||||||
} elsif( $args[ 0 ] eq "reconnect" ) {
|
} elsif( $args[ 0 ] eq "reconnect" ) {
|
||||||
IOWrite( $hash, "$hash->{PLAYERMAC} status 0 500 tags:Kcu\n" ); # CD 0030 u added to tags
|
IOWrite( $hash, "$hash->{PLAYERMAC} status 0 500 tags:Kcu\n" ); # CD 0030 u added to tags
|
||||||
|
# CD 0079 nach reconnect Status abfragen
|
||||||
|
delete($hash->{helper}{disableGetStatus}) if defined($hash->{helper}{disableGetStatus});
|
||||||
|
InternalTimer( gettimeofday() + 5,
|
||||||
|
"SB_PLAYER_GetStatus",
|
||||||
|
$hash,
|
||||||
|
0 );
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2873,6 +2879,7 @@ sub SB_PLAYER_Set( $@ ) {
|
|||||||
# CD 0014 end
|
# CD 0014 end
|
||||||
} elsif( $cmd eq "statusRequest" ) {
|
} elsif( $cmd eq "statusRequest" ) {
|
||||||
RemoveInternalTimer( $hash );
|
RemoveInternalTimer( $hash );
|
||||||
|
delete($hash->{helper}{disableGetStatus}) if defined($hash->{helper}{disableGetStatus}); # CD 0079
|
||||||
SB_PLAYER_GetStatus( $hash );
|
SB_PLAYER_GetStatus( $hash );
|
||||||
|
|
||||||
} elsif( $cmd eq "sync" ) {
|
} elsif( $cmd eq "sync" ) {
|
||||||
@ -3672,6 +3679,8 @@ sub SB_PLAYER_GetStatus( $ ) {
|
|||||||
|
|
||||||
Log3( $hash, 5, "SB_PLAYER_GetStatus: called" );
|
Log3( $hash, 5, "SB_PLAYER_GetStatus: called" );
|
||||||
|
|
||||||
|
return if(defined($hash->{helper}{disableGetStatus}));
|
||||||
|
|
||||||
# CD 0014 start - Anzahl Anfragen begrenzen
|
# CD 0014 start - Anzahl Anfragen begrenzen
|
||||||
if(!defined($hash->{helper}{lastGetStatus})||($hash->{helper}{lastGetStatus}<gettimeofday()-0.5)) {
|
if(!defined($hash->{helper}{lastGetStatus})||($hash->{helper}{lastGetStatus}<gettimeofday()-0.5)) {
|
||||||
#Log 0,"Querying status, last: $hash->{helper}{lastGetStatus}, now: ".gettimeofday();
|
#Log 0,"Querying status, last: $hash->{helper}{lastGetStatus}, now: ".gettimeofday();
|
||||||
@ -3734,6 +3743,11 @@ sub SB_PLAYER_GetStatus( $ ) {
|
|||||||
|
|
||||||
my $iv=AttrVal($name, "statusRequestInterval", 300); # CD 0037
|
my $iv=AttrVal($name, "statusRequestInterval", 300); # CD 0037
|
||||||
|
|
||||||
|
if(ReadingsVal($name,"presence","x") eq "absent") { # CD 0079
|
||||||
|
$iv=0;
|
||||||
|
$hash->{helper}{disableGetStatus}=1;
|
||||||
|
}
|
||||||
|
|
||||||
InternalTimer( gettimeofday() + $iv,
|
InternalTimer( gettimeofday() + $iv,
|
||||||
"SB_PLAYER_GetStatus",
|
"SB_PLAYER_GetStatus",
|
||||||
$hash,
|
$hash,
|
||||||
@ -4506,18 +4520,20 @@ sub SB_PLAYER_ParsePlayerStatus( $$ ) {
|
|||||||
|
|
||||||
} elsif( $cur =~ /^(power:)([0-9\.]*)/ ) {
|
} elsif( $cur =~ /^(power:)([0-9\.]*)/ ) {
|
||||||
if( $2 eq "1" ) {
|
if( $2 eq "1" ) {
|
||||||
readingsBulkUpdate( $hash, "state", "on" ); # CD 0041 hinzugefügt
|
if(ReadingsVal($name,'presence','absent') eq 'present') { # CD 0079 power nur auf 1 setzen wenn Player verbunden ist
|
||||||
readingsBulkUpdate( $hash, "power", "on" );
|
readingsBulkUpdate( $hash, "state", "on" ); # CD 0041 hinzugefügt
|
||||||
SB_PLAYER_Amplifier( $hash );
|
readingsBulkUpdate( $hash, "power", "on" );
|
||||||
# CD 0042 start
|
SB_PLAYER_Amplifier( $hash );
|
||||||
if($hash->{helper}{ttsstate}==TTS_WAITFORPOWERON) {
|
# CD 0042 start
|
||||||
RemoveInternalTimer( "TTSStartAfterPowerOn:$name");
|
if($hash->{helper}{ttsstate}==TTS_WAITFORPOWERON) {
|
||||||
InternalTimer( gettimeofday() + 0.01,
|
RemoveInternalTimer( "TTSStartAfterPowerOn:$name");
|
||||||
"SB_PLAYER_tcb_TTSStartAfterPowerOn",
|
InternalTimer( gettimeofday() + 0.01,
|
||||||
"TTSStartAfterPowerOn:$name",
|
"SB_PLAYER_tcb_TTSStartAfterPowerOn",
|
||||||
0 );
|
"TTSStartAfterPowerOn:$name",
|
||||||
|
0 );
|
||||||
|
}
|
||||||
|
# CD 0042 end
|
||||||
}
|
}
|
||||||
# CD 0042 end
|
|
||||||
} else {
|
} else {
|
||||||
# CD 0042 start
|
# CD 0042 start
|
||||||
if(($hash->{helper}{playerStatusOK}==0) && ($hash->{helper}{ttsstate}==TTS_WAITFORPOWERON)) {
|
if(($hash->{helper}{playerStatusOK}==0) && ($hash->{helper}{ttsstate}==TTS_WAITFORPOWERON)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user