2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-08 05:15:10 +00:00

KM271: added attribute <additionalNotify> to activate notification for specific readings which normally send no notification because of high traffic

git-svn-id: https://svn.fhem.de/fhem/trunk@10926 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
physikus 2016-02-23 19:57:43 +00:00
parent 92f765840c
commit 00a10c8d39

View File

@ -355,7 +355,7 @@ KM271_Initialize($)
$hash->{SetFn} = "KM271_Set"; $hash->{SetFn} = "KM271_Set";
$hash->{GetFn} = "KM271_Get"; $hash->{GetFn} = "KM271_Get";
$hash->{AttrFn} = "KM271_Attr"; $hash->{AttrFn} = "KM271_Attr";
$hash->{AttrList} = "do_not_notify:1,0 all_km271_events:1,0 ww_timermode:automatik,tag readingsFilter $readingFnAttributes"; $hash->{AttrList} = "do_not_notify:1,0 all_km271_events:1,0 ww_timermode:automatik,tag readingsFilter additionalNotify $readingFnAttributes";
%km271_rev = (); %km271_rev = ();
foreach my $k (sort keys %km271_tr) { # Reverse map foreach my $k (sort keys %km271_tr) { # Reverse map
@ -760,7 +760,8 @@ KM271_Read($)
# Analyze the data # Analyze the data
my ($fn, $arg) = ($1, $2); my ($fn, $arg) = ($1, $2);
my $msghash = $km271_rev{$fn}; my $msghash = $km271_rev{$fn};
my $all_events = AttrVal($name, "all_km271_events", ""); my $all_events = AttrVal($name, 'all_km271_events', '');
my $notifyFilter = AttrVal($name, 'additionalNotify', '');
if($msghash) { if($msghash) {
my $km271Timer = $hash->{PRG_TIMER}; my $km271Timer = $hash->{PRG_TIMER};
@ -776,7 +777,7 @@ KM271_Read($)
if($f eq "d") { $val /= $farg; } if($f eq "d") { $val /= $farg; }
elsif($f eq "p") { $val += $farg; } elsif($f eq "p") { $val += $farg; }
elsif($f eq "ne") { $ntfy = $all_events; } elsif($f eq "ne") { $ntfy = ($notifyFilter && $key =~ m/$notifyFilter/s) ? 1 : $all_events; }
elsif($f eq "s") { $val = $val-256 if($val > 127); } elsif($f eq "s") { $val = $val-256 if($val > 127); }
elsif($f eq "bf") { $val = KM271_setbits($val, $farg); } elsif($f eq "bf") { $val = KM271_setbits($val, $farg); }
elsif($f eq "a") { $val = $km271_arrays[$farg][$val]; } elsif($f eq "a") { $val = $km271_arrays[$farg][$val]; }
@ -829,7 +830,7 @@ KM271_Attr(@)
if($cmd eq 'set') { if($cmd eq 'set') {
if($attrName eq 'ww_timermode') { if($attrName eq 'ww_timermode') {
return "Invalid $attrName <$attrVal>" if(!$km271_set_betriebsart{$attrVal}); return "Invalid $attrName <$attrVal>" if(!$km271_set_betriebsart{$attrVal});
} elsif($attrName eq 'readingsFilter') { } elsif($attrName eq 'readingsFilter' || $attrName eq 'additionalNotify') {
eval {qr/$attrVal/}; eval {qr/$attrVal/};
if($@) { if($@) {
Log3 $name, 1, "$name: Invalid Regex for $attrName <$attrVal> '$@'"; Log3 $name, 1, "$name: Invalid Regex for $attrName <$attrVal> '$@'";
@ -1148,10 +1149,15 @@ KM271_SetReading($$$$)
Only readings which will match the regular expression will be used. All other readings are Only readings which will match the regular expression will be used. All other readings are
suppressed in the device and even in the logfile. suppressed in the device and even in the logfile.
</li> </li>
<a name="additionalNotify"></a>
<li>additionalNotify<br>
Regular expression for activation of notify for readings with normally suppressed events.<br>
Useful for *_Vorlaufisttemperatur readings if notification should be activated only for a specific reading
and not for all like all_km271_events.
</li>
</ul> </ul>
<br> <br>
<a name="KM271events"></a> <a name="KM271events"></a>
<b>Generated events:</b> <b>Generated events:</b>
<ul> <ul>