diff --git a/plugins/amcrest/ad110.md b/plugins/amcrest/ad110.md new file mode 100644 index 000000000..738d76833 --- /dev/null +++ b/plugins/amcrest/ad110.md @@ -0,0 +1,60 @@ +# Amcrest Doorbell 110 + +Below is the doorbell event from an AD110: + +``` +event --myboundary +Content-Type: text/plain +Content-Length:135 + +Code=NTPAdjustTime;action=Pulse;index=0;data={ + "Address" : "200.160.0.8", + "Before" : "2022-04-06 20:07:56", + "result" : true +} + + + +event --myboundary +Content-Type: text/plain +Content-Length:148 + +Code=_DoTalkAction_;action=Pulse;index=0;data={ + "Action" : "Invite", + "CallID" : "20220406200813@670064@192.168.x.x”, + "CallSrcMask" : 4 +} + + + +event --myboundary +Content-Type: text/plain +Content-Length:68 + +Code=CallNoAnswered;action=Start;index=0;data={ + "CallID" : "8" +} + + + +[HomeKit]: snapshot requested for reason: 1 +[HomeKit]: snapshot requested for reason: 1 +[HomeKit]: snapshot requested for reason: 1 +event --myboundary +Content-Type: text/plain +Content-Length:39 + +Code=CallNoAnswered;action=Stop;index=0 + + +event --myboundary +Content-Type: text/plain +Content-Length:185 + +Code=_DoTalkAction_;action=Pulse;index=0;data={ + "Action" : "Hangup", + "CallID" : "20220406200813@670064@192.168.x.x”, + "CallSrcMask" : 4, + "HangupReason" : "HangupByPhone" +} +``` diff --git a/plugins/amcrest/ad410.md b/plugins/amcrest/ad410.md new file mode 100644 index 000000000..3db78d4a3 --- /dev/null +++ b/plugins/amcrest/ad410.md @@ -0,0 +1,106 @@ +# Amcrest Doorbell 410 + +Below is the doorbell event from an AD410: + + +``` +event --myboundary +Content-Type: text/plain +Content-Length:41 + +Code=_CallRemoveMask;action=Start;index=0 + + +event --myboundary +Content-Type: text/plain +Content-Length:36 + +Code=AlarmLocal;action=Start;index=0 + + +event --myboundary +Content-Type: text/plain +Content-Length:148 + +Code=_DoTalkAction_;action=Pulse;index=0;data={ + "Action" : "Invite", + "CallID" : "20220406135211@095697@192.168.10.20", + "CallSrcMask" : 4 +} + + + +event --myboundary +Content-Type: text/plain +Content-Length:68 + +Code=CallNoAnswered;action=Start;index=0;data={ + "CallID" : "4" +} + + + +event --myboundary +Content-Type: text/plain +Content-Length:41 + +Code=PhoneCallDetect;action=Start;index=0 + +event --myboundary +Content-Type: text/plain +Content-Length:41 + +Code=VideoMotionInfo;action=State;index=0 + +event --myboundary +Content-Type: text/plain +Content-Length:185 + +Code=_DoTalkAction_;action=Pulse;index=0;data={ + "Action" : "Hangup", + "CallID" : "20220406135211@095697@192.168.10.20", + "CallSrcMask" : 4, + "HangupReason" : "HangupByPhone" +} + + + +event --myboundary +Content-Type: text/plain +Content-Length:35 + +Code=AlarmLocal;action=Stop;index=0 + + +event --myboundary +Content-Type: text/plain +Content-Length:39 + +Code=CallNoAnswered;action=Stop;index=0 + + +event --myboundary +Content-Type: text/plain +Content-Length:95 + +Code=VideoMotion;action=Stop;index=0;data={ + "Id" : [ 0 ], + "RegionName" : [ "Region1" ] +} + + + +event --myboundary +Content-Type: text/plain +Content-Length:40 + +Code=PhoneCallDetect;action=Stop;index=0 + + +event --myboundary +Content-Type: text/plain +Content-Length:40 + +Code=_CallRemoveMask;action=Stop;index=0 +``` + diff --git a/plugins/amcrest/package-lock.json b/plugins/amcrest/package-lock.json index 482d7c9f5..1157e5180 100644 --- a/plugins/amcrest/package-lock.json +++ b/plugins/amcrest/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/amcrest", - "version": "0.0.94", + "version": "0.0.95", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/amcrest", - "version": "0.0.94", + "version": "0.0.95", "license": "Apache", "dependencies": { "@koush/axios-digest-auth": "^0.8.5", diff --git a/plugins/amcrest/package.json b/plugins/amcrest/package.json index fc74147e0..d5c096f1e 100644 --- a/plugins/amcrest/package.json +++ b/plugins/amcrest/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/amcrest", - "version": "0.0.94", + "version": "0.0.95", "description": "Amcrest Plugin for Scrypted", "author": "Scrypted", "license": "Apache", diff --git a/plugins/amcrest/src/amcrest-api.ts b/plugins/amcrest/src/amcrest-api.ts index 7e28222cf..3482b5228 100644 --- a/plugins/amcrest/src/amcrest-api.ts +++ b/plugins/amcrest/src/amcrest-api.ts @@ -74,7 +74,7 @@ export class AmcrestCameraClient { // this.console?.log('event', data); for (const event of Object.values(AmcrestEvent)) { if (data.indexOf(event) !== -1) { - stream.emit('event', event, index); + stream.emit('event', event, index, data); } } }); diff --git a/plugins/amcrest/src/main.ts b/plugins/amcrest/src/main.ts index 2ead0a6cb..29eac9301 100644 --- a/plugins/amcrest/src/main.ts +++ b/plugins/amcrest/src/main.ts @@ -137,7 +137,7 @@ class AmcrestCamera extends RtspSmartCamera implements VideoCameraConfiguration, if (this.storage.getItem('debug')) this.console.log('event', data.toString()); }); - events.on('event', (event: AmcrestEvent, index: string) => { + events.on('event', (event: AmcrestEvent, index: string, payload: string) => { const channelNumber = this.getRtspChannel(); if (channelNumber) { const idx = parseInt(index) + 1; @@ -158,14 +158,24 @@ class AmcrestCamera extends RtspSmartCamera implements VideoCameraConfiguration, } else if (event === AmcrestEvent.TalkInvite || event === AmcrestEvent.PhoneCallDetectStart - || event === AmcrestEvent.AlarmIPCStart || event === AmcrestEvent.DahuaTalkInvite) { + || event === AmcrestEvent.AlarmIPCStart + || event === AmcrestEvent.DahuaTalkInvite) { this.binaryState = true; } else if (event === AmcrestEvent.TalkHangup || event === AmcrestEvent.PhoneCallDetectStop - || event === AmcrestEvent.AlarmIPCStop || event === AmcrestEvent.DahuaTalkHangup) { + || event === AmcrestEvent.AlarmIPCStop + || event === AmcrestEvent.DahuaTalkHangup) { this.binaryState = false; } + else if (event === AmcrestEvent.TalkPulse && doorbellType === AMCREST_DOORBELL_TYPE) { + if (payload.includes('Invite')) { + this.binaryState = true; + } + else if (payload.includes('Hangup')) { + this.binaryState = false; + } + } else if (event === AmcrestEvent.DahuaTalkPulse && doorbellType === DAHUA_DOORBELL_TYPE) { clearTimeout(pulseTimeout); pulseTimeout = setTimeout(() => this.binaryState = false, 3000);