mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
33_readingsGroup.pm: use deviceEvents()
git-svn-id: https://svn.fhem.de/fhem/trunk@7735 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
643262127b
commit
4ac8c67ae2
@ -881,11 +881,14 @@ readingsGroup_Notify($$)
|
|||||||
my ($hash,$dev) = @_;
|
my ($hash,$dev) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
if( grep(m/^INITIALIZED$/, @{$dev->{CHANGED}}) ) {
|
my $events = deviceEvents($dev,1);
|
||||||
|
return if( !$events );
|
||||||
|
|
||||||
|
if( grep(m/^INITIALIZED$/, @{$events}) ) {
|
||||||
readingsGroup_updateDevices($hash);
|
readingsGroup_updateDevices($hash);
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
elsif( grep(m/^REREADCFG$/, @{$dev->{CHANGED}}) ) {
|
elsif( grep(m/^REREADCFG$/, @{$events}) ) {
|
||||||
readingsGroup_updateDevices($hash);
|
readingsGroup_updateDevices($hash);
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
@ -898,9 +901,9 @@ readingsGroup_Notify($$)
|
|||||||
my $devices = $hash->{DEVICES};
|
my $devices = $hash->{DEVICES};
|
||||||
$devices = $hash->{DEVICES2} if( $hash->{DEVICES2} );
|
$devices = $hash->{DEVICES2} if( $hash->{DEVICES2} );
|
||||||
|
|
||||||
my $max = int(@{$dev->{CHANGED}});
|
my $max = int(@{$events});
|
||||||
for (my $i = 0; $i < $max; $i++) {
|
for (my $i = 0; $i < $max; $i++) {
|
||||||
my $s = $dev->{CHANGED}[$i];
|
my $s = $events->[$i];
|
||||||
$s = "" if(!defined($s));
|
$s = "" if(!defined($s));
|
||||||
|
|
||||||
if( $dev->{NAME} eq "global" && $s =~ m/^RENAMED ([^ ]*) ([^ ]*)$/) {
|
if( $dev->{NAME} eq "global" && $s =~ m/^RENAMED ([^ ]*) ([^ ]*)$/) {
|
||||||
@ -940,21 +943,12 @@ readingsGroup_Notify($$)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my @parts = split(/: /,$s);
|
my ($reading,$value) = split(": ",$events->[$i],2);
|
||||||
my $reading = shift @parts;
|
next if( !defined($value) );
|
||||||
my $value = join(": ", @parts);
|
|
||||||
|
|
||||||
$reading = "" if( !defined($reading) );
|
|
||||||
next if( $reading =~ m/^\./);
|
next if( $reading =~ m/^\./);
|
||||||
|
$reading = "" if( !defined($reading) );
|
||||||
$value = "" if( !defined($value) );
|
$value = "" if( !defined($value) );
|
||||||
my $show_state = 1;
|
my $show_state = !AttrVal( $name, "nostate", "0" );
|
||||||
if( $value eq "" ) {
|
|
||||||
$show_state = !AttrVal( $name, "nostate", "0" );
|
|
||||||
#next if( !$show_state );
|
|
||||||
|
|
||||||
$reading = "state";
|
|
||||||
$value = $s;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach my $device (@{$devices}) {
|
foreach my $device (@{$devices}) {
|
||||||
my $item = 0;
|
my $item = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user