amcrest: doorbell pulse fix

This commit is contained in:
Koushik Dutta
2021-10-16 16:01:00 -07:00
parent 6c7d499840
commit 5f8ac6988e
4 changed files with 26 additions and 12 deletions

View File

@@ -1,23 +1,26 @@
{
"name": "@scrypted/amcrest",
"version": "0.0.56",
"version": "0.0.57",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/amcrest",
"version": "0.0.56",
"version": "0.0.57",
"license": "Apache",
"dependencies": {
"@koush/axios-digest-auth": "^0.7.2",
"@scrypted/sdk": "file:../../sdk",
"@types/multiparty": "^0.0.33",
"multiparty": "^4.2.2"
},
"devDependencies": {
"@types/node": "^16.11.0"
}
},
"../../sdk": {
"name": "@scrypted/sdk",
"version": "0.0.79",
"version": "0.0.81",
"license": "ISC",
"dependencies": {
"@babel/core": "^7.2.2",
@@ -30,7 +33,7 @@
"@babel/preset-typescript": "^7.15.0",
"@types/node": "^16.6.1",
"adm-zip": "^0.4.13",
"axios": "^0.21.1",
"axios": "^0.21.4",
"babel-loader": "^8.0.4",
"babel-plugin-const-enum": "^1.1.0",
"babel-plugin-minify-dead-code-elimination": "^0.5.1",
@@ -91,9 +94,9 @@
}
},
"node_modules/@types/node": {
"version": "16.7.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.10.tgz",
"integrity": "sha512-S63Dlv4zIPb8x6MMTgDq5WWRJQe56iBEY0O3SOFA9JrRienkOVDXSXBjjJw6HTNQYSE2JI6GMCR6LVbIMHJVvA=="
"version": "16.11.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.0.tgz",
"integrity": "sha512-8MLkBIYQMuhRBQzGN9875bYsOhPnf/0rgXGo66S2FemHkhbn9qtsz9ywV1iCG+vbjigE4WUNVvw37Dx+L0qsPg=="
},
"node_modules/axios": {
"version": "0.21.1",
@@ -245,7 +248,7 @@
"@babel/preset-typescript": "^7.15.0",
"@types/node": "^16.6.1",
"adm-zip": "^0.4.13",
"axios": "^0.21.1",
"axios": "^0.21.4",
"babel-loader": "^8.0.4",
"babel-plugin-const-enum": "^1.1.0",
"babel-plugin-minify-dead-code-elimination": "^0.5.1",
@@ -281,9 +284,9 @@
}
},
"@types/node": {
"version": "16.7.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.10.tgz",
"integrity": "sha512-S63Dlv4zIPb8x6MMTgDq5WWRJQe56iBEY0O3SOFA9JrRienkOVDXSXBjjJw6HTNQYSE2JI6GMCR6LVbIMHJVvA=="
"version": "16.11.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.0.tgz",
"integrity": "sha512-8MLkBIYQMuhRBQzGN9875bYsOhPnf/0rgXGo66S2FemHkhbn9qtsz9ywV1iCG+vbjigE4WUNVvw37Dx+L0qsPg=="
},
"axios": {
"version": "0.21.1",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/amcrest",
"version": "0.0.56",
"version": "0.0.57",
"description": "Amcrest Plugin for Scrypted",
"author": "Scrypted",
"license": "Apache",
@@ -33,5 +33,8 @@
"@scrypted/sdk": "file:../../sdk",
"@types/multiparty": "^0.0.33",
"multiparty": "^4.2.2"
},
"devDependencies": {
"@types/node": "^16.11.0"
}
}

View File

@@ -9,6 +9,7 @@ export enum AmcrestEvent {
AudioStop = "Code=AudioMutation;action=Stop",
TalkInvite = "Code=_DoTalkAction_;action=Invite",
TalkHangup = "Code=_DoTalkAction_;action=Hangup",
TalkPulse = "Code=_DoTalkAction_;action=Pulse",
AlarmIPCStart = "Code=AlarmIPC;action=Start",
AlarmIPCStop = "Code=AlarmIPC;action=Stop",
PhoneCallDetectStart = "Code=PhoneCallDetect;action=Start",

View File

@@ -34,6 +34,8 @@ class AmcrestCamera extends RtspSmartCamera implements Camera, Intercom {
events.destroy();
};
let pulseTimeout: NodeJS.Timeout;
events.on('close', () => ret.emit('error', new Error('close')));
events.on('error', e => ret.emit('error', e));
events.on('event', (event: AmcrestEvent) => {
@@ -59,6 +61,11 @@ class AmcrestCamera extends RtspSmartCamera implements Camera, Intercom {
|| event === AmcrestEvent.AlarmIPCStop) {
this.binaryState = false;
}
else if (event === AmcrestEvent.TalkPulse) {
clearTimeout(pulseTimeout);
pulseTimeout = setTimeout(() => this.binaryState = false, 30000);
this.binaryState = true;
}
})
}
catch (e) {