mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
bugfix: user-fn
git-svn-id: https://svn.fhem.de/fhem/trunk@8342 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
f81f4e4630
commit
9cc6dfac48
@ -1260,9 +1260,9 @@ SYSMON_obtainParameters_intern($$)
|
||||
#Log 3, "SYSMON >>> USER_DEFINED FUNCTIONS >>>>>>>>>>>>>>> START";
|
||||
my $userfn = AttrVal($name, "user-fn", undef);
|
||||
if(defined $userfn) {
|
||||
my @userfn_list = split(/,\s*/, trim($userfn));
|
||||
my @userfn_list = split(/,\s+/, trim($userfn));
|
||||
foreach my $ud (@userfn_list) {
|
||||
# <fnName>:<Interval_Minutes>:<reading1>:<reading2>...
|
||||
# <fnName>:<Interval_Minutes>:<reading1>:<reading2>..., [<fn-name>:...]
|
||||
my($fnName, $uInterval, @readings) = split(/:/, $ud);
|
||||
SYSMON_Log($hash, 5, "User-Defined Fn: [$fnName][$uInterval]");
|
||||
if(defined $uInterval) {
|
||||
@ -1508,6 +1508,8 @@ SYSMON_getUptime2($$)
|
||||
$uptime *= 60;
|
||||
$uptime += $minutes;
|
||||
$uptime *= 60;
|
||||
} else {
|
||||
$uptime = 0;
|
||||
}
|
||||
|
||||
$map->{+UPTIME}=sprintf("%d",$uptime);
|
||||
@ -4252,13 +4254,14 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
|
||||
the number of available updates is daily recorded as 'sys_updates'.
|
||||
</li>
|
||||
<br>
|
||||
<li>user-fn <fn_name>:<interval_minutes>:<reading_name1>:<reading_name2>...[:<reading_nameX>],...<br>
|
||||
<li>user-fn <fn_name>:<interval_minutes>:<reading_name1>:<reading_name2>...[:<reading_nameX>], ...<br>
|
||||
List of perl user subroutines.<br>
|
||||
As <fn_name> can be used either the name of a Perl subroutine or a Perl expression.
|
||||
The perl function gets the device hash as parameter and must provide an array of values.
|
||||
These values are taken according to the parameter <reading_nameX> in Readings.<br>
|
||||
A Perl expression must be enclosed in curly braces and can use the following parameters: $ HASH (device hash) and $ NAME (device name).
|
||||
Return is expected analogous to a Perl subroutine.
|
||||
Return is expected analogous to a Perl subroutine.<br>
|
||||
Important! The separation between multiple user functions must be done with a comma AND a space! Within the function definition commas may not be followed by spaces.
|
||||
</li>
|
||||
<br>
|
||||
<li>disable<br>
|
||||
@ -4860,7 +4863,8 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
|
||||
Die Perlfunktion bekommt den Device-Hash als Übergabeparameter und muss ein Array mit Werte liefern.
|
||||
Diese Werte werden entsprechend den Parameter <reading_nameX> in Readings übernommen.<br>
|
||||
Ein Perlausdruck muss in geschweifte Klammer eingeschlossen werden und kann folgende Paramter verwenden: $HASH (Device-Hash) und $NAME (Device-Name).
|
||||
Rückgabe wird analog einer Perlfunktion erwartet.
|
||||
Rückgabe wird analog einer Perlfunktion erwartet.<br>
|
||||
Wichtig! Die Trennung zwischen mehreren Benutzerfunktionen muss mit einem Komma UND einem Leerzeichen erfolgen! Innerhalb der Funktiondefinition dürfen Kommas nicht durch Leerzeichen gefolgt werden.
|
||||
</li>
|
||||
<br>
|
||||
<li>disable<br>
|
||||
|
Loading…
x
Reference in New Issue
Block a user