diff --git a/fhem/FHEM/75_MSG.pm b/fhem/FHEM/75_MSG.pm index 4024ad30f..fa5c23ead 100755 --- a/fhem/FHEM/75_MSG.pm +++ b/fhem/FHEM/75_MSG.pm @@ -177,7 +177,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+// ### command queue ### - $types = "text" + $types = AttrVal("msgType", $globalDevName, "text") if ( $types eq "" ); my $msgSent = 0; my $forwarded = ""; @@ -1823,7 +1823,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+// else { Log3 $logDevice, 5, "msg $device: $type[$i] route command (fhem): $cmd"; - fhem $cmd; + fhem $cmd, 1; if ( $@ ) { $error = 1; $return .= "$gatewayDev: $@\n"; diff --git a/fhem/FHEM/75_msgConfig.pm b/fhem/FHEM/75_msgConfig.pm index 4c9c7f843..5b5626d23 100755 --- a/fhem/FHEM/75_msgConfig.pm +++ b/fhem/FHEM/75_msgConfig.pm @@ -48,7 +48,7 @@ sub msgConfig_Initialize($) { my ($hash) = @_; $hash->{DefFn} = "msgConfig_Define"; -# $hash->{SetFn} = "msgConfig_Set"; + $hash->{SetFn} = "msgConfig_Set"; $hash->{GetFn} = "msgConfig_Get"; $hash->{UndefFn} = "msgConfig_Undefine"; @@ -114,6 +114,7 @@ sub msgConfig_Initialize($) { msgTitleText msgTitleTextHigh msgTitleTextLow + msgType ); use warnings 'qw'; @@ -179,6 +180,32 @@ sub msgConfig_Undefine($$) { return undef; } +################################### +sub msgConfig_Set($@) { + my ( $hash, @a ) = @_; + my $name = $hash->{NAME}; + my $what = ""; + + Log3 $name, 5, "msgConfig $name: called function msgConfig_Set()"; + + my @msgTypes = + ( "audio", "light", "mail", "push", "screen" ); + + $what = $a[1]; + + # cleanReadings + if ( lc($what) eq "cleanreadings" ) { + my $device = defined($a[2]) ? $a[2] : ".*"; + + return fhem ("deletereading $device fhemMsg.*", 1); + } + + else { + return +"Unknown argument $what, choose one of cleanReadings"; + } +} + ################################### sub msgConfig_Get($@) { my ( $hash, @a ) = @_; @@ -192,15 +219,8 @@ sub msgConfig_Get($@) { $what = $a[1]; - # cleanReadings - if ( lc($what) eq "cleanreadings" ) { - my $device = defined($a[2]) ? $a[2] : ".*"; - - return fhem ("deletereading $device fhemMsg.*"); - } - # routeCmd - elsif ( lc($what) eq "routecmd" ) { + if ( lc($what) eq "routecmd" ) { my $return = ""; my $msgTypesReq = defined($a[2]) ? lc($a[2]) : join( ',', @msgTypes ); my $devicesReq = defined($a[3]) ? $a[3] : $name; @@ -355,7 +375,7 @@ sub msgConfig_Get($@) { else { return -"Unknown argument $what, choose one of routeCmd:,audio,light,mail,push,screen cleanReadings"; +"Unknown argument $what, choose one of routeCmd:,audio,light,mail,push,screen"; } } @@ -373,13 +393,11 @@ sub msgConfig_Get($@) { =end html @@ -394,13 +412,11 @@ sub msgConfig_Get($@) { =end html_DE