Merge pull request #9787 from s-hadinger/zigbee_fix_zboccupancy

Fix ignore Occupancy timeout
This commit is contained in:
Theo Arends 2020-11-09 13:47:49 +01:00 committed by GitHub
commit 2f05d8707d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -1294,7 +1294,9 @@ void ZCLFrame::generateCallBacks(Z_attribute_list& attr_list) {
if (&pir_found != nullptr) {
pir_timer = pir_found.getTimeoutSeconds() * 1000;
}
zigbee_devices.setTimer(_srcaddr, 0 /* groupaddr */, pir_timer, _cluster_id, _srcendpoint, Z_CAT_VIRTUAL_OCCUPANCY, 0, &Z_OccupancyCallback);
if (pir_timer > 0) {
zigbee_devices.setTimer(_srcaddr, 0 /* groupaddr */, pir_timer, _cluster_id, _srcendpoint, Z_CAT_VIRTUAL_OCCUPANCY, 0, &Z_OccupancyCallback);
}
} else {
zigbee_devices.resetTimersForDevice(_srcaddr, 0 /* groupaddr */, Z_CAT_VIRTUAL_OCCUPANCY);
}