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

Pass options to Discover #117

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,15 @@ Fields:

* "platform": Must always be "HarmonyHub" (required)
* "name": Can be anything (used in logs)
* "discoverOptions": an optional object of options to be passed to [harmonyhubjs-discover](https://github.com/swissmanu/harmonyhubjs-discover). On a system with multiple interfaces, or certain operating systems, you need to specify the broadcast address for the network the Harmony Hub is connected to. If your Hub is connected to the network 192.168.1.0/24, then you need to specify the address as 192.168.1.255:
```json
"platforms": [
{
"platform": "HarmonyHub",
"name": "Harmony Hub",
"discoverOptions": {
"address": "192.168.1.255"
}
}
]
```
4 changes: 2 additions & 2 deletions lib/home-platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ function HomePlatform(log, config, api) {
self._isInitialized = false;
self._autoAddNewHubs = false;

self._discover = new Discover(61991);
self._discover = new Discover(61991, config.discoverOptions || {});

self._discover.on('update', function (hubs) {
self.log.debug('received update event from harmonyhubjs-discover. there are ' + hubs.length + ' hubs');
self._discoveredHubs = hubs;
_.forEach(self._discoveredHubs, self._handleDiscoveredHubAsync.bind(self));
self.emit(Events.DiscoveredHubs, hubs);
});

self._discover.start();

if (api) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"bluebird": "^3.3.4",
"debug": "^2.2.0",
"harmonyhubjs-client": "^1.1.6",
"harmonyhubjs-discover": "^1.0.2",
"harmonyhubjs-discover": "^1.1.1",
"inherits": "^2.0.1",
"queue": "^3.1.0",
"lodash": "^4.6"
Expand Down