11/* Copyright(C) 2021-2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
22 *
3- * platform.ts: homebridge-noip.
3+ * platform.ts: @homebridge-plugins/ homebridge-noip.
44 */
55import type { API , DynamicPlatformPlugin , HAP , Logging , PlatformAccessory } from 'homebridge'
66
@@ -174,6 +174,11 @@ export class NoIPPlatform implements DynamicPlatformPlugin {
174174 ? await this . validateAndCleanDisplayName ( device . configDeviceName , 'configDeviceName' , device . userDefinedDeviceName )
175175 : await this . validateAndCleanDisplayName ( hostname , 'hostname' , hostname )
176176
177+ // Ensure displayName is not empty
178+ if ( ! existingAccessory . displayName ) {
179+ existingAccessory . displayName = 'Unnamed Accessory'
180+ }
181+
177182 existingAccessory . context . serialNumber = device . ipv4or6 === 'ipv6' ? await this . publicIPv6 ( device ) : await this . publicIPv4 ( device )
178183 existingAccessory . context . model = 'DUC'
179184 existingAccessory . context . version = await this . getVersion ( )
@@ -199,6 +204,12 @@ export class NoIPPlatform implements DynamicPlatformPlugin {
199204 accessory . displayName = device . configDeviceName
200205 ? await this . validateAndCleanDisplayName ( device . configDeviceName , 'configDeviceName' , device . userDefinedDeviceName )
201206 : await this . validateAndCleanDisplayName ( hostname , 'hostname' , hostname )
207+
208+ // Ensure displayName is not empty
209+ if ( ! accessory . displayName ) {
210+ accessory . displayName = 'Unnamed Accessory'
211+ }
212+
202213 accessory . context . serialNumber = device . ipv4or6 === 'ipv6' ? await this . publicIPv6 ( device ) : await this . publicIPv4 ( device )
203214 accessory . context . model = 'DUC'
204215 accessory . context . version = await this . getVersion ( )
0 commit comments