2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

fhem.pl: add readingsBulkUpdateIfChanged (Forum #58797)

git-svn-id: https://svn.fhem.de/fhem/trunk@12311 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2016-10-10 17:48:19 +00:00
parent fec33610f1
commit 0ffeb8ae51

View File

@ -4044,9 +4044,19 @@ readingsEndUpdate($$)
return undef;
}
#
sub
readingsBulkUpdateIfChanged($$$@) # Forum #58797
{
my ($hash,$reading,$value,$changed)= @_;
return undef if($value eq ReadingsVal($hash->{NAME},$reading,""));
return readingsBulkUpdate($hash,$reading,$value,$changed);
}
# Call readingsBulkUpdate to update the reading.
# Example: readingsUpdate($hash,"temperature",$value);
# Optional parameter $changed: if defined, and is 0, do not trigger events. If
# 1, trigger. If not defined, the name of the reading decides (starting with .
# is 0, else 1). The event-on-* filtering is done additionally.
#
sub
readingsBulkUpdate($$$@)