2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 08:11:44 +00:00

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

git-svn-id: https://svn.fhem.de/fhem/trunk@7729 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2015-01-26 09:34:57 +00:00
parent 7a88b57850
commit 4e3f133a4e

View File

@ -252,7 +252,7 @@ sub ENIGMA2_Set($@) {
my $result; my $result;
# statusRequest # statusRequest
if ( $a[1] eq "statusRequest" ) { if ( lc($a[1]) eq "statusrequest" ) {
Log3 $name, 2, "ENIGMA2 set $name " . $a[1]; Log3 $name, 2, "ENIGMA2 set $name " . $a[1];
if ( $state ne "absent" ) { if ( $state ne "absent" ) {
@ -266,7 +266,7 @@ sub ENIGMA2_Set($@) {
} }
# toggle # toggle
elsif ( $a[1] eq "toggle" ) { elsif ( lc($a[1]) eq "toggle" ) {
Log3 $name, 2, "ENIGMA2 set $name " . $a[1]; Log3 $name, 2, "ENIGMA2 set $name " . $a[1];
if ( $hash->{READINGS}{state}{VAL} ne "on" ) { if ( $hash->{READINGS}{state}{VAL} ne "on" ) {
@ -279,7 +279,7 @@ sub ENIGMA2_Set($@) {
} }
# shutdown # shutdown
elsif ( $a[1] eq "shutdown" ) { elsif ( lc($a[1]) eq "shutdown" ) {
Log3 $name, 2, "ENIGMA2 set $name " . $a[1]; Log3 $name, 2, "ENIGMA2 set $name " . $a[1];
return "Recordings running" return "Recordings running"
@ -296,7 +296,7 @@ sub ENIGMA2_Set($@) {
} }
# reboot # reboot
elsif ( $a[1] eq "reboot" ) { elsif ( lc($a[1]) eq "reboot" ) {
Log3 $name, 2, "ENIGMA2 set $name " . $a[1]; Log3 $name, 2, "ENIGMA2 set $name " . $a[1];
return "Recordings running" return "Recordings running"
@ -330,7 +330,7 @@ sub ENIGMA2_Set($@) {
} }
# on # on
elsif ( $a[1] eq "on" ) { elsif ( lc($a[1]) eq "on" ) {
if ( $hash->{READINGS}{state}{VAL} eq "absent" ) { if ( $hash->{READINGS}{state}{VAL} eq "absent" ) {
Log3 $name, 2, "ENIGMA2 set $name " . $a[1] . " (wakeup)"; Log3 $name, 2, "ENIGMA2 set $name " . $a[1] . " (wakeup)";
@ -359,7 +359,7 @@ sub ENIGMA2_Set($@) {
} }
# off # off
elsif ( $a[1] eq "off" ) { elsif ( lc($a[1]) eq "off" ) {
Log3 $name, 2, "ENIGMA2 set $name " . $a[1]; Log3 $name, 2, "ENIGMA2 set $name " . $a[1];
if ( $hash->{READINGS}{state}{VAL} ne "absent" ) { if ( $hash->{READINGS}{state}{VAL} ne "absent" ) {
@ -372,7 +372,7 @@ sub ENIGMA2_Set($@) {
} }
# volume # volume
elsif ( $a[1] eq "volume" ) { elsif ( lc($a[1]) eq "volume" ) {
Log3 $name, 2, "ENIGMA2 set $name " . $a[1] . " " . $a[2]; Log3 $name, 2, "ENIGMA2 set $name " . $a[1] . " " . $a[2];
return "No argument given" if ( !defined( $a[2] ) ); return "No argument given" if ( !defined( $a[2] ) );
@ -394,11 +394,11 @@ sub ENIGMA2_Set($@) {
} }
# volumeUp/volumeDown # volumeUp/volumeDown
elsif ( $a[1] =~ /^(volumeUp|volumeDown)$/ ) { elsif ( lc($a[1]) =~ /^(volumeup|volumedown)$/ ) {
Log3 $name, 2, "ENIGMA2 set $name " . $a[1]; Log3 $name, 2, "ENIGMA2 set $name " . $a[1];
if ( $hash->{READINGS}{state}{VAL} eq "on" ) { if ( $hash->{READINGS}{state}{VAL} eq "on" ) {
if ( $a[1] eq "volumeUp" ) { if ( lc($a[1]) eq "volumeup" ) {
$cmd = "set=up"; $cmd = "set=up";
} }
else { else {
@ -412,7 +412,7 @@ sub ENIGMA2_Set($@) {
} }
# mute # mute
elsif ( $a[1] eq "mute" ) { elsif ( lc($a[1]) eq "mute" || lc($a[1]) eq "mutet" ) {
if ( defined( $a[2] ) ) { if ( defined( $a[2] ) ) {
Log3 $name, 2, "ENIGMA2 set $name " . $a[1] . " " . $a[2]; Log3 $name, 2, "ENIGMA2 set $name " . $a[1] . " " . $a[2];
} }
@ -424,12 +424,12 @@ sub ENIGMA2_Set($@) {
if ( !defined( $a[2] ) || $a[2] eq "toggle" ) { if ( !defined( $a[2] ) || $a[2] eq "toggle" ) {
$cmd = "set=mute"; $cmd = "set=mute";
} }
elsif ( $a[2] eq "off" ) { elsif ( lc($a[2]) eq "off" ) {
if ( $hash->{READINGS}{mute}{VAL} ne "off" ) { if ( $hash->{READINGS}{mute}{VAL} ne "off" ) {
$cmd = "set=mute"; $cmd = "set=mute";
} }
} }
elsif ( $a[2] eq "on" ) { elsif ( lc($a[2]) eq "on" ) {
if ( $hash->{READINGS}{mute}{VAL} ne "on" ) { if ( $hash->{READINGS}{mute}{VAL} ne "on" ) {
$cmd = "set=mute"; $cmd = "set=mute";
} }
@ -446,7 +446,7 @@ sub ENIGMA2_Set($@) {
} }
# msg # msg
elsif ( $a[1] eq "msg" ) { elsif ( lc($a[1]) eq "msg" ) {
Log3 $name, 2, "ENIGMA2 set $name " . $a[1] . " " . $a[2]; Log3 $name, 2, "ENIGMA2 set $name " . $a[1] . " " . $a[2];
if ( $hash->{READINGS}{state}{VAL} ne "absent" ) { if ( $hash->{READINGS}{state}{VAL} ne "absent" ) {
@ -479,16 +479,16 @@ sub ENIGMA2_Set($@) {
$i++; $i++;
} }
} }
if ( $a[2] eq "yesno" ) { if ( lc($a[2]) eq "yesno" ) {
$cmd = "type=0&timeout=" . $a[3] . "&text=" . urlEncode($text); $cmd = "type=0&timeout=" . $a[3] . "&text=" . urlEncode($text);
} }
elsif ( $a[2] eq "info" ) { elsif ( lc($a[2]) eq "info" ) {
$cmd = "type=1&timeout=" . $a[3] . "&text=" . urlEncode($text); $cmd = "type=1&timeout=" . $a[3] . "&text=" . urlEncode($text);
} }
elsif ( $a[2] eq "message" ) { elsif ( lc($a[2]) eq "message" ) {
$cmd = "type=2&timeout=" . $a[3] . "&text=" . urlEncode($text); $cmd = "type=2&timeout=" . $a[3] . "&text=" . urlEncode($text);
} }
elsif ( $a[2] eq "attention" ) { elsif ( lc($a[2]) eq "attention" ) {
$cmd = "type=3&timeout=" . $a[3] . "&text=" . urlEncode($text); $cmd = "type=3&timeout=" . $a[3] . "&text=" . urlEncode($text);
} }
else { else {
@ -569,7 +569,7 @@ sub ENIGMA2_Set($@) {
} }
# channel # channel
elsif ( $a[1] eq "channel" ) { elsif ( lc($a[1]) eq "channel" ) {
if ( defined( $a[2] ) if ( defined( $a[2] )
&& $hash->{READINGS}{presence}{VAL} eq "present" && $hash->{READINGS}{presence}{VAL} eq "present"
&& $hash->{READINGS}{state}{VAL} ne "on" ) && $hash->{READINGS}{state}{VAL} ne "on" )
@ -617,11 +617,11 @@ sub ENIGMA2_Set($@) {
} }
# channelUp/channelDown # channelUp/channelDown
elsif ( $a[1] =~ /^(channelUp|channelDown)$/ ) { elsif ( lc($a[1]) =~ /^(channelup|channeldown)$/ ) {
Log3 $name, 2, "ENIGMA2 set $name " . $a[1]; Log3 $name, 2, "ENIGMA2 set $name " . $a[1];
if ( $hash->{READINGS}{state}{VAL} eq "on" ) { if ( $hash->{READINGS}{state}{VAL} eq "on" ) {
if ( $a[1] eq "channelUp" ) { if ( lc($a[1]) eq "channelup" ) {
$cmd = "command=" . ENIGMA2_GetRemotecontrolCommand("RIGHT"); $cmd = "command=" . ENIGMA2_GetRemotecontrolCommand("RIGHT");
} }
else { else {
@ -635,7 +635,7 @@ sub ENIGMA2_Set($@) {
} }
# input # input
elsif ( $a[1] eq "input" ) { elsif ( lc($a[1]) eq "input" ) {
if ( defined( $a[2] ) if ( defined( $a[2] )
&& $hash->{READINGS}{presence}{VAL} eq "present" && $hash->{READINGS}{presence}{VAL} eq "present"
&& $hash->{READINGS}{state}{VAL} ne "on" ) && $hash->{READINGS}{state}{VAL} ne "on" )
@ -650,11 +650,11 @@ sub ENIGMA2_Set($@) {
Log3 $name, 2, "ENIGMA2 set $name " . $a[1] . " " . $a[2]; Log3 $name, 2, "ENIGMA2 set $name " . $a[1] . " " . $a[2];
if ( $hash->{READINGS}{state}{VAL} eq "on" ) { if ( $hash->{READINGS}{state}{VAL} eq "on" ) {
if ( $a[2] eq "tv" || $a[2] eq "TV" ) { if ( lc($a[2]) eq "tv" ) {
$cmd = "command=" . ENIGMA2_GetRemotecontrolCommand("TV"); $cmd = "command=" . ENIGMA2_GetRemotecontrolCommand("TV");
$hash->{helper}{lastInput} = "tv"; $hash->{helper}{lastInput} = "tv";
} }
elsif ( $a[2] eq "radio" || $a[2] eq "RADIO" ) { elsif ( lc($a[2]) eq "radio" ) {
$cmd = "command=" . ENIGMA2_GetRemotecontrolCommand("RADIO"); $cmd = "command=" . ENIGMA2_GetRemotecontrolCommand("RADIO");
$hash->{helper}{lastInput} = "radio"; $hash->{helper}{lastInput} = "radio";
} }
@ -672,7 +672,7 @@ sub ENIGMA2_Set($@) {
} }
# play / pause # play / pause
elsif ( $a[1] =~ /^(play|pause)$/ ) { elsif ( lc($a[1]) =~ /^(play|pause)$/ ) {
Log3 $name, 2, "ENIGMA2 set $name " . $a[1]; Log3 $name, 2, "ENIGMA2 set $name " . $a[1];
if ( $hash->{READINGS}{state}{VAL} eq "on" ) { if ( $hash->{READINGS}{state}{VAL} eq "on" ) {
@ -685,7 +685,7 @@ sub ENIGMA2_Set($@) {
} }
# stop # stop
elsif ( $a[1] eq "stop" ) { elsif ( lc($a[1]) eq "stop" ) {
Log3 $name, 2, "ENIGMA2 set $name " . $a[1]; Log3 $name, 2, "ENIGMA2 set $name " . $a[1];
if ( $hash->{READINGS}{state}{VAL} eq "on" ) { if ( $hash->{READINGS}{state}{VAL} eq "on" ) {
@ -698,7 +698,7 @@ sub ENIGMA2_Set($@) {
} }
# record # record
elsif ( $a[1] eq "record" ) { elsif ( lc($a[1]) eq "record" ) {
Log3 $name, 2, "ENIGMA2 set $name " . $a[1]; Log3 $name, 2, "ENIGMA2 set $name " . $a[1];
if ( $hash->{READINGS}{state}{VAL} eq "on" ) { if ( $hash->{READINGS}{state}{VAL} eq "on" ) {
@ -710,7 +710,7 @@ sub ENIGMA2_Set($@) {
} }
# showText # showText
elsif ( $a[1] eq "showText" ) { elsif ( lc($a[1]) eq "showtext" ) {
Log3 $name, 2, "ENIGMA2 set $name " . $a[1]; Log3 $name, 2, "ENIGMA2 set $name " . $a[1];
if ( $hash->{READINGS}{state}{VAL} ne "absent" ) { if ( $hash->{READINGS}{state}{VAL} ne "absent" ) {