Skip to content

Commit 3c77d8f

Browse files
committed
fix: drop ConfiguredName HIG warning
1 parent 7cefcf2 commit 3c77d8f

3 files changed

Lines changed: 19 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to `@homebridge/hap-nodejs` will be documented in this file. This project tries to adhere to [Semantic Versioning](http://semver.org/).
44

5+
## v2.1.5 (Pending Release)
6+
7+
### Changes
8+
9+
- fix: drop `ConfiguredName` HIG warning
10+
511
## v2.1.4 (2026-05-04)
612

713
### Changes

src/lib/Accessory.spec.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -567,11 +567,14 @@ describe("Accessory", () => {
567567
await accessoryBadName?.destroy();
568568
});
569569

570-
test("Service ConfiguredName beginning with '", async () => {
571-
const switchService = new Service.Switch("My Bad Switch");
572-
const accessoryBadName = new Accessory("Bad Name",uuid.generate("Bad Name"));
570+
test("Service ConfiguredName is not subject to Name character checks", async () => {
571+
// ConfiguredName is the user-editable label on services like InputSource,
572+
// Television and SmartSpeaker. Home accepts a wider character set there
573+
// than the HIG suggests for Name, so HAP-NodeJS must not warn on it.
574+
const switchService = new Service.Switch("Switch");
575+
const accessoryConfiguredName = new Accessory("Configured Name", uuid.generate("Configured Name"));
573576
switchService.addCharacteristic(Characteristic.ConfiguredName);
574-
accessoryBadName.addService(switchService);
577+
accessoryConfiguredName.addService(switchService);
575578

576579
const publishInfo: PublishInfo = {
577580
username: serverUsername,
@@ -580,17 +583,16 @@ describe("Accessory", () => {
580583
advertiser: undefined,
581584
};
582585

583-
await accessoryBadName.publish(publishInfo);
586+
await accessoryConfiguredName.publish(publishInfo);
584587

588+
switchService.getCharacteristic(Characteristic.ConfiguredName).updateValue("Leave Home + 1");
585589
switchService.getCharacteristic(Characteristic.ConfiguredName).updateValue("'Bad Name");
586590

587-
expect(consoleWarnSpy).toHaveBeenCalledTimes(1);
588-
// eslint-disable-next-line max-len
589-
expect(consoleWarnSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'Configured Name' has an invalid 'ConfiguredName' characteristic (''Bad Name'). Please use only alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the accessory from being added in the Home App or cause unresponsiveness.");
591+
expect(consoleWarnSpy).not.toHaveBeenCalled();
590592

591-
await awaitEventOnce(accessoryBadName, AccessoryEventTypes.ADVERTISED);
592-
await accessoryBadName?.unpublish();
593-
await accessoryBadName?.destroy();
593+
await awaitEventOnce(accessoryConfiguredName, AccessoryEventTypes.ADVERTISED);
594+
await accessoryConfiguredName?.unpublish();
595+
await accessoryConfiguredName?.destroy();
594596
});
595597

596598
});

src/lib/Characteristic.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ import {
270270
numericUpperBound,
271271
} from "./util/request-util";
272272
import { BASE_UUID, toShortForm } from "./util/uuid";
273-
import { checkName } from "./util/checkName";
274273

275274
const debug = createDebug("HAP-NodeJS:Characteristic");
276275

@@ -2803,10 +2802,6 @@ export class Characteristic extends EventEmitter {
28032802
value = value.substring(0, maxLength);
28042803
}
28052804

2806-
if (value.length > 0 && this.UUID === Characteristic.ConfiguredName.UUID) {
2807-
checkName(this.displayName, "ConfiguredName", value);
2808-
}
2809-
28102805
return value;
28112806
}
28122807
case Formats.DATA:

0 commit comments

Comments
 (0)