2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-09 19:54:19 +00:00

FHEM2FHEM.pm: generate readings for local devices (Forum #62369)

fhem.pl: create NOTIFYDEF only for "real" devices


git-svn-id: https://svn.fhem.de/fhem/trunk@12954 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-01-04 14:58:28 +00:00
parent 9f95be1e6b
commit 156bb2fe09
2 changed files with 22 additions and 9 deletions

View File

@ -156,7 +156,6 @@ FHEM2FHEM_Read($)
Log3 $name, 4, "$name: $rmsg";
if(!$defs{$name}) {
#LoadModule($type); Why do we need this line?
$defs{$name}{NAME} = $name;
$defs{$name}{TYPE} = $type;
$defs{$name}{STATE} = $msg;
@ -166,7 +165,11 @@ FHEM2FHEM_Read($)
delete($defs{$name});
} else {
DoTrigger($name, $msg);
if($msg =~ m/^([^:]*): (.*)$/) {
readingsSingleUpdate($defs{$name}, $1, $2, 1);
} else {
DoTrigger($name, $msg);
}
}
@ -362,8 +365,10 @@ FHEM2FHEM_Set($@)
FHEM. It is possible to create a device with the same name on both FHEM
instances, but if both of them receive the same event (e.g. because both
of them have a CUL attached), then all associated FileLogs/notifys will be
triggered twice. </li>
triggered twice.<br>
If the remote device is created with the same name locally (e.g. as dummy),
then the local readings are also updated.
</li>
<li>RAW<br>
By using this type the local FHEM will receive raw events from the remote
FHEM device <i>devicename</i>, just like if it would be attached to the
@ -456,7 +461,11 @@ FHEM2FHEM_Set($@)
angesprochen werden. Auf beiden FHEM-Installationen k&ouml;nnen
Ger&auml;te gleichen Namens angelegt werden, aber wenn beide dasselbe
Ereignis empfangen (z.B. wenn an beiden Installationen CULs angeschlossen
sind), werden alle FileLogs und notifys doppelt ausgel&ouml;st. </li>
sind), werden alle FileLogs und notifys doppelt ausgel&ouml;st.<br>
Falls man lokal Ger&auml;te mit dem gleichen Namen (z.Bsp. als dummy)
angelegt hat, dann werden die Readings von dem lokalen Ger&auml;t
aktualisiert.
</li>
<li>RAW<br>
Bei diesem Verbindungstyp werden unaufbereitete Ereignisse (raw messages)

View File

@ -4496,10 +4496,14 @@ notifyRegexpChanged($$)
$hash->{NOTIFYDEV} = $dev;
} elsif($re =~ m/\|/ && $re =~ /^\(?([^().+*?\[\]\\]+)\)?$/) { # Regexp Wizard
my @list = split(/\|/, $1); # Forum #54536
@list = map { m/^([^:]*)(?::.*)?$/ ? $1 : "" } @list;
$hash->{NOTIFYDEV} = join(",", @list) if(@list && @list <= 5);
delete($hash->{NOTIFYDEV}) if(@list && @list > 5);
my @list2 = split(/\|/, $1); # Forum #54536
my @list = grep { m/./ } # Forum #62369
map { (m/^([^:]*)(?::.*)?$/ && $defs{$1}) ? $1 : "" } @list2;
if(@list && @list <= 5 && int(@list) == int(@list2)) {
$hash->{NOTIFYDEV} = join(",", @list);
} else {
delete($hash->{NOTIFYDEV});
}
} else {
delete($hash->{NOTIFYDEV}); # when called by modify