Skip to content

Commit

Permalink
added the pattern that is failing
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker committed Jun 28, 2024
1 parent 5eaaad3 commit 0d07582
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/lib/Characteristic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
5 changes: 2 additions & 3 deletions src/lib/util/checkName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
}
Expand Down

0 comments on commit 0d07582

Please sign in to comment.