Do not use `durationDue` for Philips and Develco motions sensors
@@ -86,6 +86,9 @@ void DeRestPluginPrivate::handleOccupancySensingClusterIndication(const deCONZ::
enqueueEvent(Event(RSensors, RStatePresence, sensor->id(), item));
stateUpdated = true;
+ // The checked sensors support reporting occupancy = false
+ if (!sensor->modelId().startsWith(QLatin1String("MOSZB-1")) && !sensor->modelId().startsWith(QLatin1String("SML00")))
+ {
const NodeValue &val = sensor->getZclValue(OCCUPANCY_SENSING_CLUSTER_ID, OCCUPIED_STATE);
// prepare to automatically set presence to false
@@ -94,18 +97,21 @@ void DeRestPluginPrivate::handleOccupancySensingClusterIndication(const deCONZ::
if (val.maxInterval > 0 && updateType == NodeValue::UpdateByZclReport)
{
// prevent setting presence back to false, when report.maxInterval > config.duration
- sensor->durationDue = item->lastSet().addSecs(val.maxInterval);
+ // Add 3 seconds grace time for late reports
+ sensor->durationDue = item->lastSet().addSecs(val.maxInterval + 3);
}
else
{
ResourceItem *item2 = sensor->item(RConfigDuration);
if (item2 && item2->toNumber() > 0)
{
+ // If occupied state is not reportable, add duration seconds after a occupied = true to automatically set to false
sensor->durationDue = item->lastSet().addSecs(item2->toNumber());
}
}
}
}
+ }
sensor->setZclValue(updateType, ind.srcEndpoint(), OCCUPANCY_SENSING_CLUSTER_ID, OCCUPIED_STATE, attr.numericValue());
}
