From d325df083f80702eb49a08611a5c1028967ad831 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Sat, 2 Mar 2024 18:23:48 -0800 Subject: [PATCH 1/5] install: use latest node 18 on windows --- install/local/install-scrypted-dependencies-win.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/local/install-scrypted-dependencies-win.ps1 b/install/local/install-scrypted-dependencies-win.ps1 index eab133c8e..9a556dbbf 100644 --- a/install/local/install-scrypted-dependencies-win.ps1 +++ b/install/local/install-scrypted-dependencies-win.ps1 @@ -8,7 +8,7 @@ sc.exe stop scrypted.exe iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) # Install node.js -choco upgrade -y nodejs-lts --version=18.14.0 +choco upgrade -y nodejs-lts --version=18.19.1 # Install Python choco upgrade -y python39 From e2067c156b51742d792034470073a7abec280bf0 Mon Sep 17 00:00:00 2001 From: ruby~ Date: Mon, 4 Mar 2024 02:45:08 +0900 Subject: [PATCH 2/5] amcrest: Add support for Dahua VTO locks to Amcrest plugin (#1356) --- plugins/amcrest/README.md | 2 ++ plugins/amcrest/src/amcrest-api.ts | 16 ++++++++++++++++ plugins/amcrest/src/main.ts | 30 ++++++++++++++++++++++++++++-- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/plugins/amcrest/README.md b/plugins/amcrest/README.md index 7ad7f7f4f..33a90d9b0 100644 --- a/plugins/amcrest/README.md +++ b/plugins/amcrest/README.md @@ -39,6 +39,8 @@ Each 'Channel' or (camera) Device attached to the NVR must be configured as sepa * `Snapshot URL Override` camera's IP address (preferred) or specific port number of NVR for that camera (may work). That is: `http:///cgi-bin/snapshot.cgi` or `http://:/cgi-bin/snapshot.cgi` * `Channel Number Override` camera's channel number as known to DVR +## Dahua Lock/Unlock +Dahua DTO video intercoms have built-in access control for locks/doors. If you have set the Amcrest plugin up with `Doorbell Type` set to `Dahua Doorbell`, you can enable support for remotely locking/unlocking by enabling/toggle the option `Enable Dahua Lock`. # Troubleshooting ## General diff --git a/plugins/amcrest/src/amcrest-api.ts b/plugins/amcrest/src/amcrest-api.ts index 4a402a6e8..bd9956388 100644 --- a/plugins/amcrest/src/amcrest-api.ts +++ b/plugins/amcrest/src/amcrest-api.ts @@ -125,4 +125,20 @@ export class AmcrestCameraClient { this.console.log(response.body); } } + + async unlock(): Promise { + const response = await this.request({ + url: `http://${this.ip}/cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote`, + responseType: 'text', + }); + return response.body.includes('OK'); + } + + async lock(): Promise { + const response = await this.request({ + url: `http://${this.ip}/cgi-bin/accessControl.cgi?action=closeDoor&channel=1&UserID=101&Type=Remote`, + responseType: 'text', + }); + return response.body.includes('OK'); + } } diff --git a/plugins/amcrest/src/main.ts b/plugins/amcrest/src/main.ts index 072aa5621..bda943ca0 100644 --- a/plugins/amcrest/src/main.ts +++ b/plugins/amcrest/src/main.ts @@ -1,6 +1,6 @@ import { ffmpegLogInitialOutput } from '@scrypted/common/src/media-helpers'; import { readLength } from "@scrypted/common/src/read-stream"; -import sdk, { Camera, DeviceCreatorSettings, DeviceInformation, FFmpegInput, Intercom, MediaObject, MediaStreamOptions, PictureOptions, Reboot, RequestRecordingStreamOptions, ResponseMediaStreamOptions, ScryptedDeviceType, ScryptedInterface, ScryptedMimeTypes, Setting, VideoCameraConfiguration, VideoRecorder } from "@scrypted/sdk"; +import sdk, { Camera, DeviceCreatorSettings, DeviceInformation, FFmpegInput, Intercom, Lock, MediaObject, MediaStreamOptions, PictureOptions, Reboot, RequestRecordingStreamOptions, ResponseMediaStreamOptions, ScryptedDeviceType, ScryptedInterface, ScryptedMimeTypes, Setting, VideoCameraConfiguration, VideoRecorder } from "@scrypted/sdk"; import child_process, { ChildProcess } from 'child_process'; import { PassThrough, Readable, Stream } from "stream"; import { OnvifIntercom } from "../../onvif/src/onvif-intercom"; @@ -22,7 +22,7 @@ function findValue(blob: string, prefix: string, key: string) { return parts[1]; } -class AmcrestCamera extends RtspSmartCamera implements VideoCameraConfiguration, Camera, Intercom, VideoRecorder, Reboot { +class AmcrestCamera extends RtspSmartCamera implements VideoCameraConfiguration, Camera, Intercom, Lock, VideoRecorder, Reboot { eventStream: Stream; cp: ChildProcess; client: AmcrestCameraClient; @@ -270,6 +270,16 @@ class AmcrestCamera extends RtspSmartCamera implements VideoCameraConfiguration, if (doorbellType == DAHUA_DOORBELL_TYPE) { + ret.push( + { + title: 'Enable Dahua Lock', + key: 'enableDahuaLock', + description: 'Some Dahua Doorbells have a built in lock/door access control.', + type: 'boolean', + value: (this.storage.getItem('enableDahuaLock') === 'true').toString(), + } + ); + ret.push( { title: 'Multiple Call Buttons', @@ -462,6 +472,10 @@ class AmcrestCamera extends RtspSmartCamera implements VideoCameraConfiguration, if (isDoorbell || twoWayAudio) { interfaces.push(ScryptedInterface.Intercom); } + const enableDahuaLock = this.storage.getItem('enableDahuaLock') === 'true'; + if (isDoorbell && doorbellType === DAHUA_DOORBELL_TYPE && enableDahuaLock) { + interfaces.push(ScryptedInterface.Lock); + } const continuousRecording = this.storage.getItem('continuousRecording') === 'true'; if (continuousRecording) interfaces.push(ScryptedInterface.VideoRecorder); @@ -598,6 +612,18 @@ class AmcrestCamera extends RtspSmartCamera implements VideoCameraConfiguration, showRtspUrlOverride() { return false; } + + async lock(): Promise { + if (!this.client.lock()) { + this.console.error("Could not lock"); + } + } + + async unlock(): Promise { + if (!this.client.unlock()) { + this.console.error("Could not unlock"); + } + } } class AmcrestProvider extends RtspProvider { From 644f7d33047dbbe286d6fb10d54eec68bdff626c Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Sun, 3 Mar 2024 12:46:13 -0500 Subject: [PATCH 3/5] homekit: merge child device only if child has homekit enabled (#1343) --- plugins/homekit/src/types/common.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/homekit/src/types/common.ts b/plugins/homekit/src/types/common.ts index bea10e0bf..a000f4ead 100644 --- a/plugins/homekit/src/types/common.ts +++ b/plugins/homekit/src/types/common.ts @@ -3,6 +3,7 @@ import { bindCharacteristic } from "../common"; import { Accessory, Characteristic, CharacteristicEventTypes, Service, uuid } from '../hap'; import type { HomeKitPlugin } from "../main"; import { getService as getOnOffService } from "./onoff-base"; +import { HOMEKIT_MIXIN } from "../homekit-mixin"; const { deviceManager, systemManager } = sdk; @@ -201,7 +202,7 @@ export function mergeOnOffDevicesByType(device: ScryptedDevice & DeviceProvider, const children = getChildDevices(device); const mergedDevices = []; const services = children.map((child: ScryptedDevice & OnOff) => { - if (child.type !== type || !child.interfaces.includes(ScryptedInterface.OnOff)) + if (child.type !== type || !child.interfaces.includes(ScryptedInterface.OnOff) || !child.interfaces.includes(HOMEKIT_MIXIN)) return undefined; const onOffService = getOnOffService(child, accessory, Service.Switch) From f41a6383ae078f4973b6a1defdd12d760362958f Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Mon, 4 Mar 2024 12:16:50 -0800 Subject: [PATCH 4/5] homekit: Update README.md --- plugins/homekit/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/homekit/README.md b/plugins/homekit/README.md index 5bedafb49..22d627554 100644 --- a/plugins/homekit/README.md +++ b/plugins/homekit/README.md @@ -32,8 +32,10 @@ If recordings dont work, it's generally because of a few reasons, **follow the s ### HomeKit Discovery and Pairing Issues -If HomeKit is not discoverable, make sure LAN/WLAN multicast is enabled on your router. -If HomeKit fails while pairing during a Docker install, ensure host networking is being used. +* Ensure all your Home hubs are online and updated. Power cycling them is recommended in case one is stuck. +* Ensure LAN/WLAN multicast is enabled on your router. +* Ensure the iOS device you are using for pairing is on the same network (pairing will fail on cellular). +* Ensure the Docker installation (if applicable) is using host networking. This configuration is the default if the official Scrypted Docker compose install script was used. ### HomeKit Live Streaming Timeout (Recordings may be working) From 4e5f6885a97566c8c04c739480d29b631da035d3 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Mon, 4 Mar 2024 12:17:51 -0800 Subject: [PATCH 5/5] homekit: Update README.md --- plugins/homekit/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/homekit/README.md b/plugins/homekit/README.md index 22d627554..254e17227 100644 --- a/plugins/homekit/README.md +++ b/plugins/homekit/README.md @@ -52,6 +52,9 @@ This almost always due to your camera bitrate being too high for remote streamin 1) Use a lower bitrate substream for Remote Streaming. 2) Enable Transcoding on Remote Streaming. +Other things to check: +1) Ensure the Home app has cellular network permission. + ### mDNS Advertiser Options