2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-10 20:19:50 +00:00

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
###
$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";

View File

@ -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($@) {
</h3>
<ul>
Provides global settings for FHEM command <a href="#MSG">msg</a>.<br>
<br>
<ul>
<a name="msgConfigdefine" id="msgConfigdefine"></a> <b>Define</b>
<div style="margin-left: 2em">
<code>define &lt;name&gt; msgConfig</code><br>
</div>
</ul>
<br>
<a name="msgConfigdefine" id="msgConfigdefine"></a> <b>Define</b>
<div style="margin-left: 2em">
<code>define &lt;name&gt; msgConfig</code><br>
</div>
</ul>
=end html
@ -394,13 +412,11 @@ sub msgConfig_Get($@) {
</h3>
<ul>
Stellt globale Einstellungen für das FHEM Kommando <a href="#MSG">msg</a> bereit.<br>
<br>
<ul>
<a name="msgConfigdefine" id="msgConfigdefine"></a> <b>Define</b>
<div style="margin-left: 2em">
<code>define &lt;name&gt; msgConfig</code><br>
</div>
</ul>
<br>
<a name="msgConfigdefine" id="msgConfigdefine"></a> <b>Define</b>
<div style="margin-left: 2em">
<code>define &lt;name&gt; msgConfig</code><br>
</div>
</ul>
=end html_DE