Skip to content

Commit

Permalink
Housekeeping.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjdhjd committed Sep 26, 2024
1 parent 1b526a9 commit b6131d9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/devices/protect-camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ export class ProtectCamera extends ProtectDevice {
let cameraChannels = this.ufp.channels.filter(x => x.isRtspEnabled);

// Set the camera and shapshot URLs.
const cameraUrl = "rtsps://" + (this.nvr.config.overrideAddress ?? this.ufp.connectionHost) + ":" + this.nvr.ufp.ports.rtsps.toString() + "/";
const cameraUrl = "rtsps://" + (this.nvr.config.overrideAddress ?? this.ufp.connectionHost ?? this.nvr.ufp.host) + ":" + this.nvr.ufp.ports.rtsps.toString() + "/";

// Filter out any package camera entries. We deal with those independently in the package camera class.
cameraChannels = cameraChannels.filter(x => x.name !== "Package Camera");
Expand Down Expand Up @@ -1217,7 +1217,8 @@ export class ProtectCamera extends ProtectDevice {

// Grab all the available RTSP channels and return them as a JSON.
return JSON.stringify(Object.assign({}, ...this.ufp.channels.filter(channel => channel.isRtspEnabled)
.map(channel => ({ [channel.name]: "rtsps://" + this.nvr.ufp.host + ":" + this.nvr.ufp.ports.rtsp + "/" + channel.rtspAlias + "?enableSrtp" }))));
.map(channel => ({ [channel.name]: "rtsps://" + (this.nvr.config.overrideAddress ?? this.ufp.connectionHost ?? this.nvr.ufp.host) + ":" +
this.nvr.ufp.ports.rtsp + "/" + channel.rtspAlias + "?enableSrtp" }))));
});

// Trigger snapshots when requested.
Expand Down
2 changes: 1 addition & 1 deletion src/devices/protect-device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export abstract class ProtectDevice extends ProtectBase {
// Sync the Protect name with HomeKit, if configured.
if(this.hints.syncName) {

this.accessoryName = this.ufp.name;
this.accessoryName = this.ufp.name ?? this.ufp.marketName ?? ("Unknown Device" + (this.ufp.mac ? ": " + this.ufp.mac : ""));
}

return this.setInfo(this.accessory, this.ufp);
Expand Down
2 changes: 1 addition & 1 deletion src/protect-nvr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ export class ProtectNvr {
// See if we already know about this accessory or if it's truly new. If it is new, add it to HomeKit.
if((accessory = this.platform.accessories.find(x => x.UUID === uuid)) === undefined) {

accessory = new this.api.platformAccessory(device.name ?? device.marketName, uuid);
accessory = new this.api.platformAccessory(device.name ?? device.marketName ?? ("Unknown Device" + (device.mac ? ": " + device.mac : "")), uuid);

this.log.info("%s: Adding %s to HomeKit%s.", this.ufpApi.getDeviceName(device), device.modelKey,
this.hasFeature("Device.Standalone", device) ? " as a standalone device" : "");
Expand Down

0 comments on commit b6131d9

Please sign in to comment.