mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
98_dewpoint.pm: use NOTIFYDEV with framework functions
git-svn-id: https://svn.fhem.de/fhem/trunk@16749 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
b683ab708a
commit
792e2c159d
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- bugfix: 98_dewpoint: Use NOTIFYDEV with framework functions
|
||||||
- feature: 57_Calendar: new parameter "limit" (forum #87566)
|
- feature: 57_Calendar: new parameter "limit" (forum #87566)
|
||||||
- bugfix: 55_DWD_OpenData: updateAlertsCache causing "not a HASH reference"
|
- bugfix: 55_DWD_OpenData: updateAlertsCache causing "not a HASH reference"
|
||||||
error on some platforms (forum #83097)
|
error on some platforms (forum #83097)
|
||||||
|
@ -104,7 +104,7 @@ dewpoint_Define($$)
|
|||||||
|
|
||||||
$hash->{DEV_REGEXP} = $devname;
|
$hash->{DEV_REGEXP} = $devname;
|
||||||
# set NOTIFYDEV
|
# set NOTIFYDEV
|
||||||
$hash->{NOTIFYDEV} = 'global';
|
notifyRegexpChanged($hash, $devname);
|
||||||
$hash->{STATE} = "active";
|
$hash->{STATE} = "active";
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
@ -119,32 +119,6 @@ dewpoint_Notify($$)
|
|||||||
my $devName = $dev->{NAME};
|
my $devName = $dev->{NAME};
|
||||||
my $re = $hash->{DEV_REGEXP};
|
my $re = $hash->{DEV_REGEXP};
|
||||||
|
|
||||||
# listen to global in order to update our NOTIFYDEV
|
|
||||||
if ($devName eq 'global') {
|
|
||||||
# look for INITIALIZED or any device change
|
|
||||||
my $rebuild;
|
|
||||||
foreach (@{deviceEvents($dev, 0)}) {
|
|
||||||
if ($_ =~ m/^(INITIALIZED$)|((DEFINED|MODIFIED|RENAMED|DELETED)\s+)/) {
|
|
||||||
$rebuild = 1;
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($rebuild) {
|
|
||||||
# notifyRegexpChanged requires complete device names separated by '|'
|
|
||||||
# while we allow a true regexp
|
|
||||||
|
|
||||||
# build list of devices matching our RE
|
|
||||||
my @matched_devs = ('global', grep { m/^$re$/ } keys(%defs));
|
|
||||||
|
|
||||||
my $notify_re = join('|', @matched_devs);
|
|
||||||
Log3($hashName, 5, "Update NOTIFYDEV to >>$notify_re<<");
|
|
||||||
notifyRegexpChanged($hash, $notify_re);
|
|
||||||
}
|
|
||||||
return undef;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# fast exit
|
# fast exit
|
||||||
return "" if (!defined($re) || $devName !~ m/^$re$/);
|
return "" if (!defined($re) || $devName !~ m/^$re$/);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user