PHTV: fix for unsupported API commands

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@5169 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2014-03-08 22:25:59 +00:00
parent 67659e2618
commit 072b51e00c

View File

@ -24,7 +24,7 @@
# along with fhem. If not, see <http://www.gnu.org/licenses/>. # along with fhem. If not, see <http://www.gnu.org/licenses/>.
# #
# #
# Version: 1.1.2 # Version: 1.1.3
# #
# Major Version History: # Major Version History:
# - 1.1.0 - 2014-03-07 # - 1.1.0 - 2014-03-07
@ -1234,8 +1234,6 @@ sub PHTV_ReceiveCommand($$$) {
# device not reachable # device not reachable
if ($err) { if ($err) {
$newstate = "absent";
if ( !defined($cmd) || ref($cmd) eq "HASH" || $cmd eq "" ) { if ( !defined($cmd) || ref($cmd) eq "HASH" || $cmd eq "" ) {
Log3 $name, 4, "PHTV $name: RCV TIMEOUT $service"; Log3 $name, 4, "PHTV $name: RCV TIMEOUT $service";
} }
@ -1244,14 +1242,33 @@ sub PHTV_ReceiveCommand($$$) {
"PHTV $name: RCV TIMEOUT $service/" . urlDecode($cmd); "PHTV $name: RCV TIMEOUT $service/" . urlDecode($cmd);
} }
if ( # device is not reachable or
( !defined( $hash->{helper}{AVAILABLE} ) ) # does not even support master command for audio
or ( defined( $hash->{helper}{AVAILABLE} ) if ( $service eq "audio/volume" ) {
and $hash->{helper}{AVAILABLE} eq 1 ) $newstate = "absent";
)
{ if (
$hash->{helper}{AVAILABLE} = 0; ( !defined( $hash->{helper}{AVAILABLE} ) )
readingsBulkUpdate( $hash, "presence", "absent" ); or ( defined( $hash->{helper}{AVAILABLE} )
and $hash->{helper}{AVAILABLE} eq 1 )
)
{
$hash->{helper}{AVAILABLE} = 0;
readingsBulkUpdate( $hash, "presence", "absent" );
}
}
# device does not support command and behaves naughty
else {
$newstate = "on";
if ( !defined( $hash->{helper}{supportedAPIcmds}{$service} ) ) {
$hash->{helper}{supportedAPIcmds}{$service} = 0;
Log3 $name, 3,
"PHTV $name: API command '"
. $service
. "' not supported by device.";
}
} }
} }