Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Correct name to the Accessories #428

Open
carlosgamezvillegas opened this issue Jul 4, 2023 · 1 comment
Open

Add Correct name to the Accessories #428

carlosgamezvillegas opened this issue Jul 4, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@carlosgamezvillegas
Copy link

When adding switches or other devices their name is not shown correctly. I have found out that if the following is added the name of each accessory will be shown correctly when they are added in HomeKit.

code lines that could be added:

  service.addOptionalCharacteristic(Characteristic.ConfiguredName);
  service.setCharacteristic(Characteristic.ConfiguredName, accesoryName);

I added those lines in the function below and it fixed the issue

getSwitchService(harmonyPlatform, accessory, switchName, serviceSubType) {
let service = accessory.getServiceByUUIDAndSubType(switchName, serviceSubType);
if (!service) {
harmonyPlatform.log(
'(' +
harmonyPlatform.name +
')' +
'INFO - Creating Switch Service ' +
switchName +
'/' +
serviceSubType
);
service = new Service.Switch(switchName, 'switchService' + switchName);
service.addOptionalCharacteristic(Characteristic.ConfiguredName);
service.setCharacteristic(Characteristic.ConfiguredName, switchName);
service.subtype = serviceSubType;
accessory.addService(service);
}
return service;

Kind regards

@carlosgamezvillegas carlosgamezvillegas added the enhancement New feature or request label Jul 4, 2023
@nicoduj
Copy link
Owner

nicoduj commented Jan 2, 2024

Hi, it was done on purpose, since the name can be set in the config with the "pipe" syntax, but I will check if this option is better for common use case, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants