mirror of
https://github.com/koush/scrypted.git
synced 2026-05-04 21:30:30 +01:00
ring: fix busted ass ring polling/push
This commit is contained in:
6
plugins/ring/package-lock.json
generated
6
plugins/ring/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/ring",
|
||||
"version": "0.0.109",
|
||||
"version": "0.0.110",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/ring",
|
||||
"version": "0.0.109",
|
||||
"version": "0.0.110",
|
||||
"dependencies": {
|
||||
"@koush/ring-client-api": "file:../../external/ring-client-api",
|
||||
"@scrypted/common": "file:../../common",
|
||||
@@ -49,7 +49,7 @@
|
||||
},
|
||||
"../../sdk": {
|
||||
"name": "@scrypted/sdk",
|
||||
"version": "0.2.86",
|
||||
"version": "0.2.101",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
|
||||
@@ -44,5 +44,5 @@
|
||||
"got": "11.8.6",
|
||||
"socket.io-client": "^2.5.0"
|
||||
},
|
||||
"version": "0.0.109"
|
||||
"version": "0.0.110"
|
||||
}
|
||||
|
||||
@@ -101,14 +101,29 @@ export class RingCameraDevice extends ScryptedDeviceBase implements DeviceProvid
|
||||
this.console.log(camera.name, 'onDoorbellPressed', e);
|
||||
this.triggerBinaryState();
|
||||
});
|
||||
let motionTimeout: NodeJS.Timeout;
|
||||
const resetTimeout = () => {
|
||||
clearTimeout(motionTimeout);
|
||||
motionTimeout = setTimeout(() => this.motionDetected = false, 30000);
|
||||
};
|
||||
camera.onMotionDetected?.subscribe(async motionDetected => {
|
||||
if (motionDetected)
|
||||
if (motionDetected) {
|
||||
this.console.log(camera.name, 'onMotionDetected');
|
||||
resetTimeout();
|
||||
}
|
||||
else {
|
||||
clearTimeout(motionTimeout);
|
||||
}
|
||||
this.motionDetected = motionDetected;
|
||||
});
|
||||
camera.onMotionDetectedPolling?.subscribe(async motionDetected => {
|
||||
if (motionDetected)
|
||||
if (motionDetected) {
|
||||
this.console.log(camera.name, 'onMotionDetected');
|
||||
resetTimeout();
|
||||
}
|
||||
else {
|
||||
clearTimeout(motionTimeout);
|
||||
}
|
||||
this.motionDetected = motionDetected;
|
||||
});
|
||||
camera.onBatteryLevel?.subscribe(async () => {
|
||||
|
||||
Reference in New Issue
Block a user