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

Update index.js #649

Merged
merged 1 commit into from
Nov 26, 2023
Merged

Update index.js #649

merged 1 commit into from
Nov 26, 2023

Conversation

zazula
Copy link
Contributor

@zazula zazula commented Oct 29, 2023

Send service names to HomeKit using the ConfiguredName characteristic.

We could also watch for name changes in HomeKit and store them but I didn't see a clear path to that. Something like:

service.getCharacteristic(Characteristic.ConfiguredName)
.onSet(/* store the new name */);

Send service names to HomeKit.
@arachnetech
Copy link
Owner

Looks uncontroversial, but before I merge could you give me some background on the purpose of this change please? Thanks in advance, David.

@zazula
Copy link
Contributor Author

zazula commented Nov 26, 2023

Thanks for listening. Without this change, all services have the name given to the accessory at the top level, e.g.,

{
  accessory: "mqttthing",
  name: <<<< this field
  ...
}

With this change, each service gets the individual name specified along with it, e.g.,

{
  accessory: "mqttthing",
  name: "big daddy",
  ...
  "services" : [
    type: "motionsensor",
    name: <<<< this field
  ...
}

So, you see the name for each service in Home.app instead of a bunch of switches or whatever with the same name.

@arachnetech
Copy link
Owner

Thanks, I understand. Sorry it's taken me so long to get around to merging, incidentally - work has been even busier than usual and I just haven't made time for mqttthing!

@arachnetech arachnetech merged commit f7e2ef2 into arachnetech:master Nov 26, 2023
@arachnetech
Copy link
Owner

Is there anything that we can do to fix #656? Perhaps your new behaviour needs to be optional, enabled by another configuration setting?

arachnetech added a commit that referenced this pull request Dec 17, 2023
This reverts commit f7e2ef2, reversing
changes made to ab3e071.
@zazula
Copy link
Contributor Author

zazula commented Dec 21, 2023

Is there anything that we can do to fix #656? Perhaps your new behaviour needs to be optional, enabled by another configuration setting?

Yes, we can watch for 'onSet' of 'Characteristic.ConfiguredName' on all services and write out an updated config file. The homebridge API package includes a method for this:

https://www.jsdocs.io/package/homebridge#API.updatePlatformAccessories

However, I looked and don't see an existing code path that writes out the config file currently.

Also, we'd want to handle changes to any of the derived names (e.g., speakers and inputs in a 'television' service).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants