From e8a5d5cfd327e494726f661edea498cef27bdf28 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Thu, 19 Oct 2023 14:59:55 -0700 Subject: [PATCH] unifi-protect: make connecitonHost an options --- plugins/unifi-protect/package-lock.json | 4 ++-- plugins/unifi-protect/package.json | 2 +- plugins/unifi-protect/src/camera.ts | 3 ++- plugins/unifi-protect/src/main.ts | 7 +++++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/plugins/unifi-protect/package-lock.json b/plugins/unifi-protect/package-lock.json index 4b0210e38..dec805eeb 100644 --- a/plugins/unifi-protect/package-lock.json +++ b/plugins/unifi-protect/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/unifi-protect", - "version": "0.0.138", + "version": "0.0.139", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/unifi-protect", - "version": "0.0.138", + "version": "0.0.139", "license": "Apache", "dependencies": { "@koush/unifi-protect": "file:../../external/unifi-protect", diff --git a/plugins/unifi-protect/package.json b/plugins/unifi-protect/package.json index bd1a0e6ce..d10ae17db 100644 --- a/plugins/unifi-protect/package.json +++ b/plugins/unifi-protect/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/unifi-protect", - "version": "0.0.138", + "version": "0.0.139", "description": "Unifi Protect Plugin for Scrypted", "author": "Scrypted", "license": "Apache", diff --git a/plugins/unifi-protect/src/camera.ts b/plugins/unifi-protect/src/camera.ts index 8e0244347..9b76210b6 100644 --- a/plugins/unifi-protect/src/camera.ts +++ b/plugins/unifi-protect/src/camera.ts @@ -317,7 +317,8 @@ export class UnifiCamera extends ScryptedDeviceBase implements Notifier, Interco const rtspChannel = camera.channels.find(check => check.id.toString() === vso.id); const { rtspAlias } = rtspChannel; - const u = `rtsps://${this.protect.getSetting('ip')}:7441/${rtspAlias}` + const ip = (this.protect.getSetting('useConnectionHost') !== 'false' && camera.connectionHost) || this.protect.getSetting('ip'); + const u = `rtsps://${ip}:7441/${rtspAlias}` const data = Buffer.from(JSON.stringify({ url: u, diff --git a/plugins/unifi-protect/src/main.ts b/plugins/unifi-protect/src/main.ts index c3ebf3cde..8567a9e6a 100644 --- a/plugins/unifi-protect/src/main.ts +++ b/plugins/unifi-protect/src/main.ts @@ -562,6 +562,13 @@ export class UnifiProtect extends ScryptedDeviceBase implements Settings, Device placeholder: '192.168.1.100', value: this.getSetting('ip') || '', }, + { + key: 'useConnectionHost', + title: 'Use Connection Host', + description: 'Uses the connection host to route to connect to the RTSP Stream, and is required for stacked UNVR configuraitons. Disabling this setting will always use the configured Unifi Protect IP for RTSP streaming.', + type: 'boolean', + value: this.getSetting('useConnectionHost') !== 'false', + } ]; if (!isInstanceableProviderModeEnabled()) {