2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

msg: rename 99_msg.pm to 98_msg.pm; initial commit for global configuration device msgConfig

git-svn-id: https://svn.fhem.de/fhem/trunk@9518 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2015-10-18 13:09:15 +00:00
parent 2a67128409
commit f38068d5f4
2 changed files with 302 additions and 144 deletions

222
fhem/contrib/97_msgConfig.pm Executable file
View File

@ -0,0 +1,222 @@
# $Id$
##############################################################################
#
# 97_msgConfig.pm
# Global configuration settings for FHEM msg command.
#
# Copyright by Julian Pawlowski
# e-mail: julian.pawlowski at gmail.com
#
# This file is part of fhem.
#
# Fhem is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Fhem is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with fhem. If not, see <http://www.gnu.org/licenses/>.
#
#
# Version: 1.0.0
#
# Major Version History:
# - 1.0.0 - 2015-10-18
# -- First release
#
##############################################################################
package main;
use strict;
use warnings;
sub msgConfig_Set($@);
sub msgConfig_Define($$);
sub msgConfig_Undefine($$);
###################################
sub msgConfig_Initialize($) {
my ($hash) = @_;
$hash->{DefFn} = "msgConfig_Define";
$hash->{UndefFn} = "msgConfig_Undefine";
# add attributes for configuration
no warnings 'qw';
my @attrList = qw(
msgCmdAudio
msgCmdAudioShort
msgCmdAudioShortPrio
msgCmdLight
msgCmdLightHigh
msgCmdLightLow
msgCmdMail
msgCmdMailHigh
msgCmdMailLow
msgCmdPush
msgCmdPushHigh
msgCmdPushLow
msgCmdScreen
msgCmdScreenHigh
msgCmdScreenLow
msgFwPrioAbsentAudio
msgFwPrioAbsentLight
msgFwPrioAbsentScreen
msgFwPrioEmergencyAudio
msgFwPrioEmergencyLight
msgFwPrioEmergencyPush
msgFwPrioEmergencyScreen
msgFwPrioGoneAudio
msgFwPrioGoneLight
msgFwPrioGoneScreen
msgLocationDevs
msgPriorityAudio:-2,-1,0,1,2
msgPriorityLight:-2,-1,0,1,2
msgPriorityMail:-2,-1,0,1,2
msgPriorityPush:-2,-1,0,1,2
msgPriorityScreen:-2,-1,0,1,2
msgPriorityText:-2,-1,0,1,2
msgResidentsDev
msgSwitcherDev
msgThPrioHigh:-2,-1,0,1,2
msgThPrioNormal:-2,-1,0,1,2
msgThPrioAudioEmergency:-2,-1,0,1,2
msgThPrioAudioHigh:-2,-1,0,1,2
msgThPrioTextEmergency:-2,-1,0,1,2
msgThPrioTextNormal:-2,-1,0,1,2
msgThPrioGwEmergency:-2,-1,0,1,2
msgTitleAudio
msgTitleAudioShort
msgTitleAudioShortPrio
msgTitleLight
msgTitleLightHigh
msgTitleLightLow
msgTitleMail
msgTitleMailHigh
msgTitleMailLow
msgTitlePush
msgTitlePushHigh
msgTitlePushLow
msgTitleScreen
msgTitleScreenHigh
msgTitleScreenLow
msgTitleText
msgTitleTextHigh
msgTitleTextLow
);
use warnings 'qw';
$hash->{AttrList} = join( " ", @attrList ) . " " . $readingFnAttributes;
# add global attributes
foreach (
"msgContactAudio", "msgContactMail", "msgContactPush",
"msgContactScreen", "msgContactLight", "msgRecipient",
"msgRecipientAudio", "msgRecipientMail", "msgRecipientPush",
"msgRecipientScreen", "msgRecipientText", "msgRecipientLight",
)
{
addToAttrList($_);
}
}
###################################
sub msgConfig_Define($$) {
my ( $hash, $def ) = @_;
my @a = split( "[ \t]+", $def, 5 );
return "Usage: define <name> msgConfig"
if ( int(@a) < 2 );
my $name = $a[0];
# set default settings on first define
if ($init_done) {
my $group = AttrVal("global","group","Global");
my $room = AttrVal("global","room","");
my $verbose = AttrVal("global","verbose",3);
$attr{$name}{group} = $group;
$attr{$name}{verbose} = $verbose;
$attr{$name}{room} = $room if ($room ne "");
$attr{$name}{comment} = "FHEM Global Configuration for command 'msg'";
$attr{$name}{stateFormat} = "fhemMsgState";
readingsBeginUpdate($hash);
readingsBulkUpdate( $hash, "fhemMsgState", "initialized" );
readingsEndUpdate( $hash, 1 );
}
return undef;
}
###################################
sub msgConfig_Undefine($$) {
my ( $hash, $name ) = @_;
return undef;
}
1;
=pod
=begin html
<p>
<a name="msgConfig" id="msgConfig"></a>
</p>
<h3>
msgConfig
</h3>
<ul>
<li>Provides global settings to configure FHEM command 'msg'.<br>
<br>
</li>
<li>
<a name="msgConfigdefine" id="msgConfigdefine"></a> <b>Define</b>
<div style="margin-left: 2em">
<code>define &lt;name&gt;</code><br>
<br>
Defines the global msg control device instance. Pleae note there can only be one unique definition of this device type.<br>
</div>
<br>
<b>Usage information</b><br>
<br>
<br>
<b>Integration with Home Automation</b><br>
<br>
<div style="margin-left: 2em">
You might want to have a look to the module family of <a href="#ROOMMATE">ROOMMATE</a>, <a href="#GUEST">GUEST</a> and <a href="#RESIDENTS">RESIDENTS</a> for an easy processing of msgConfig events.
</div>
</li>
</ul>
=end html
=begin html_DE
<p>
<a name="msgConfig" id="msgConfig"></a>
</p>
<h3>
msgConfig
</h3>
<div style="margin-left: 2em">
Eine deutsche Version der Dokumentation ist derzeit nicht vorhanden. Die englische Version ist hier zu finden:
</div>
<div style="margin-left: 2em">
<a href='http://fhem.de/commandref.html#msgConfig'>msgConfig</a>
</div>
=end html_DE
=cut

