diff --git a/fhem/CHANGED b/fhem/CHANGED index af8f045da..59cef1ac6 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # 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. + - bugfix: 73_PRESENCE: fix restart of threshold counter after FHEM restart - feature: 44_S7: new attribute receiveTimeoutMs - feature: 38_CO20: introduced state reading - change: 73_NUKIBridge,74_NUKIDevice: fix Perlwarnings diff --git a/fhem/FHEM/73_PRESENCE.pm b/fhem/FHEM/73_PRESENCE.pm index 5b93b5397..7db72b648 100755 --- a/fhem/FHEM/73_PRESENCE.pm +++ b/fhem/FHEM/73_PRESENCE.pm @@ -1289,7 +1289,8 @@ sub PRESENCE_ProcessState($$) { if(++$count >= $absenceThreshold) { - readingsBulkUpdate($hash, ".absenceThresholdCounter", 0); + readingsBulkUpdate($hash, ".presenceThresholdCounter", 0); + readingsBulkUpdate($hash, ".absenceThresholdCounter", ($count-1)); readingsBulkUpdate($hash, "state", "absent"); readingsBulkUpdate($hash, "presence", "absent"); } @@ -1297,6 +1298,7 @@ sub PRESENCE_ProcessState($$) { $hash->{helper}{ABSENT_COUNT} = $count; + readingsBulkUpdate($hash, ".presenceThresholdCounter", 0); readingsBulkUpdate($hash, ".absenceThresholdCounter", $count); readingsBulkUpdate($hash, "state", "maybe absent"); readingsBulkUpdate($hash, "presence", "maybe absent"); @@ -1334,7 +1336,8 @@ sub PRESENCE_ProcessState($$) { if(++$count >= $presenceThreshold) { - readingsBulkUpdate($hash, ".presenceThresholdCounter", "0"); + readingsBulkUpdate($hash, ".absenceThresholdCounter", 0); + readingsBulkUpdate($hash, ".presenceThresholdCounter", ($count-1)); readingsBulkUpdate($hash, "state", "present"); readingsBulkUpdate($hash, "presence", "present"); @@ -1344,6 +1347,7 @@ sub PRESENCE_ProcessState($$) { $hash->{helper}{PRESENT_COUNT} = $count; + readingsBulkUpdate($hash, ".absenceThresholdCounter", 0); readingsBulkUpdate($hash, ".presenceThresholdCounter", $count); readingsBulkUpdate($hash, "state", "maybe present"); readingsBulkUpdate($hash, "presence", "maybe present");