2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

73_PRESENCE: fix restart of threshold counter after FHEM restart (thx to DeeSPe & CoolTux, Forum: #71744)

git-svn-id: https://svn.fhem.de/fhem/trunk@14263 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch 2017-05-13 08:53:10 +00:00
parent deeb3a154a
commit 0ac70f7ddf
2 changed files with 7 additions and 2 deletions

View File

@ -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: 73_PRESENCE: fix restart of threshold counter after FHEM restart
- feature: 44_S7: new attribute receiveTimeoutMs - feature: 44_S7: new attribute receiveTimeoutMs
- feature: 38_CO20: introduced state reading - feature: 38_CO20: introduced state reading
- change: 73_NUKIBridge,74_NUKIDevice: fix Perlwarnings - change: 73_NUKIBridge,74_NUKIDevice: fix Perlwarnings

View File

@ -1289,7 +1289,8 @@ sub PRESENCE_ProcessState($$)
{ {
if(++$count >= $absenceThreshold) if(++$count >= $absenceThreshold)
{ {
readingsBulkUpdate($hash, ".absenceThresholdCounter", 0); readingsBulkUpdate($hash, ".presenceThresholdCounter", 0);
readingsBulkUpdate($hash, ".absenceThresholdCounter", ($count-1));
readingsBulkUpdate($hash, "state", "absent"); readingsBulkUpdate($hash, "state", "absent");
readingsBulkUpdate($hash, "presence", "absent"); readingsBulkUpdate($hash, "presence", "absent");
} }
@ -1297,6 +1298,7 @@ sub PRESENCE_ProcessState($$)
{ {
$hash->{helper}{ABSENT_COUNT} = $count; $hash->{helper}{ABSENT_COUNT} = $count;
readingsBulkUpdate($hash, ".presenceThresholdCounter", 0);
readingsBulkUpdate($hash, ".absenceThresholdCounter", $count); readingsBulkUpdate($hash, ".absenceThresholdCounter", $count);
readingsBulkUpdate($hash, "state", "maybe absent"); readingsBulkUpdate($hash, "state", "maybe absent");
readingsBulkUpdate($hash, "presence", "maybe absent"); readingsBulkUpdate($hash, "presence", "maybe absent");
@ -1334,7 +1336,8 @@ sub PRESENCE_ProcessState($$)
{ {
if(++$count >= $presenceThreshold) if(++$count >= $presenceThreshold)
{ {
readingsBulkUpdate($hash, ".presenceThresholdCounter", "0"); readingsBulkUpdate($hash, ".absenceThresholdCounter", 0);
readingsBulkUpdate($hash, ".presenceThresholdCounter", ($count-1));
readingsBulkUpdate($hash, "state", "present"); readingsBulkUpdate($hash, "state", "present");
readingsBulkUpdate($hash, "presence", "present"); readingsBulkUpdate($hash, "presence", "present");
@ -1344,6 +1347,7 @@ sub PRESENCE_ProcessState($$)
{ {
$hash->{helper}{PRESENT_COUNT} = $count; $hash->{helper}{PRESENT_COUNT} = $count;
readingsBulkUpdate($hash, ".absenceThresholdCounter", 0);
readingsBulkUpdate($hash, ".presenceThresholdCounter", $count); readingsBulkUpdate($hash, ".presenceThresholdCounter", $count);
readingsBulkUpdate($hash, "state", "maybe present"); readingsBulkUpdate($hash, "state", "maybe present");
readingsBulkUpdate($hash, "presence", "maybe present"); readingsBulkUpdate($hash, "presence", "maybe present");