2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 04:36:36 +00:00

PHTV: case-insensitive set commands, muteT as alias for mute

git-svn-id: https://svn.fhem.de/fhem/trunk@7731 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2015-01-26 09:35:02 +00:00
parent 86840a845f
commit 8c94a5678e

View File

@ -366,7 +366,7 @@ sub PHTV_Set($@) {
}
# toggle
elsif ( $a[1] eq "toggle" ) {
elsif ( lc($a[1]) eq "toggle" ) {
Log3 $name, 2, "PHTV set $name " . $a[1];
if ( $hash->{READINGS}{state}{VAL} ne "on" ) {
@ -380,7 +380,7 @@ sub PHTV_Set($@) {
# off
# on
elsif ( $a[1] eq "off" || $a[1] eq "on" ) {
elsif ( lc($a[1]) eq "off" || lc($a[1]) eq "on" ) {
Log3 $name, 2, "PHTV set $name " . $a[1];
if ( $hash->{READINGS}{state}{VAL} ne "absent" ) {
@ -399,7 +399,7 @@ sub PHTV_Set($@) {
return "No argument given" if ( !defined( $a[2] ) );
if ( $hash->{READINGS}{state}{VAL} eq "on" ) {
if ( $a[2] eq "on" ) {
if ( lc($a[2]) eq "on" ) {
return
"No configuration found. Please set ambiHue attributes first."
if ( !defined( $attr{$name}{ambiHueLeft} )
@ -414,7 +414,7 @@ sub PHTV_Set($@) {
PHTV_SendCommand( $hash, "ambilight/processed", undef, "init" );
}
elsif ( $a[2] eq "off" ) {
elsif ( lc($a[2]) eq "off" ) {
readingsSingleUpdate( $hash, "ambiHue", $a[2], 1 )
if ( $hash->{READINGS}{ambiHue}{VAL} ne $a[2] );
}
@ -434,13 +434,13 @@ sub PHTV_Set($@) {
return "No argument given" if ( !defined( $a[2] ) );
if ( $hash->{READINGS}{state}{VAL} ne "absent" ) {
if ( $a[2] eq "internal" || $a[2] eq "manual" || $a[2] eq "expert" )
if ( lc($a[2]) eq "internal" || lc($a[2]) eq "manual" || lc($a[2]) eq "expert" )
{
PHTV_SendCommand( $hash, "ambilight/mode",
'"current": "' . $a[2] . '"', $a[2] );
readingsSingleUpdate( $hash, "rgb", "000000", 1 )
if ( $a[2] eq "internal" );
if ( lc($a[2]) eq "internal" );
}
else {
return
@ -464,7 +464,7 @@ sub PHTV_Set($@) {
my $json;
# rainbow
if ( $a[2] eq "rainbow" ) {
if ( lc($a[2]) eq "rainbow" ) {
my $layer = ( $a[3] ) ? $a[3] : 1;
return "Layer $layer is not numeric"
@ -574,7 +574,7 @@ sub PHTV_Set($@) {
}
# rainbow-pastel
elsif ( $a[2] eq "rainbow-pastel" ) {
elsif ( lc($a[2]) eq "rainbow-pastel" ) {
my $layer = ( $a[3] ) ? $a[3] : 1;
return "Layer $layer is not numeric"
@ -610,7 +610,7 @@ sub PHTV_Set($@) {
}
# rgb
elsif ( $a[1] eq "rgb" ) {
elsif ( lc($a[1]) eq "rgb" ) {
Log3 $name, 4, "PHTV set $name " . $a[1] . " " . $a[2];
return "No argument given" if ( !defined( $a[2] ) );
@ -761,7 +761,7 @@ sub PHTV_Set($@) {
}
# hue
elsif ( $a[1] eq "hue" ) {
elsif ( lc($a[1]) eq "hue" ) {
Log3 $name, 2, "PHTV set $name " . $a[1] . " " . $a[2];
return "No argument given" if ( !defined( $a[2] ) );
@ -798,7 +798,7 @@ sub PHTV_Set($@) {
}
# sat
elsif ( $a[1] eq "sat" ) {
elsif ( lc($a[1]) eq "sat" ) {
Log3 $name, 2, "PHTV set $name " . $a[1] . " " . $a[2];
return "No argument given" if ( !defined( $a[2] ) );
@ -836,7 +836,7 @@ sub PHTV_Set($@) {
}
# bri
elsif ( $a[1] eq "bri" ) {
elsif ( lc($a[1]) eq "bri" ) {
Log3 $name, 2, "PHTV set $name " . $a[1] . " " . $a[2];
return "No argument given" if ( !defined( $a[2] ) );
@ -874,7 +874,7 @@ sub PHTV_Set($@) {
}
# pct
elsif ( $a[1] eq "pct" ) {
elsif ( lc($a[1]) eq "pct" ) {
Log3 $name, 2, "PHTV set $name " . $a[1] . " " . $a[2];
return "No argument given" if ( !defined( $a[2] ) );
@ -914,7 +914,7 @@ sub PHTV_Set($@) {
}
# volume
elsif ( $a[1] eq "volume" ) {
elsif ( lc($a[1]) eq "volume" ) {
Log3 $name, 2, "PHTV set $name " . $a[1] . " " . $a[2];
return "No argument given" if ( !defined( $a[2] ) );
@ -1010,7 +1010,7 @@ sub PHTV_Set($@) {
}
# mute
elsif ( $a[1] eq "mute" ) {
elsif ( lc($a[1]) eq "mute" || lc($a[1]) eq "mutet" ) {
if ( defined( $a[2] ) ) {
Log3 $name, 2, "PHTV set $name " . $a[1] . " " . $a[2];
}
@ -1029,13 +1029,13 @@ sub PHTV_Set($@) {
readingsSingleUpdate( $hash, "mute", "off", 1 );
}
}
elsif ( $a[2] eq "off" ) {
elsif ( lc($a[2]) eq "off" ) {
if ( $hash->{READINGS}{mute}{VAL} ne "off" ) {
$cmd = '"muted": false';
readingsSingleUpdate( $hash, "mute", "off", 1 );
}
}
elsif ( $a[2] eq "on" ) {
elsif ( lc($a[2]) eq "on" ) {
if ( $hash->{READINGS}{mute}{VAL} ne "on" ) {
$cmd = '"muted": true';
readingsSingleUpdate( $hash, "mute", "on", 1 );
@ -1109,7 +1109,7 @@ sub PHTV_Set($@) {
}
# channel
elsif ( $a[1] eq "channel" ) {
elsif ( lc($a[1]) eq "channel" ) {
if ( defined( $a[2] )
&& $hash->{READINGS}{presence}{VAL} eq "present"
&& $hash->{READINGS}{state}{VAL} ne "on" )
@ -1172,7 +1172,7 @@ sub PHTV_Set($@) {
}
# input
elsif ( $a[1] eq "input" ) {
elsif ( lc($a[1]) eq "input" ) {
if ( defined( $a[2] )
&& $hash->{READINGS}{presence}{VAL} eq "present"
&& $hash->{READINGS}{state}{VAL} ne "on" )
@ -1215,7 +1215,7 @@ sub PHTV_Set($@) {
}
# play / pause
elsif ( $a[1] =~ /^(play|pause)$/ ) {
elsif ( lc($a[1]) =~ /^(play|pause)$/ ) {
Log3 $name, 2, "PHTV set $name " . $a[1];
if ( $hash->{READINGS}{state}{VAL} eq "on" ) {
@ -1228,7 +1228,7 @@ sub PHTV_Set($@) {
}
# stop
elsif ( $a[1] eq "stop" ) {
elsif ( lc($a[1]) eq "stop" ) {
Log3 $name, 2, "PHTV set $name " . $a[1];
if ( $hash->{READINGS}{state}{VAL} eq "on" ) {
@ -1241,7 +1241,7 @@ sub PHTV_Set($@) {
}
# record
elsif ( $a[1] eq "record" ) {
elsif ( lc($a[1]) eq "record" ) {
Log3 $name, 2, "PHTV set $name " . $a[1];
if ( $hash->{READINGS}{state}{VAL} eq "on" ) {