unifi-protect: make connecitonHost an options

This commit is contained in:
Koushik Dutta
2023-10-19 14:59:55 -07:00
parent f07604de4c
commit e8a5d5cfd3
4 changed files with 12 additions and 4 deletions

View File

@@ -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",

View File

@@ -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",

View File

@@ -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,

View File

@@ -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()) {