Skip to content

feat: added more granular control for the discovery process#32

Merged
bwp91 merged 7 commits into
homebridge:latestfrom
kovapatrik:fix/discovery-control
Feb 26, 2026
Merged

feat: added more granular control for the discovery process#32
bwp91 merged 7 commits into
homebridge:latestfrom
kovapatrik:fix/discovery-control

Conversation

@kovapatrik
Copy link
Copy Markdown
Contributor

@kovapatrik kovapatrik commented Feb 24, 2026

♻️ Current situation

Currently, the discovery process is auto-started with the default 1 minute timeout, whenever HapClient is created. There should be a way to control this process more granular.

💡 Proposed solution

The config object got extended with 2 new field:

  • autoStartDiscovery: controls, whether the discovery process should start upon creating the HapClient, defaults to true
  • discoveryTimeout: set the default discovery timeout, defaults to 60000 ms

With these defaults, HapClient behave like it does now, so it won't break current usages of the package.

⚙️ Release Notes

I've modified the changelog in this PR.

➕ Additional Information

-

Testing

I've added no extra tests for this.

Reviewer Nudging

-

This comment was marked as outdated.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread package.json Outdated
Comment thread README.md Outdated
Co-authored-by: Ben <43026681+bwp91@users.noreply.github.com>
@bwp91

This comment was marked as outdated.

@kovapatrik

This comment was marked as outdated.

This comment was marked as outdated.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

README.md:43

  • There's a spelling error: "settings" should be "setting". The text should read "by setting the autoStartDiscovery property".
It's possible to control the discovery process manually, by settings the `autoStartDiscovery` property to `false` and then calling `this.hapClient.startDiscovery(discoveryTimeout?: number)` when ready. If no timeout is provided to the function, the `discoveryTimeout` property will be used from the `config` object, and if that is not provided either, the default discovery timeout (60 seconds) will be used.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/index.ts
Copy link
Copy Markdown
Contributor

@bwp91 bwp91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍾

@bwp91 bwp91 merged commit cc9f60f into homebridge:latest Feb 26, 2026
6 checks passed
@kovapatrik
Copy link
Copy Markdown
Contributor Author

One thing came to my mind: I missed adding the discovery-stopped event to the event list.

@bwp91
Copy link
Copy Markdown
Contributor

bwp91 commented Feb 26, 2026

One thing came to my mind: I missed adding the discovery-stopped event to the event list.

ah can you please create another PR against the latest branch

@kovapatrik
Copy link
Copy Markdown
Contributor Author

One thing came to my mind: I missed adding the discovery-stopped event to the event list.

ah can you please create another PR against the latest branch

Yes, of course. Here it is: #33

@bwp91
Copy link
Copy Markdown
Contributor

bwp91 commented Feb 26, 2026

@kovapatrik this is all included in v3.3.1-beta.2 of hap-client. I assume that you are using this package in some form of development - so i was hoping you could use this beta version for a little while.
And once you are happy and confident that all is okay, then we can release this in v3.4.0

@kovapatrik kovapatrik deleted the fix/discovery-control branch February 26, 2026 09:51
@kovapatrik
Copy link
Copy Markdown
Contributor Author

@kovapatrik this is all included in v3.3.1-beta.2 of hap-client. I assume that you are using this package in some form of development - so i was hoping you could use this beta version for a little while. And once you are happy and confident that all is okay, then we can release this in v3.4.0

Yeah, sure! I won't be able to test it this weekend, but at the start of next week I will.

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.

3 participants