mirror of
https://github.com/koush/scrypted.git
synced 2026-02-09 00:39:56 +00:00
homekit: fix object detection denoising
This commit is contained in:
4
plugins/homekit/package-lock.json
generated
4
plugins/homekit/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/homekit",
|
||||
"version": "0.0.130",
|
||||
"version": "0.0.131",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/homekit",
|
||||
"version": "0.0.130",
|
||||
"version": "0.0.131",
|
||||
"dependencies": {
|
||||
"hap-nodejs": "file:../../external/HAP-NodeJS",
|
||||
"lodash": "^4.17.21",
|
||||
|
||||
@@ -40,5 +40,5 @@
|
||||
"@types/qrcode": "^1.4.1",
|
||||
"@types/url-parse": "^1.4.3"
|
||||
},
|
||||
"version": "0.0.130"
|
||||
"version": "0.0.131"
|
||||
}
|
||||
|
||||
@@ -577,6 +577,7 @@ addSupportedType({
|
||||
const resetSensorTimeout = () => {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(() => {
|
||||
contactState = Characteristic.ContactSensorState.CONTACT_DETECTED;
|
||||
sensor.updateCharacteristic(Characteristic.ContactSensorState, contactState);
|
||||
}, (parseInt(storage.getItem('objectDetectionContactSensorTimeout')) || defaultObjectDetectionContactSensorTimeout) * 1000)
|
||||
}
|
||||
@@ -589,14 +590,12 @@ addSupportedType({
|
||||
if (!isPerson) {
|
||||
if (!ed.detections)
|
||||
return contactState;
|
||||
|
||||
const objects = ed.detections.map(d => d.className);
|
||||
if (objects.includes(ojs)) {
|
||||
contactState = Characteristic.ContactSensorState.CONTACT_NOT_DETECTED;
|
||||
resetSensorTimeout();
|
||||
}
|
||||
else {
|
||||
contactState = Characteristic.ContactSensorState.CONTACT_DETECTED;
|
||||
}
|
||||
|
||||
return contactState;
|
||||
}
|
||||
@@ -605,8 +604,10 @@ addSupportedType({
|
||||
return contactState;
|
||||
|
||||
const people = ed.people.map(d => 'Person: ' + d.label);
|
||||
contactState = people.includes(ojs) ? Characteristic.ContactSensorState.CONTACT_NOT_DETECTED : Characteristic.ContactSensorState.CONTACT_DETECTED;
|
||||
|
||||
if (people.includes(ojs)) {
|
||||
contactState = Characteristic.ContactSensorState.CONTACT_NOT_DETECTED;
|
||||
resetSensorTimeout();
|
||||
}
|
||||
return contactState;
|
||||
}, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user