mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 23:06:37 +00:00
70_PHTV.pm: implement stateAV reading
git-svn-id: https://svn.fhem.de/fhem/trunk@12042 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
e862959a69
commit
83760d456d
@ -1733,6 +1733,7 @@ sub PHTV_ReceiveCommand($$$) {
|
||||
. "' not supported by device.";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# data received
|
||||
@ -3082,6 +3083,11 @@ sub PHTV_ReceiveCommand($$$) {
|
||||
readingsBulkUpdate( $hash, "state", $newstate );
|
||||
}
|
||||
|
||||
# Set reading for stateAV
|
||||
my $stateAV = PHTV_GetStateAV($hash);
|
||||
readingsBulkUpdate( $hash, "stateAV", $stateAV )
|
||||
if ( ReadingsVal( $name, "stateAV", "-" ) ne $stateAV );
|
||||
|
||||
# Set PHTV online-only readings to "-" in case box is in
|
||||
# offline or in standby mode
|
||||
if ( $newstate eq "off"
|
||||
@ -3214,6 +3220,29 @@ sub PHTV_Undefine($$) {
|
||||
return;
|
||||
}
|
||||
|
||||
###################################
|
||||
sub PHTV_GetStateAV($) {
|
||||
my ($hash) = @_;
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
if ( ReadingsVal( $name, "presence", "absent" ) eq "absent" ) {
|
||||
return "absent";
|
||||
}
|
||||
elsif ( ReadingsVal( $name, "power", "off" ) eq "off" ) {
|
||||
return "off";
|
||||
}
|
||||
elsif ( ReadingsVal( $name, "mute", "off" ) eq "on" ) {
|
||||
return "muted";
|
||||
}
|
||||
elsif ( ReadingsVal( $name, "playStatus", "stopped" ) ne "stopped" )
|
||||
{
|
||||
return ReadingsVal( $name, "playStatus", "stopped" );
|
||||
}
|
||||
else {
|
||||
return ReadingsVal( $name, "power", "off" );
|
||||
}
|
||||
}
|
||||
|
||||
###################################
|
||||
sub PHTV_wake ($) {
|
||||
my ($hash) = @_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user