mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-01 07:19:24 +00:00
error correction: hysteresis, init_desired_value
git-svn-id: https://svn.fhem.de/fhem/trunk@2919 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
b97b8d5e9b
commit
36cede4cf5
@ -48,7 +48,6 @@ THRESHOLD_Define($$$)
|
||||
my $cmd2;
|
||||
my $cmd_default;
|
||||
my $actor;
|
||||
my $init_desired_value;
|
||||
|
||||
if (@b > 4 || @a < 3 || @a > 5) {
|
||||
my $msg = "wrong syntax: define <name> THRESHOLD " .
|
||||
@ -69,17 +68,20 @@ THRESHOLD_Define($$$)
|
||||
$hash->{sensor} = $sensor;
|
||||
$reading = "temperature" if (!$reading);
|
||||
|
||||
if (!$hysteresis) {
|
||||
if ($reading eq "temperature") {
|
||||
if ($hysteresis eq "") {
|
||||
if ($reading eq "temperature" or $reading eq "temp") {
|
||||
$hysteresis=1;
|
||||
} elsif ($reading eq "humidity") {
|
||||
$hysteresis=10;
|
||||
} else {
|
||||
$hysteresis=20;
|
||||
$hysteresis=0;
|
||||
}
|
||||
} elsif ($hysteresis !~ m/^[\d\.]*$/ ) {
|
||||
my $msg = "$pn: THRESHOLD: hysteresis needs a numeric parameter";
|
||||
Log 2, $msg;
|
||||
return $msg;
|
||||
} elsif ($init_desired_value) {
|
||||
}
|
||||
if ($init_desired_value ne "") {
|
||||
if ($init_desired_value !~ m/^[-\d\.]*$/) {
|
||||
my $msg = "$pn: THRESHOLD: init_desired_value needs a numeric parameter";
|
||||
Log 2, $msg;
|
||||
@ -144,7 +146,7 @@ THRESHOLD_Define($$$)
|
||||
$hash->{helper}{actor_cmd_default} = $cmd_default;
|
||||
$hash->{STATE} = 'initialized' if (!ReadingsVal($pn,"desired_value",""));
|
||||
|
||||
if ($init_desired_value)
|
||||
if ($init_desired_value ne "")
|
||||
{
|
||||
readingsBeginUpdate ($hash);
|
||||
readingsBulkUpdate ($hash, "state", "active $init_desired_value");
|
||||
|
Loading…
Reference in New Issue
Block a user