224
fhem/contrib/99_msg.pm → fhem/contrib/98_msg.pm Normal file → Executable file
View File

@ -1,7 +1,7 @@
# $Id$
##############################################################################
#
# 99_msg.pm
# 98_msg.pm
# Dynamic message and notification routing for FHEM
#
# Copyright by Julian Pawlowski
@ -50,84 +50,6 @@ sub msg_Initialize($$) {
"[<type>] [<\@device>|<e-mail address>] [<priority>] [|<title>|] <message>",
);
$cmds{msg} = \%hash;
# add attributes for configuration
no warnings 'qw';
my @attrList = qw(
msgCmdAudio
msgCmdAudioShort
msgCmdAudioShortPrio
msgCmdLight
msgCmdLightHigh
msgCmdLightLow
msgCmdMail
msgCmdMailHigh
msgCmdMailLow
msgCmdPush
msgCmdPushHigh
msgCmdPushLow
msgCmdScreen
msgCmdScreenHigh
msgCmdScreenLow
msgFwPrioAbsentAudio
msgFwPrioAbsentLight
msgFwPrioAbsentScreen
msgFwPrioEmergencyAudio
msgFwPrioEmergencyLight
msgFwPrioEmergencyPush
msgFwPrioEmergencyScreen
msgFwPrioGoneAudio
msgFwPrioGoneLight
msgFwPrioGoneScreen
msgLocationDevs
msgPriorityAudio:-2,-1,0,1,2
msgPriorityLight:-2,-1,0,1,2
msgPriorityMail:-2,-1,0,1,2
msgPriorityPush:-2,-1,0,1,2
msgPriorityScreen:-2,-1,0,1,2
msgPriorityText:-2,-1,0,1,2
msgResidentsDev
msgSwitcherDev
msgThPrioHigh:-2,-1,0,1,2
msgThPrioNormal:-2,-1,0,1,2
msgThPrioAudioEmergency:-2,-1,0,1,2
msgThPrioAudioHigh:-2,-1,0,1,2
msgThPrioTextEmergency:-2,-1,0,1,2
msgThPrioTextNormal:-2,-1,0,1,2
msgThPrioGwEmergency:-2,-1,0,1,2
msgTitleAudio
msgTitleAudioShort
msgTitleAudioShortPrio
msgTitleLight
msgTitleLightHigh
msgTitleLightLow
msgTitleMail
msgTitleMailHigh
msgTitleMailLow
msgTitlePush
msgTitlePushHigh
msgTitlePushLow
msgTitleScreen
msgTitleScreenHigh
msgTitleScreenLow
msgTitleText
msgTitleTextHigh
msgTitleTextLow
);
use warnings 'qw';
$modules{Global}{AttrList} .= " " . join( " ", @attrList );
# add global attributes
foreach (
"msgContactAudio", "msgContactMail", "msgContactPush",
"msgContactScreen", "msgContactLight", "msgRecipient",
"msgRecipientAudio", "msgRecipientMail", "msgRecipientPush",
"msgRecipientScreen", "msgRecipientText", "msgRecipientLight",
)
{
addToAttrList($_);
}
}
########################################
@ -135,6 +57,20 @@ sub CommandMsg($$;$$) {
my ( $cl, $msg, $testMode ) = @_;
my $return = "";
# find existing msgConfig device or create a new instance
my $globalDevName = "";
if (defined ($defs{"msgConfig"})) {
if ($defs{"msgConfig"}{TYPE} eq "msgConfig") {
$globalDevName = "msgConfig";
} else {
return "Device msgConfig has incorrect type - aborting...";
}
} else {
fhem "define msgConfig msgConfig";
$globalDevName = "msgConfig";
$return .= "Global configuration device msgConfig was created.";
}
if ( $msg eq "" || $msg =~ /^\?[\s\t]*$/ || $msg eq "help" ) {
return
"Usage: msg [<type>] [<\@device>|<e-mail address>] [<priority>] [|<title>|] <message>";
@ -430,9 +366,9 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
eval 'use JSON qw( decode_json ); 1';
if ( !$@ ) {
$advanced = decode_json( Encode::encode_utf8($1) );
Log3 "global", 5, "msg: Advanced options\n" . Dumper($advanced);
Log3 $globalDevName, 5, "msg: Advanced options\n" . Dumper($advanced);
} else {
Log3 "global", 3, "msg: To use advanced options, please install Perl::JSON.";
Log3 $globalDevName, 3, "msg: To use advanced options, please install Perl::JSON.";
}
}
@ -451,11 +387,11 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
my $isRecipientOr = 1;
my $hasTypeOr = 0;
my $hasRecipientOr = 0;
$recipients = "\@global" if ( $recipients eq "" );
$recipients = "\@".$globalDevName if ( $recipients eq "" );
my @typesOr = split( /\|/, $types );
$hasTypeOr = 1 if ( scalar( grep { defined $_ } @typesOr ) > 1 );
Log3 "global", 5,
Log3 $globalDevName, 5,
"msg: typeOr total is " . scalar( grep { defined $_ } @typesOr )
if ( $testMode ne "1" );
@ -465,13 +401,13 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
$iTypesOr++
)
{
Log3 "global", 5,
Log3 $globalDevName, 5,
"msg: start typeOr loop for type(s) $typesOr[$iTypesOr]"
if ( $testMode ne "1" );
my @type = split( /,/, $typesOr[$iTypesOr] );
for ( my $i = 0 ; $i < scalar( grep { defined $_ } @type ) ; $i++ ) {
Log3 "global", 5, "msg: running loop for type $type[$i]"
Log3 $globalDevName, 5, "msg: running loop for type $type[$i]"
if ( $testMode ne "1" );
last if ( !defined( $type[$i] ) );
@ -496,7 +432,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
my @recipientsOr = split( /\|/, $recipients );
$hasRecipientOr = 1
if ( scalar( grep { defined $_ } @recipientsOr ) > 1 );
Log3 "global", 5,
Log3 $globalDevName, 5,
"msg: recipientOr total is "
. scalar( grep { defined $_ } @recipientsOr )
if ( $testMode ne "1" );
@ -507,14 +443,14 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
$iRecipOr++
)
{
Log3 "global", 5,
Log3 $globalDevName, 5,
"msg: start recipientsOr loop for recipient(s) $recipientsOr[$iRecipOr]"
if ( $testMode ne "1" );
my @recipient = split( /,/, $recipientsOr[$iRecipOr] );
foreach my $device (@recipient) {
Log3 "global", 5, "msg: running loop for device $device"
Log3 $globalDevName, 5, "msg: running loop for device $device"
if ( $testMode ne "1" );
my $messageSentDev = 0;
@ -542,7 +478,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
&& $deviceType eq "device" )
{
$return .= "Device $device does not exist\n";
Log3 "global", 5, "msg $device: Device does not exist"
Log3 $globalDevName, 5, "msg $device: Device does not exist"
if ( $testMode ne "1" );
my $regex1 =
@ -568,7 +504,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
my $useLocation = 0;
my $logDevice;
$logDevice = "global";
$logDevice = $globalDevName;
$logDevice = $device
if (
# look for direct
@ -617,12 +553,12 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
# look for global direct
AttrVal(
"global", "msgLocationDevs",
$globalDevName, "msgLocationDevs",
#look for global indirect
AttrVal(
AttrVal(
"global",
$globalDevName,
"msgRecipient$typeUc", ""
),
"msgLocationDevs",
@ -630,7 +566,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
# look for global indirect general
AttrVal(
AttrVal(
"global", "msgRecipient",
$globalDevName, "msgRecipient",
""
),
"msgLocationDevs",
@ -897,7 +833,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
# fallback/catchall
if ( $gatewayDevs eq "" ) {
$catchall = 1
if ( $device ne "global" );
if ( $device ne $globalDevName );
Log3 $logDevice, 5,
"msg $device: (No $typeUc contact defined, trying global instead)"
@ -907,18 +843,18 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
# look for direct
AttrVal(
"global", "msgContact$typeUc",
$globalDevName, "msgContact$typeUc",
#look for indirect
AttrVal(
AttrVal(
"global", "msgRecipient$typeUc", ""
$globalDevName, "msgRecipient$typeUc", ""
),
"msgContact$typeUc",
#look for indirect general
AttrVal(
AttrVal( "global", "msgRecipient", "" ),
AttrVal( $globalDevName, "msgRecipient", "" ),
"msgContact$typeUc",
# no contact found
@ -949,12 +885,12 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
# look for global direct
AttrVal(
"global", "msgPriority$typeUc",
$globalDevName, "msgPriority$typeUc",
#look for global indirect
AttrVal(
AttrVal(
"global", "msgRecipient$typeUc",
$globalDevName, "msgRecipient$typeUc",
""
),
"msgPriority$typeUc",
@ -962,7 +898,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
#look for global indirect general
AttrVal(
AttrVal(
"global", "msgRecipient",
$globalDevName, "msgRecipient",
""
),
"msgPriority$typeUc",
@ -1078,12 +1014,12 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
# look for global direct
AttrVal(
"global", "msgThPrioTextEmergency",
$globalDevName, "msgThPrioTextEmergency",
#look for global indirect type
AttrVal(
AttrVal(
"global",
$globalDevName,
"msgRecipient$typeUc", ""
),
"msgThPrioTextEmergency",
@ -1091,7 +1027,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
#look for global indirect general
AttrVal(
AttrVal(
"global", "msgRecipient",
$globalDevName, "msgRecipient",
""
),
"msgThPrioTextEmergency",
@ -1124,12 +1060,12 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
# look for global direct
AttrVal(
"global", "msgThPrioTextNormal",
$globalDevName, "msgThPrioTextNormal",
#look for global indirect type
AttrVal(
AttrVal(
"global",
$globalDevName,
"msgRecipient$typeUc", ""
),
"msgThPrioTextNormal",
@ -1137,7 +1073,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
#look for global indirect general
AttrVal(
AttrVal(
"global", "msgRecipient",
$globalDevName, "msgRecipient",
""
),
"msgThPrioTextNormal",
@ -1238,7 +1174,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
# FATAL ERROR: we could not find any targets for
# user specified device...
if ( $gatewayDevs eq ""
&& $device ne "global" )
&& $device ne $globalDevName )
{
$return .=
"ERROR: Could not find any $typeUc contact for device $device - set attributes: msgContact$typeUc | msgRecipient$typeUc | msgRecipient\n";
@ -1283,12 +1219,12 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
# look for global direct
AttrVal(
"global", "msgSwitcherDev",
$globalDevName, "msgSwitcherDev",
#look for global indirect type
AttrVal(
AttrVal(
"global",
$globalDevName,
"msgRecipient$typeUc", ""
),
"msgSwitcherDev",
@ -1296,7 +1232,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
#look for global indirect general
AttrVal(
AttrVal(
"global", "msgRecipient",
$globalDevName, "msgRecipient",
""
),
"msgSwitcherDev",
@ -1331,12 +1267,12 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
# look for global direct
AttrVal(
"global", "msgThPrioAudioEmergency",
$globalDevName, "msgThPrioAudioEmergency",
#look for global indirect type
AttrVal(
AttrVal(
"global",
$globalDevName,
"msgRecipient$typeUc", ""
),
"msgThPrioAudioEmergency",
@ -1344,7 +1280,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
#look for global indirect general
AttrVal(
AttrVal(
"global", "msgRecipient",
$globalDevName, "msgRecipient",
""
),
"msgThPrioAudioEmergency",
@ -1377,12 +1313,12 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
# look for global direct
AttrVal(
"global", "msgThPrioAudioHigh",
$globalDevName, "msgThPrioAudioHigh",
#look for global indirect type
AttrVal(
AttrVal(
"global",
$globalDevName,
"msgRecipient$typeUc", ""
),
"msgThPrioAudioHigh",
@ -1390,7 +1326,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
#look for global indirect general
AttrVal(
AttrVal(
"global", "msgRecipient",
$globalDevName, "msgRecipient",
""
),
"msgThPrioAudioHigh",
@ -1423,12 +1359,12 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
# look for global direct
AttrVal(
"global", "msgThPrioHigh",
$globalDevName, "msgThPrioHigh",
#look for global indirect type
AttrVal(
AttrVal(
"global",
$globalDevName,
"msgRecipient$typeUc", ""
),
"msgThPrioHigh",
@ -1436,7 +1372,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
#look for global indirect general
AttrVal(
AttrVal(
"global", "msgRecipient",
$globalDevName, "msgRecipient",
""
),
"msgThPrioHigh",
@ -1469,12 +1405,12 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
# look for global direct
AttrVal(
"global", "msgThPrioNormal",
$globalDevName, "msgThPrioNormal",
#look for global indirect type
AttrVal(
AttrVal(
"global",
$globalDevName,
"msgRecipient$typeUc", ""
),
"msgThPrioNormal",
@ -1482,7 +1418,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
#look for global indirect general
AttrVal(
AttrVal(
"global", "msgRecipient",
$globalDevName, "msgRecipient",
""
),
"msgThPrioNormal",
@ -1609,18 +1545,18 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
|| $residentDevPresence eq ""
)
&& ReadingsVal(
AttrVal( "global", "msgRecipient$typeUc", "" ),
AttrVal( $globalDevName, "msgRecipient$typeUc", "" ),
"presence", "-" ) ne "-"
)
{
$residentDevState =
ReadingsVal(
AttrVal( "global", "msgRecipient$typeUc", "" ),
AttrVal( $globalDevName, "msgRecipient$typeUc", "" ),
"state", "" )
if ( $residentDevState eq "" );
$residentDevPresence =
ReadingsVal(
AttrVal( "global", "msgRecipient$typeUc", "" ),
AttrVal( $globalDevName, "msgRecipient$typeUc", "" ),
"presence", "" )
if ( $residentDevPresence eq "" );
}
@ -1631,16 +1567,16 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
$residentDevState eq ""
|| $residentDevPresence eq ""
)
&& ReadingsVal( AttrVal( "global", "msgRecipient", "" ),
&& ReadingsVal( AttrVal( $globalDevName, "msgRecipient", "" ),
"presence", "-" ) ne "-"
)
{
$residentDevState =
ReadingsVal( AttrVal( "global", "msgRecipient", "" ),
ReadingsVal( AttrVal( $globalDevName, "msgRecipient", "" ),
"state", "" )
if ( $residentDevState eq "" );
$residentDevPresence =
ReadingsVal( AttrVal( "global", "msgRecipient", "" ),
ReadingsVal( AttrVal( $globalDevName, "msgRecipient", "" ),
"presence", "" )
if ( $residentDevPresence eq "" );
}
@ -1652,18 +1588,18 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
|| $residentDevPresence eq ""
)
&& ReadingsVal(
AttrVal( "global", "msgResidentsDev", "" ),
AttrVal( $globalDevName, "msgResidentsDev", "" ),
"presence", "-" ) ne "-"
)
{
$residentDevState =
ReadingsVal(
AttrVal( "global", "msgResidentsDev", "" ),
AttrVal( $globalDevName, "msgResidentsDev", "" ),
"state", "" )
if ( $residentDevState eq "" );
$residentDevPresence =
ReadingsVal(
AttrVal( "global", "msgResidentsDev", "" ),
AttrVal( $globalDevName, "msgResidentsDev", "" ),
"presence", "" )
if ( $residentDevPresence eq "" );
}
@ -1690,12 +1626,12 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
# look for global direct
AttrVal(
"global", "msgThPrioGwEmergency",
$globalDevName, "msgThPrioGwEmergency",
#look for global indirect type
AttrVal(
AttrVal(
"global",
$globalDevName,
"msgRecipient$typeUc", ""
),
"msgThPrioGwEmergency",
@ -1703,7 +1639,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
#look for global indirect general
AttrVal(
AttrVal(
"global", "msgRecipient",
$globalDevName, "msgRecipient",
""
),
"msgThPrioGwEmergency",
@ -1882,12 +1818,12 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
# look for global direct high
AttrVal(
"global", "msgTitle$typeUc$priorityCat",
$globalDevName, "msgTitle$typeUc$priorityCat",
# look for global indirect high
AttrVal(
AttrVal(
"global", "msgRecipient$typeUc",
$globalDevName, "msgRecipient$typeUc",
""
),
"msgTitle$typeUc$priorityCat",
@ -1895,7 +1831,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
#look for global indirect general high
AttrVal(
AttrVal(
"global", "msgRecipient",
$globalDevName, "msgRecipient",
""
),
"msgTitle$typeUc$priorityCat",
@ -1965,13 +1901,13 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
# look for global direct
AttrVal(
"global",
$globalDevName,
"msgCmd$typeUc$priorityCat",
# look for global indirect
AttrVal(
AttrVal(
"global",
$globalDevName,
"msgRecipient$typeUc",
""
),
@ -1980,7 +1916,7 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
#look for global indirect general
AttrVal(
AttrVal(
"global",
$globalDevName,
"msgRecipient",
""
),
@ -2113,19 +2049,19 @@ s/^[\s\t]*\|([\w\süöäß^°!"§$%&\/\\()<>=?´`"+\[\]#*@€]+)\|[\s\t]+//
}
else {
if ( !defined( $sentTypesPerDevice{$device} ) ) {
$sentTypesPerDevice{"global"} = "";
$sentTypesPerDevice{$globalDevName} = "";
}
else {
$sentTypesPerDevice{"global"} .= " ";
$sentTypesPerDevice{$globalDevName} .= " ";
}
$sentTypesPerDevice{"global"} .=
$sentTypesPerDevice{$globalDevName} .=
$type[$i] . ":" . $messageSentDev;
}
# update device readings
my $readingsDev = $defs{$device};
$readingsDev = $defs{"global"} if ( $catchall == 1 );
$readingsDev = $defs{$globalDevName} if ( $catchall == 1 );
readingsBeginUpdate($readingsDev);
readingsBulkUpdate( $readingsDev, "fhemMsg" . $typeUc,