diff --git a/src/devices/protect-camera.ts b/src/devices/protect-camera.ts index a450d55..e12a22f 100644 --- a/src/devices/protect-camera.ts +++ b/src/devices/protect-camera.ts @@ -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"); @@ -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. diff --git a/src/devices/protect-device.ts b/src/devices/protect-device.ts index f0303b3..4faad70 100644 --- a/src/devices/protect-device.ts +++ b/src/devices/protect-device.ts @@ -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); diff --git a/src/protect-nvr.ts b/src/protect-nvr.ts index 3f71ad6..0e8e2c5 100644 --- a/src/protect-nvr.ts +++ b/src/protect-nvr.ts @@ -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" : "");