mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-13 05:06:35 +00:00
avoid unitialized value warnings for undefined readings in ReadingsBulkUpdate
git-svn-id: https://svn.fhem.de/fhem/trunk@2182 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
6d6ec4d200
commit
259fbf8f37
28
fhem/fhem.pl
28
fhem/fhem.pl
@ -2928,21 +2928,25 @@ readingsBulkUpdate($$$) {
|
||||
|
||||
# shorthand
|
||||
my $readings= $hash->{READINGS};
|
||||
|
||||
my $changed= 1;
|
||||
# check for changes only if reading already exists
|
||||
if(defined($readings->{$reading})) {
|
||||
|
||||
# these flags determine if any of the "event-on" attributes are set;
|
||||
my $attreocr= AttrVal($name, "event-on-change-reading", "");
|
||||
my $attreour= AttrVal($name, "event-on-update-reading", "");
|
||||
# these flags determine if any of the "event-on" attributes are set;
|
||||
my $attreocr= AttrVal($name, "event-on-change-reading", "");
|
||||
my $attreour= AttrVal($name, "event-on-update-reading", "");
|
||||
|
||||
# these flags determine whether the reading is listed in any of the attributes
|
||||
my $eocr= $attreocr && grep($_ eq $reading, split /,/,$attreocr);
|
||||
my $eour= $attreour && grep($_ eq $reading, split /,/,$attreour);
|
||||
# these flags determine whether the reading is listed in any of the attributes
|
||||
my $eocr= $attreocr && grep($_ eq $reading, split /,/,$attreocr);
|
||||
my $eour= $attreour && grep($_ eq $reading, split /,/,$attreour);
|
||||
|
||||
# determine if an event should be created
|
||||
my $changed= !($attreocr || $attreour) # always create event if no attribute is set
|
||||
|| $eour # or if the reading is listed in event-on-update-reading
|
||||
|| ($eocr && # or if the reading is listed in event-on-change-reading...
|
||||
($value ne $readings->{$reading}{VAL})); # ...and its value has changed.
|
||||
|
||||
# determine if an event should be created
|
||||
my $changed= !($attreocr || $attreour) # always create event if no attribute is set
|
||||
|| $eour # or if the reading is listed in event-on-update-reading
|
||||
|| ($eocr && # or if the reading is listed in event-on-change-reading...
|
||||
($value ne $readings->{$reading}{VAL})); # ...and its value has changed.
|
||||
}
|
||||
|
||||
setReadingsVal($hash, $reading, $value, $hash->{helper}{updating}{latestUpdate});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user