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

33_readingsProxy.pm: use NOTIFYDEV/notifyRegexpChanged

git-svn-id: https://svn.fhem.de/fhem/trunk@13230 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2017-01-25 12:41:46 +00:00
parent 9fd312ed50
commit 424feba865

View File

@ -58,8 +58,7 @@ readingsProxy_updateDevices($)
my @device = split(":", $param); my @device = split(":", $param);
if( defined($defs{$device[0]}) if( defined($defs{$device[0]}) ) {
&& defined($defs{$device[0]}) ) {
$list{$device[0]} = 1; $list{$device[0]} = 1;
$hash->{DEVICE} = $device[0]; $hash->{DEVICE} = $device[0];
$hash->{READING} = $device[1]; $hash->{READING} = $device[1];
@ -68,6 +67,11 @@ readingsProxy_updateDevices($)
} }
} }
if( $hash->{DEVICE} ) {
notifyRegexpChanged($hash,"(global|".$hash->{DEVICE}.")");
} else {
notifyRegexpChanged($hash,'');
}
$hash->{CONTENT} = \%list; $hash->{CONTENT} = \%list;
readingsProxy_update($hash, undef); readingsProxy_update($hash, undef);
@ -107,7 +111,7 @@ readingsProxy_update($$)
my $DEVICE = $hash->{DEVICE}; my $DEVICE = $hash->{DEVICE};
my $READING = $hash->{READING}; my $READING = $hash->{READING};
$value = ReadingsVal($DEVICE,$READING,undef) if( !defined($value) ); $value = ReadingsVal($DEVICE,$READING,undef) if( $DEVICE && !defined($value) );
my $value_fn = AttrVal( $name, "valueFn", "" ); my $value_fn = AttrVal( $name, "valueFn", "" );
if( $value_fn =~ m/^{.*}$/s ) { if( $value_fn =~ m/^{.*}$/s ) {
@ -172,9 +176,12 @@ readingsProxy_Notify($$)
$hash->{DEF} =~ s/ $//; $hash->{DEF} =~ s/ $//;
} }
readingsProxy_updateDevices($hash); readingsProxy_updateDevices($hash);
} elsif( $dev->{NAME} eq "global" && $s =~ m/^DEFINED ([^ ]*)$/) { } elsif( $dev->{NAME} eq "global" && $s =~ m/^DEFINED ([^ ]*)$/) {
readingsProxy_updateDevices($hash); readingsProxy_updateDevices($hash);
} else { } else {
next if( !$hash->{DEVICE} );
next if( $dev->{NAME} ne $hash->{DEVICE} ); next if( $dev->{NAME} ne $hash->{DEVICE} );
my @parts = split(/: /,$s); my @parts = split(/: /,$s);