diff --git a/src/lib/Characteristic.ts b/src/lib/Characteristic.ts index 14ff76302..ed61e6b41 100644 --- a/src/lib/Characteristic.ts +++ b/src/lib/Characteristic.ts @@ -2892,7 +2892,7 @@ export class Characteristic extends EventEmitter { value = value.substring(0, maxLength); } - if (this.UUID === "000000E3-0000-1000-8000-0026BB765291") { + if (this.UUID === Characteristic.ConfiguredName.UUID) { checkName(this.displayName, "ConfiguredName", value); } diff --git a/src/lib/util/checkName.ts b/src/lib/util/checkName.ts index 5c8fa9198..b6e1f69c8 100644 --- a/src/lib/util/checkName.ts +++ b/src/lib/util/checkName.ts @@ -11,12 +11,11 @@ export function checkName(displayName: string, name: string, value: any): void { const endWith = /[a-zA-Z0-9]$/; // Ensure only letters or numbers are at the end of string const pattern = !validHK.test(value) ? "doesn't have only letter, numbers, apostrophe, or dash" : !startWith.test(value) ? "doesn't start with letter or number," - : !endWith.test(value) ? "doesn't end with letter or number," - : ""; + : !endWith.test(value) ? "doesn't end with letter or number," : "-"; if (!validHK.test(value) || !startWith.test(value) || !endWith.test(value)) { console.warn("HAP-NodeJS WARNING: The accessory '" + displayName + "' is getting published with the characteristic '" + - name + "'" + " not following HomeKit naming rules ('" + value + "'), " + "with a pattern that'" + pattern + "'." + + name + "'" + " not following HomeKit naming rules ('" + value + "', " + " with a pattern that'" + pattern + "'." + "Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. " + "This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!"); }