@@ -172,12 +172,7 @@ export class NoIPPlatform implements DynamicPlatformPlugin {
172172 existingAccessory . context . device = device
173173 existingAccessory . displayName = device . configDeviceName
174174 ? await this . validateAndCleanDisplayName ( device . configDeviceName , 'configDeviceName' , device . userDefinedDeviceName )
175- : await this . validateAndCleanDisplayName ( hostname , 'hostname' , hostname )
176-
177- // Ensure displayName is not empty
178- if ( ! existingAccessory . displayName ) {
179- existingAccessory . displayName = 'Unnamed Accessory'
180- }
175+ : hostname ? await this . validateAndCleanDisplayName ( hostname , 'hostname' , hostname ) : 'Unnamed Accessory'
181176
182177 existingAccessory . context . serialNumber = device . ipv4or6 === 'ipv6' ? await this . publicIPv6 ( device ) : await this . publicIPv4 ( device )
183178 existingAccessory . context . model = 'DUC'
@@ -203,12 +198,7 @@ export class NoIPPlatform implements DynamicPlatformPlugin {
203198 accessory . context . device = device
204199 accessory . displayName = device . configDeviceName
205200 ? await this . validateAndCleanDisplayName ( device . configDeviceName , 'configDeviceName' , device . userDefinedDeviceName )
206- : await this . validateAndCleanDisplayName ( hostname , 'hostname' , hostname )
207-
208- // Ensure displayName is not empty
209- if ( ! accessory . displayName ) {
210- accessory . displayName = 'Unnamed Accessory'
211- }
201+ : hostname ? await this . validateAndCleanDisplayName ( hostname , 'hostname' , hostname ) : 'Unnamed Accessory'
212202
213203 accessory . context . serialNumber = device . ipv4or6 === 'ipv6' ? await this . publicIPv6 ( device ) : await this . publicIPv4 ( device )
214204 accessory . context . model = 'DUC'
0 commit comments