mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
70_ENIGMA2.pm: implement stateAV reading
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@12043 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d035f130a3
commit
db4104be04
@ -1036,6 +1036,7 @@ sub ENIGMA2_ReceiveCommand($$$) {
|
|||||||
readingsBulkUpdate( $hash, "presence", $presence )
|
readingsBulkUpdate( $hash, "presence", $presence )
|
||||||
if ( ReadingsVal( $name, "presence", "" ) ne $presence );
|
if ( ReadingsVal( $name, "presence", "" ) ne $presence );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# data received
|
# data received
|
||||||
@ -2187,6 +2188,11 @@ sub ENIGMA2_ReceiveCommand($$$) {
|
|||||||
readingsBulkUpdate( $hash, "state", $state )
|
readingsBulkUpdate( $hash, "state", $state )
|
||||||
if ( ReadingsVal( $name, "state", "" ) ne $state );
|
if ( ReadingsVal( $name, "state", "" ) ne $state );
|
||||||
|
|
||||||
|
# Set reading for stateAV
|
||||||
|
my $stateAV = ENIGMA2_GetStateAV($hash);
|
||||||
|
readingsBulkUpdate( $hash, "stateAV", $stateAV )
|
||||||
|
if ( ReadingsVal( $name, "stateAV", "-" ) ne $stateAV );
|
||||||
|
|
||||||
# Set ENIGMA2 online-only readings to "-" in case box is in
|
# Set ENIGMA2 online-only readings to "-" in case box is in
|
||||||
# offline or in standby mode
|
# offline or in standby mode
|
||||||
if ( $state eq "off"
|
if ( $state eq "off"
|
||||||
@ -2256,6 +2262,28 @@ sub ENIGMA2_Undefine($$) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###################################
|
||||||
|
sub ENIGMA2_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 ENIGMA2_wake ($$) {
|
sub ENIGMA2_wake ($$) {
|
||||||
my ( $name, $mac_addr ) = @_;
|
my ( $name, $mac_addr ) = @_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user