HAP-NodeJS
HAP-NodeJS copied to clipboard
Implement warning messages for invalid characters in names
:recycle: Current situation
Invalid characters in names will trigger warning messages in the Home App. #1008
:bulb: Proposed solution
Implement warning messages for invalid characters in names
Sample warning messages
HAP-NodeJS WARNING: The service 'Play (Yamaha)' is getting published with the characteristic 'Name' not following HomeKit naming rules ('Play (Yamaha)'). 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!
HAP-NodeJS WARNING: The service 'Pause (Yamaha)' is getting published with the characteristic 'Name' not following HomeKit naming rules ('Pause (Yamaha)'). 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!
HAP-NodeJS WARNING: The service 'Skip Fwd (Yamaha)' is getting published with the characteristic 'Name' not following HomeKit naming rules ('Skip Fwd (Yamaha)'). 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!
HAP-NodeJS WARNING: The service 'Skip Rev (Yamaha)' is getting published with the characteristic 'Name' not following HomeKit naming rules ('Skip Rev (Yamaha)'). 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!
HAP-NodeJS WARNING: The accessory 'Spotify (Yamaha)' is getting published with the characteristic 'name' not following HomeKit naming rules ('Spotify (Yamaha)'). 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!
:gear: Release Notes
Warning messages will now be logged for names containing invalid characters
:heavy_plus_sign: Additional Information
If applicable, provide additional context in this section.
Testing
Testing has been augmented with test cases for the various scenarios.
Output from testing with one of my plugins that has the issue.
HAP-NodeJS WARNING: The service 'Play (Yamaha)' is getting published with the characteristic 'Name' not following HomeKit naming rules ('Play (Yamaha)'). 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!
HAP-NodeJS WARNING: The service 'Pause (Yamaha)' is getting published with the characteristic 'Name' not following HomeKit naming rules ('Pause (Yamaha)'). 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!
HAP-NodeJS WARNING: The service 'Skip Fwd (Yamaha)' is getting published with the characteristic 'Name' not following HomeKit naming rules ('Skip Fwd (Yamaha)'). 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!
HAP-NodeJS WARNING: The service 'Skip Rev (Yamaha)' is getting published with the characteristic 'Name' not following HomeKit naming rules ('Skip Rev (Yamaha)'). 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!
HAP-NodeJS WARNING: The accessory 'Spotify (Yamaha)' is getting published with the characteristic 'name' not following HomeKit naming rules ('Spotify (Yamaha)'). 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!
Reviewer Nudging
Where should the reviewer start? what is a good entry point?
@ebaauw @n0rt0nthec4t - Thanks for your input and feedback. I have tried to include
This almost needs to be at the characteristic level. An example being if you have an accessory which uses the Characteristic.ConfiguredName, setting this for HomeKit with invalid characters shows an error in HomeKit.
@n0rt0nthec4t - Let me look at that later today. As HAP-NodeJS attempts to be transparent to individual characteristics it could be challenging.
PS - Need to fix my new tests, they don't allow jest to shutdown correctly.
Pull Request Test Coverage Report for Build 5418498676
- 16 of 16 (100.0%) changed or added relevant lines in 4 files are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage increased (+0.05%) to 65.066%
| Totals | |
|---|---|
| Change from base Build 4845506880: | 0.05% |
| Covered Lines: | 7412 |
| Relevant Lines: | 10610 |
💛 - Coveralls
@NorthernMan54 looks like the tests might be failing because of this?
https://github.com/homebridge/HAP-NodeJS/actions/runs/9630265250/job/26560643569
If you look down the log, it is failing here - ● Test suite failed to run
src/lib/HAPServer.spec.ts:621:7 - error TS2578: Unused '@ts-expect-error' directive.
621 // @ts-expect-error: type mismatch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Something unrelated...