mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-20 13:26:02 +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:
parent
9f95be1e6b
commit
156bb2fe09
@ -156,7 +156,6 @@ FHEM2FHEM_Read($)
|
|||||||
Log3 $name, 4, "$name: $rmsg";
|
Log3 $name, 4, "$name: $rmsg";
|
||||||
|
|
||||||
if(!$defs{$name}) {
|
if(!$defs{$name}) {
|
||||||
#LoadModule($type); Why do we need this line?
|
|
||||||
$defs{$name}{NAME} = $name;
|
$defs{$name}{NAME} = $name;
|
||||||
$defs{$name}{TYPE} = $type;
|
$defs{$name}{TYPE} = $type;
|
||||||
$defs{$name}{STATE} = $msg;
|
$defs{$name}{STATE} = $msg;
|
||||||
@ -165,8 +164,12 @@ FHEM2FHEM_Read($)
|
|||||||
DoTrigger($name, $msg);
|
DoTrigger($name, $msg);
|
||||||
delete($defs{$name});
|
delete($defs{$name});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if($msg =~ m/^([^:]*): (.*)$/) {
|
||||||
|
readingsSingleUpdate($defs{$name}, $1, $2, 1);
|
||||||
} else {
|
} else {
|
||||||
DoTrigger($name, $msg);
|
DoTrigger($name, $msg);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,8 +365,10 @@ FHEM2FHEM_Set($@)
|
|||||||
FHEM. It is possible to create a device with the same name on both FHEM
|
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
|
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
|
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>
|
<li>RAW<br>
|
||||||
By using this type the local FHEM will receive raw events from the remote
|
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
|
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önnen
|
angesprochen werden. Auf beiden FHEM-Installationen können
|
||||||
Geräte gleichen Namens angelegt werden, aber wenn beide dasselbe
|
Geräte gleichen Namens angelegt werden, aber wenn beide dasselbe
|
||||||
Ereignis empfangen (z.B. wenn an beiden Installationen CULs angeschlossen
|
Ereignis empfangen (z.B. wenn an beiden Installationen CULs angeschlossen
|
||||||
sind), werden alle FileLogs und notifys doppelt ausgelöst. </li>
|
sind), werden alle FileLogs und notifys doppelt ausgelöst.<br>
|
||||||
|
Falls man lokal Geräte mit dem gleichen Namen (z.Bsp. als dummy)
|
||||||
|
angelegt hat, dann werden die Readings von dem lokalen Gerät
|
||||||
|
aktualisiert.
|
||||||
|
</li>
|
||||||
|
|
||||||
<li>RAW<br>
|
<li>RAW<br>
|
||||||
Bei diesem Verbindungstyp werden unaufbereitete Ereignisse (raw messages)
|
Bei diesem Verbindungstyp werden unaufbereitete Ereignisse (raw messages)
|
||||||
|
12
fhem/fhem.pl
12
fhem/fhem.pl
@ -4496,10 +4496,14 @@ notifyRegexpChanged($$)
|
|||||||
$hash->{NOTIFYDEV} = $dev;
|
$hash->{NOTIFYDEV} = $dev;
|
||||||
|
|
||||||
} elsif($re =~ m/\|/ && $re =~ /^\(?([^().+*?\[\]\\]+)\)?$/) { # Regexp Wizard
|
} elsif($re =~ m/\|/ && $re =~ /^\(?([^().+*?\[\]\\]+)\)?$/) { # Regexp Wizard
|
||||||
my @list = split(/\|/, $1); # Forum #54536
|
my @list2 = split(/\|/, $1); # Forum #54536
|
||||||
@list = map { m/^([^:]*)(?::.*)?$/ ? $1 : "" } @list;
|
my @list = grep { m/./ } # Forum #62369
|
||||||
$hash->{NOTIFYDEV} = join(",", @list) if(@list && @list <= 5);
|
map { (m/^([^:]*)(?::.*)?$/ && $defs{$1}) ? $1 : "" } @list2;
|
||||||
delete($hash->{NOTIFYDEV}) if(@list && @list > 5);
|
if(@list && @list <= 5 && int(@list) == int(@list2)) {
|
||||||
|
$hash->{NOTIFYDEV} = join(",", @list);
|
||||||
|
} else {
|
||||||
|
delete($hash->{NOTIFYDEV});
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
delete($hash->{NOTIFYDEV}); # when called by modify
|
delete($hash->{NOTIFYDEV}); # when called by modify
|
||||||
|
Loading…
x
Reference in New Issue
Block a user