mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-08 05:15:10 +00:00
RESIDENTS, ROOMMATE, GUEST, ENIGMA2, ONKYO_AVR, PHTV: ? return value depening on set-user in allowedCommands of FHEMWEB instance
git-svn-id: https://svn.fhem.de/fhem/trunk@8266 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
2e48c37976
commit
4568c2f6dc
@ -267,6 +267,13 @@ sub RESIDENTS_Set($@) {
|
||||
|
||||
return "No Argument given" if ( !defined( $a[1] ) );
|
||||
|
||||
# depending on current FHEMWEB instance's allowedCommands,
|
||||
# restrict set commands if there is "set-user" in it
|
||||
my $adminMode = 1;
|
||||
my $FWallowedCommands = AttrVal( $FW_wname, "allowedCommands", 0 );
|
||||
$adminMode = 0
|
||||
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ );
|
||||
|
||||
# states
|
||||
my $states = (
|
||||
defined( $attr{$name}{rgr_states} ) ? $attr{$name}{rgr_states}
|
||||
@ -280,12 +287,13 @@ sub RESIDENTS_Set($@) {
|
||||
$states = $state . "," . $states
|
||||
if ( $state ne "initialized" && $states !~ /$state/ );
|
||||
|
||||
my $usage =
|
||||
"Unknown argument " . $a[1] . ", choose one of addRoommate addGuest";
|
||||
$usage .= " state:$states";
|
||||
$usage .= " removeRoommate:" . $roommates if ( $roommates ne "" );
|
||||
$usage .= " removeGuest:" . $guests if ( $guests ne "" );
|
||||
$usage .= " create:wakeuptimer";
|
||||
my $usage = "Unknown argument " . $a[1] . ", choose one of state:$states";
|
||||
if ($adminMode) {
|
||||
$usage .= " addRoommate addGuest";
|
||||
$usage .= " removeRoommate:" . $roommates if ( $roommates ne "" );
|
||||
$usage .= " removeGuest:" . $guests if ( $guests ne "" );
|
||||
$usage .= " create:wakeuptimer";
|
||||
}
|
||||
|
||||
# states
|
||||
if ( $a[1] eq "state"
|
||||
|
@ -285,6 +285,13 @@ sub GUEST_Set($@) {
|
||||
|
||||
return "No Argument given" if ( !defined( $a[1] ) );
|
||||
|
||||
# depending on current FHEMWEB instance's allowedCommands,
|
||||
# restrict set commands if there is "set-user" in it
|
||||
my $adminMode = 1;
|
||||
my $FWallowedCommands = AttrVal( $FW_wname, "allowedCommands", 0 );
|
||||
$adminMode = 0
|
||||
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ );
|
||||
|
||||
# states
|
||||
my $states = (
|
||||
defined( $attr{$name}{rg_states} ) ? $attr{$name}{rg_states}
|
||||
@ -323,13 +330,14 @@ sub GUEST_Set($@) {
|
||||
}
|
||||
$locations =~ s/ /,/g;
|
||||
|
||||
my $usage = "Unknown argument " . $a[1] . ", choose one of";
|
||||
$usage .= " state:$states";
|
||||
my $usage = "Unknown argument " . $a[1] . ", choose one of state:$states";
|
||||
$usage .= " mood:$moods";
|
||||
$usage .= " location$locations";
|
||||
$usage .= " create:wakeuptimer";
|
||||
if ($adminMode) {
|
||||
$usage .= " create:wakeuptimer";
|
||||
|
||||
# $usage .= " compactMode:noArg largeMode:noArg";
|
||||
# $usage .= " compactMode:noArg largeMode:noArg";
|
||||
}
|
||||
|
||||
# silentSet
|
||||
if ( $a[1] eq "silentSet" ) {
|
||||
|
@ -290,6 +290,13 @@ sub ROOMMATE_Set($@) {
|
||||
|
||||
return "No Argument given" if ( !defined( $a[1] ) );
|
||||
|
||||
# depending on current FHEMWEB instance's allowedCommands,
|
||||
# restrict set commands if there is "set-user" in it
|
||||
my $adminMode = 1;
|
||||
my $FWallowedCommands = AttrVal( $FW_wname, "allowedCommands", 0 );
|
||||
$adminMode = 0
|
||||
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ );
|
||||
|
||||
# states
|
||||
my $states = (
|
||||
defined( $attr{$name}{rr_states} ) ? $attr{$name}{rr_states}
|
||||
@ -328,13 +335,14 @@ sub ROOMMATE_Set($@) {
|
||||
}
|
||||
$locations =~ s/ /,/g;
|
||||
|
||||
my $usage = "Unknown argument " . $a[1] . ", choose one of";
|
||||
$usage .= " state:$states";
|
||||
my $usage = "Unknown argument " . $a[1] . ", choose one of state:$states";
|
||||
$usage .= " mood:$moods";
|
||||
$usage .= " location$locations";
|
||||
$usage .= " create:wakeuptimer";
|
||||
if ($adminMode) {
|
||||
$usage .= " create:wakeuptimer";
|
||||
|
||||
# $usage .= " compactMode:noArg largeMode:noArg";
|
||||
# $usage .= " compactMode:noArg largeMode:noArg";
|
||||
}
|
||||
|
||||
# silentSet
|
||||
if ( $a[1] eq "silentSet" ) {
|
||||
|
@ -210,6 +210,13 @@ sub ENIGMA2_Set($@) {
|
||||
|
||||
return "No Argument given" if ( !defined( $a[1] ) );
|
||||
|
||||
# depending on current FHEMWEB instance's allowedCommands,
|
||||
# restrict set commands if there is "set-user" in it
|
||||
my $adminMode = 1;
|
||||
my $FWallowedCommands = AttrVal( $FW_wname, "allowedCommands", 0 );
|
||||
$adminMode = 0
|
||||
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ );
|
||||
|
||||
# load channel list
|
||||
if (
|
||||
defined($input)
|
||||
@ -233,7 +240,7 @@ sub ENIGMA2_Set($@) {
|
||||
my $usage =
|
||||
"Unknown argument "
|
||||
. $a[1]
|
||||
. ", choose one of statusRequest:noArg toggle:noArg on:noArg off:noArg reboot:noArg restartGui:noArg shutdown:noArg volume:slider,0,1,100 volumeUp:noArg volumeDown:noArg msg remoteControl channelUp:noArg channelDown:noArg play:noArg pause:noArg stop:noArg record:noArg showText channel:"
|
||||
. ", choose one of toggle:noArg on:noArg off:noArg volume:slider,0,1,100 volumeUp:noArg volumeDown:noArg msg remoteControl channelUp:noArg channelDown:noArg play:noArg pause:noArg stop:noArg record:noArg showText channel:"
|
||||
. $channels;
|
||||
$usage .= " mute:-,on,off"
|
||||
if ( defined( $hash->{READINGS}{mute}{VAL} )
|
||||
@ -248,6 +255,13 @@ sub ENIGMA2_Set($@) {
|
||||
if ( defined( $hash->{READINGS}{input}{VAL} )
|
||||
&& $hash->{READINGS}{input}{VAL} ne "-" );
|
||||
|
||||
if ($adminMode) {
|
||||
$usage .= " statusRequest:noArg";
|
||||
$usage .= " reboot:noArg";
|
||||
$usage .= " restartGui:noArg";
|
||||
$usage .= " shutdown:noArg";
|
||||
}
|
||||
|
||||
my $cmd = '';
|
||||
my $result;
|
||||
|
||||
|
@ -607,6 +607,13 @@ sub ONKYO_AVR_Set($@) {
|
||||
|
||||
return "No argument given to ONKYO_AVR_Set" if ( !defined( $a[1] ) );
|
||||
|
||||
# depending on current FHEMWEB instance's allowedCommands,
|
||||
# restrict set commands if there is "set-user" in it
|
||||
my $adminMode = 1;
|
||||
my $FWallowedCommands = AttrVal( $FW_wname, "allowedCommands", 0 );
|
||||
$adminMode = 0
|
||||
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ );
|
||||
|
||||
# Input alias handling
|
||||
if ( defined( $attr{$name}{inputs} ) && $attr{$name}{inputs} ne "" ) {
|
||||
my @inputs = split( ':', $attr{$name}{inputs} );
|
||||
@ -676,12 +683,17 @@ sub ONKYO_AVR_Set($@) {
|
||||
my $usage =
|
||||
"Unknown argument '"
|
||||
. $a[1]
|
||||
. "', choose one of statusRequest:noArg toggle:noArg on:noArg off:noArg volume:slider,0,1,100 volumeUp:noArg volumeDown:noArg remoteControl input:"
|
||||
. "', choose one of toggle:noArg on:noArg off:noArg volume:slider,0,1,100 volumeUp:noArg volumeDown:noArg input:"
|
||||
. $inputs_txt;
|
||||
$usage .= " sleep:off,5,10,15,30,60,90" if ( $zone eq "main" );
|
||||
$usage .= " mute:off,on" if ( $state eq "on" );
|
||||
$usage .= " mute:,-" if ( $state ne "on" );
|
||||
|
||||
if ($adminMode) {
|
||||
$usage .= " statusRequest:noArg";
|
||||
$usage .= " remoteControl:noArg";
|
||||
}
|
||||
|
||||
my $cmd = '';
|
||||
my $result;
|
||||
|
||||
@ -693,14 +705,14 @@ sub ONKYO_AVR_Set($@) {
|
||||
readingsBeginUpdate($hash);
|
||||
|
||||
# statusRequest
|
||||
if ( lc($a[1]) eq "statusrequest" ) {
|
||||
if ( lc( $a[1] ) eq "statusrequest" ) {
|
||||
Log3 $name, 3, "ONKYO_AVR set $name " . $a[1];
|
||||
delete $hash->{helper}{receiver} if ( $state ne "absent" );
|
||||
ONKYO_AVR_GetStatus( $hash, 1 ) if ( !defined( $a[2] ) );
|
||||
}
|
||||
|
||||
# toggle
|
||||
elsif ( lc($a[1]) eq "toggle" ) {
|
||||
elsif ( lc( $a[1] ) eq "toggle" ) {
|
||||
Log3 $name, 3, "ONKYO_AVR set $name " . $a[1];
|
||||
|
||||
if ( $hash->{READINGS}{power}{VAL} eq "off" ) {
|
||||
@ -712,7 +724,7 @@ sub ONKYO_AVR_Set($@) {
|
||||
}
|
||||
|
||||
# on
|
||||
elsif ( lc($a[1]) eq "on" ) {
|
||||
elsif ( lc( $a[1] ) eq "on" ) {
|
||||
Log3 $name, 3, "ONKYO_AVR set $name " . $a[1];
|
||||
|
||||
if ( $hash->{READINGS}{state}{VAL} eq "absent" ) {
|
||||
@ -738,7 +750,7 @@ sub ONKYO_AVR_Set($@) {
|
||||
}
|
||||
|
||||
# off
|
||||
elsif ( lc($a[1]) eq "off" ) {
|
||||
elsif ( lc( $a[1] ) eq "off" ) {
|
||||
Log3 $name, 3, "ONKYO_AVR set $name " . $a[1];
|
||||
|
||||
if ( $hash->{READINGS}{state}{VAL} eq "absent" ) {
|
||||
@ -764,7 +776,7 @@ sub ONKYO_AVR_Set($@) {
|
||||
}
|
||||
|
||||
# sleep
|
||||
elsif ( lc($a[1]) eq "sleep" && $zone eq "main" ) {
|
||||
elsif ( lc( $a[1] ) eq "sleep" && $zone eq "main" ) {
|
||||
if ( !defined( $a[2] ) ) {
|
||||
$return = "No argument given, choose one of minutes off";
|
||||
}
|
||||
@ -802,7 +814,7 @@ sub ONKYO_AVR_Set($@) {
|
||||
}
|
||||
|
||||
# mute
|
||||
elsif ( lc($a[1]) eq "mute" || lc($a[1]) eq "mutet" ) {
|
||||
elsif ( lc( $a[1] ) eq "mute" || lc( $a[1] ) eq "mutet" ) {
|
||||
if ( defined( $a[2] ) ) {
|
||||
Log3 $name, 3, "ONKYO_AVR set $name " . $a[1] . " " . $a[2];
|
||||
}
|
||||
@ -814,10 +826,10 @@ sub ONKYO_AVR_Set($@) {
|
||||
if ( !defined( $a[2] ) || $a[2] eq "toggle" ) {
|
||||
$result = ONKYO_AVR_SendCommand( $hash, "mute", "toggle" );
|
||||
}
|
||||
elsif ( lc($a[2]) eq "off" ) {
|
||||
elsif ( lc( $a[2] ) eq "off" ) {
|
||||
$result = ONKYO_AVR_SendCommand( $hash, "mute", "off" );
|
||||
}
|
||||
elsif ( lc($a[2]) eq "on" ) {
|
||||
elsif ( lc( $a[2] ) eq "on" ) {
|
||||
$result = ONKYO_AVR_SendCommand( $hash, "mute", "on" );
|
||||
}
|
||||
else {
|
||||
@ -838,7 +850,7 @@ sub ONKYO_AVR_Set($@) {
|
||||
}
|
||||
|
||||
# volume
|
||||
elsif ( lc($a[1]) eq "volume" ) {
|
||||
elsif ( lc( $a[1] ) eq "volume" ) {
|
||||
if ( !defined( $a[2] ) ) {
|
||||
$return = "No argument given";
|
||||
}
|
||||
@ -879,11 +891,11 @@ sub ONKYO_AVR_Set($@) {
|
||||
}
|
||||
|
||||
# volumeUp/volumeDown
|
||||
elsif ( lc($a[1]) =~ /^(volumeup|volumedown)$/ ) {
|
||||
elsif ( lc( $a[1] ) =~ /^(volumeup|volumedown)$/ ) {
|
||||
Log3 $name, 3, "ONKYO_AVR set $name " . $a[1];
|
||||
|
||||
if ( $hash->{READINGS}{state}{VAL} eq "on" ) {
|
||||
if ( lc($a[1]) eq "volumeup" ) {
|
||||
if ( lc( $a[1] ) eq "volumeup" ) {
|
||||
$result = ONKYO_AVR_SendCommand( $hash, "volume", "level-up" );
|
||||
}
|
||||
else {
|
||||
@ -905,7 +917,7 @@ sub ONKYO_AVR_Set($@) {
|
||||
}
|
||||
|
||||
# input
|
||||
elsif ( lc($a[1]) eq "input" ) {
|
||||
elsif ( lc( $a[1] ) eq "input" ) {
|
||||
if ( !defined( $a[2] ) ) {
|
||||
$return = "No input given";
|
||||
}
|
||||
@ -935,7 +947,7 @@ sub ONKYO_AVR_Set($@) {
|
||||
}
|
||||
|
||||
# remoteControl
|
||||
elsif ( lc($a[1]) eq "remotecontrol" ) {
|
||||
elsif ( lc( $a[1] ) eq "remotecontrol" ) {
|
||||
|
||||
# Reading commands for zone from HASH table
|
||||
my $commands = ONKYOdb::ONKYO_GetRemotecontrolCommand($zone);
|
||||
|
@ -281,6 +281,13 @@ sub PHTV_Set($@) {
|
||||
|
||||
return "No Argument given" if ( !defined( $a[1] ) );
|
||||
|
||||
# depending on current FHEMWEB instance's allowedCommands,
|
||||
# restrict set commands if there is "set-user" in it
|
||||
my $adminMode = 1;
|
||||
my $FWallowedCommands = AttrVal( $FW_wname, "allowedCommands", 0 );
|
||||
$adminMode = 0
|
||||
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ );
|
||||
|
||||
# Input alias handling
|
||||
if ( defined( $attr{$name}{inputs} ) && $attr{$name}{inputs} ne "" ) {
|
||||
my @inputs = split( ':', $attr{$name}{inputs} );
|
||||
@ -334,7 +341,7 @@ sub PHTV_Set($@) {
|
||||
my $usage =
|
||||
"Unknown argument "
|
||||
. $a[1]
|
||||
. ", choose one of statusRequest:noArg toggle:noArg on:noArg off:noArg play:noArg pause:noArg stop:noArg record:noArg volume:slider,1,1,100 volumeUp:noArg volumeDown:noArg channelUp:noArg channelDown:noArg remoteControl ambiHue:off,on ambiMode:internal,manual,expert ambiPreset:rainbow,rainbow-pastel rgb:colorpicker,rgb hue:slider,0,1,65534 sat:slider,0,1,255 pct:slider,0,1,100 bri:slider,0,1,255";
|
||||
. ", choose one of toggle:noArg on:noArg off:noArg play:noArg pause:noArg stop:noArg record:noArg volume:slider,1,1,100 volumeUp:noArg volumeDown:noArg channelUp:noArg channelDown:noArg remoteControl ambiHue:off,on ambiMode:internal,manual,expert ambiPreset:rainbow,rainbow-pastel rgb:colorpicker,rgb hue:slider,0,1,65534 sat:slider,0,1,255 pct:slider,0,1,100 bri:slider,0,1,255";
|
||||
$usage .=
|
||||
" volumeStraight:slider,"
|
||||
. $hash->{helper}{audio}{min} . ",1,"
|
||||
@ -350,6 +357,10 @@ sub PHTV_Set($@) {
|
||||
$usage .= " input:" . $inputs_txt if ( $inputs_txt ne "" );
|
||||
$usage .= " channel:$channels" if ( $channels ne "" );
|
||||
|
||||
if ($adminMode) {
|
||||
$usage .= " statusRequest:noArg";
|
||||
}
|
||||
|
||||
my $cmd = '';
|
||||
my $result;
|
||||
|
||||
@ -366,7 +377,7 @@ sub PHTV_Set($@) {
|
||||
}
|
||||
|
||||
# toggle
|
||||
elsif ( lc($a[1]) eq "toggle" ) {
|
||||
elsif ( lc( $a[1] ) eq "toggle" ) {
|
||||
Log3 $name, 3, "PHTV set $name " . $a[1];
|
||||
|
||||
if ( $hash->{READINGS}{state}{VAL} ne "on" ) {
|
||||
@ -380,7 +391,7 @@ sub PHTV_Set($@) {
|
||||
|
||||
# off
|
||||
# on
|
||||
elsif ( lc($a[1]) eq "off" || lc($a[1]) eq "on" ) {
|
||||
elsif ( lc( $a[1] ) eq "off" || lc( $a[1] ) eq "on" ) {
|
||||
Log3 $name, 3, "PHTV set $name " . $a[1];
|
||||
|
||||
if ( $hash->{READINGS}{state}{VAL} ne "absent" ) {
|
||||
@ -399,7 +410,7 @@ sub PHTV_Set($@) {
|
||||
return "No argument given" if ( !defined( $a[2] ) );
|
||||
|
||||
if ( $hash->{READINGS}{state}{VAL} eq "on" ) {
|
||||
if ( lc($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 +425,7 @@ sub PHTV_Set($@) {
|
||||
|
||||
PHTV_SendCommand( $hash, "ambilight/processed", undef, "init" );
|
||||
}
|
||||
elsif ( lc($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 +445,15 @@ sub PHTV_Set($@) {
|
||||
return "No argument given" if ( !defined( $a[2] ) );
|
||||
|
||||
if ( $hash->{READINGS}{state}{VAL} ne "absent" ) {
|
||||
if ( lc($a[2]) eq "internal" || lc($a[2]) eq "manual" || lc($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 ( lc($a[2]) eq "internal" );
|
||||
if ( lc( $a[2] ) eq "internal" );
|
||||
}
|
||||
else {
|
||||
return
|
||||
@ -464,7 +477,7 @@ sub PHTV_Set($@) {
|
||||
my $json;
|
||||
|
||||
# rainbow
|
||||
if ( lc($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 +587,7 @@ sub PHTV_Set($@) {
|
||||
}
|
||||
|
||||
# rainbow-pastel
|
||||
elsif ( lc($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 +623,7 @@ sub PHTV_Set($@) {
|
||||
}
|
||||
|
||||
# rgb
|
||||
elsif ( lc($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 +774,7 @@ sub PHTV_Set($@) {
|
||||
}
|
||||
|
||||
# hue
|
||||
elsif ( lc($a[1]) eq "hue" ) {
|
||||
elsif ( lc( $a[1] ) eq "hue" ) {
|
||||
Log3 $name, 3, "PHTV set $name " . $a[1] . " " . $a[2];
|
||||
|
||||
return "No argument given" if ( !defined( $a[2] ) );
|
||||
@ -798,7 +811,7 @@ sub PHTV_Set($@) {
|
||||
}
|
||||
|
||||
# sat
|
||||
elsif ( lc($a[1]) eq "sat" ) {
|
||||
elsif ( lc( $a[1] ) eq "sat" ) {
|
||||
Log3 $name, 3, "PHTV set $name " . $a[1] . " " . $a[2];
|
||||
|
||||
return "No argument given" if ( !defined( $a[2] ) );
|
||||
@ -836,7 +849,7 @@ sub PHTV_Set($@) {
|
||||
}
|
||||
|
||||
# bri
|
||||
elsif ( lc($a[1]) eq "bri" ) {
|
||||
elsif ( lc( $a[1] ) eq "bri" ) {
|
||||
Log3 $name, 3, "PHTV set $name " . $a[1] . " " . $a[2];
|
||||
|
||||
return "No argument given" if ( !defined( $a[2] ) );
|
||||
@ -874,7 +887,7 @@ sub PHTV_Set($@) {
|
||||
}
|
||||
|
||||
# pct
|
||||
elsif ( lc($a[1]) eq "pct" ) {
|
||||
elsif ( lc( $a[1] ) eq "pct" ) {
|
||||
Log3 $name, 3, "PHTV set $name " . $a[1] . " " . $a[2];
|
||||
|
||||
return "No argument given" if ( !defined( $a[2] ) );
|
||||
@ -914,7 +927,7 @@ sub PHTV_Set($@) {
|
||||
}
|
||||
|
||||
# volume
|
||||
elsif ( lc($a[1]) eq "volume" ) {
|
||||
elsif ( lc( $a[1] ) eq "volume" ) {
|
||||
Log3 $name, 3, "PHTV set $name " . $a[1] . " " . $a[2];
|
||||
|
||||
return "No argument given" if ( !defined( $a[2] ) );
|
||||
@ -1010,7 +1023,7 @@ sub PHTV_Set($@) {
|
||||
}
|
||||
|
||||
# mute
|
||||
elsif ( lc($a[1]) eq "mute" || lc($a[1]) eq "mutet" ) {
|
||||
elsif ( lc( $a[1] ) eq "mute" || lc( $a[1] ) eq "mutet" ) {
|
||||
if ( defined( $a[2] ) ) {
|
||||
Log3 $name, 3, "PHTV set $name " . $a[1] . " " . $a[2];
|
||||
}
|
||||
@ -1029,13 +1042,13 @@ sub PHTV_Set($@) {
|
||||
readingsSingleUpdate( $hash, "mute", "off", 1 );
|
||||
}
|
||||
}
|
||||
elsif ( lc($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 ( lc($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 +1122,7 @@ sub PHTV_Set($@) {
|
||||
}
|
||||
|
||||
# channel
|
||||
elsif ( lc($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 +1185,7 @@ sub PHTV_Set($@) {
|
||||
}
|
||||
|
||||
# input
|
||||
elsif ( lc($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 +1228,7 @@ sub PHTV_Set($@) {
|
||||
}
|
||||
|
||||
# play / pause
|
||||
elsif ( lc($a[1]) =~ /^(play|pause)$/ ) {
|
||||
elsif ( lc( $a[1] ) =~ /^(play|pause)$/ ) {
|
||||
Log3 $name, 3, "PHTV set $name " . $a[1];
|
||||
|
||||
if ( $hash->{READINGS}{state}{VAL} eq "on" ) {
|
||||
@ -1228,7 +1241,7 @@ sub PHTV_Set($@) {
|
||||
}
|
||||
|
||||
# stop
|
||||
elsif ( lc($a[1]) eq "stop" ) {
|
||||
elsif ( lc( $a[1] ) eq "stop" ) {
|
||||
Log3 $name, 3, "PHTV set $name " . $a[1];
|
||||
|
||||
if ( $hash->{READINGS}{state}{VAL} eq "on" ) {
|
||||
@ -1241,7 +1254,7 @@ sub PHTV_Set($@) {
|
||||
}
|
||||
|
||||
# record
|
||||
elsif ( lc($a[1]) eq "record" ) {
|
||||
elsif ( lc( $a[1] ) eq "record" ) {
|
||||
Log3 $name, 3, "PHTV set $name " . $a[1];
|
||||
|
||||
if ( $hash->{READINGS}{state}{VAL} eq "on" ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user