75_MSG,75_msgConfig: new attribute msgType, move cleanReadings from get to set

git-svn-id: https://svn.fhem.de/fhem/trunk@9814 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2015-11-07 20:32:31 +00:00
parent c1b139d3d3
commit c63c9984a2
2 changed files with 42 additions and 26 deletions

View File

@ -177,7 +177,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
### command queue ### command queue
### ###
$types = "text" $types = AttrVal("msgType", $globalDevName, "text")
if ( $types eq "" ); if ( $types eq "" );
my $msgSent = 0; my $msgSent = 0;
my $forwarded = ""; my $forwarded = "";
@ -1823,7 +1823,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
else { else {
Log3 $logDevice, 5, Log3 $logDevice, 5,
"msg $device: $type[$i] route command (fhem): $cmd"; "msg $device: $type[$i] route command (fhem): $cmd";
fhem $cmd; fhem $cmd, 1;
if ( $@ ) { if ( $@ ) {
$error = 1; $error = 1;
$return .= "$gatewayDev: $@\n"; $return .= "$gatewayDev: $@\n";

View File

@ -48,7 +48,7 @@ sub msgConfig_Initialize($) {
my ($hash) = @_; my ($hash) = @_;
$hash->{DefFn} = "msgConfig_Define"; $hash->{DefFn} = "msgConfig_Define";
# $hash->{SetFn} = "msgConfig_Set"; $hash->{SetFn} = "msgConfig_Set";
$hash->{GetFn} = "msgConfig_Get"; $hash->{GetFn} = "msgConfig_Get";
$hash->{UndefFn} = "msgConfig_Undefine"; $hash->{UndefFn} = "msgConfig_Undefine";
@ -114,6 +114,7 @@ sub msgConfig_Initialize($) {
msgTitleText msgTitleText
msgTitleTextHigh msgTitleTextHigh
msgTitleTextLow msgTitleTextLow
msgType
); );
use warnings 'qw'; use warnings 'qw';
@ -179,6 +180,32 @@ sub msgConfig_Undefine($$) {
return undef; 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($@) { sub msgConfig_Get($@) {
my ( $hash, @a ) = @_; my ( $hash, @a ) = @_;
@ -192,15 +219,8 @@ sub msgConfig_Get($@) {
$what = $a[1]; $what = $a[1];
# cleanReadings
if ( lc($what) eq "cleanreadings" ) {
my $device = defined($a[2]) ? $a[2] : ".*";
return fhem ("deletereading $device fhemMsg.*");
}
# routeCmd # routeCmd
elsif ( lc($what) eq "routecmd" ) { if ( lc($what) eq "routecmd" ) {
my $return = ""; my $return = "";
my $msgTypesReq = defined($a[2]) ? lc($a[2]) : join( ',', @msgTypes ); my $msgTypesReq = defined($a[2]) ? lc($a[2]) : join( ',', @msgTypes );
my $devicesReq = defined($a[3]) ? $a[3] : $name; my $devicesReq = defined($a[3]) ? $a[3] : $name;
@ -355,7 +375,7 @@ sub msgConfig_Get($@) {
else { else {
return 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";
} }
} }
@ -374,13 +394,11 @@ sub msgConfig_Get($@) {
<ul> <ul>
Provides global settings for FHEM command <a href="#MSG">msg</a>.<br> Provides global settings for FHEM command <a href="#MSG">msg</a>.<br>
<br> <br>
<ul>
<a name="msgConfigdefine" id="msgConfigdefine"></a> <b>Define</b> <a name="msgConfigdefine" id="msgConfigdefine"></a> <b>Define</b>
<div style="margin-left: 2em"> <div style="margin-left: 2em">
<code>define &lt;name&gt; msgConfig</code><br> <code>define &lt;name&gt; msgConfig</code><br>
</div> </div>
</ul> </ul>
</ul>
=end html =end html
@ -395,13 +413,11 @@ sub msgConfig_Get($@) {
<ul> <ul>
Stellt globale Einstellungen für das FHEM Kommando <a href="#MSG">msg</a> bereit.<br> Stellt globale Einstellungen für das FHEM Kommando <a href="#MSG">msg</a> bereit.<br>
<br> <br>
<ul>
<a name="msgConfigdefine" id="msgConfigdefine"></a> <b>Define</b> <a name="msgConfigdefine" id="msgConfigdefine"></a> <b>Define</b>
<div style="margin-left: 2em"> <div style="margin-left: 2em">
<code>define &lt;name&gt; msgConfig</code><br> <code>define &lt;name&gt; msgConfig</code><br>
</div> </div>
</ul> </ul>
</ul>
=end html_DE =end html_DE