Skip to content

Commit

Permalink
unifi-protect: make connecitonHost an options
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Oct 19, 2023
1 parent f07604d commit e8a5d5c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions plugins/unifi-protect/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/unifi-protect/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
3 changes: 2 additions & 1 deletion plugins/unifi-protect/src/camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions plugins/unifi-protect/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit e8a5d5c

Please sign in to comment.