# @harmonyhub/discover

> Discover available Logitech Harmony Hubs in the current network.

Latest version **1.0.9** (published 2021-10-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install @harmonyhub/discover
pnpm add @harmonyhub/discover
yarn add @harmonyhub/discover
bun add @harmonyhub/discover
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2021-10-27 |
| First published | 2018-08-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 32.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | AirBorne04, original authored by Manuel Alabor |
| Maintainers | airborne04 |
| Keywords | logitech, harmony, hub, remote, api, discover, search |

## Links

- npm: https://www.npmjs.com/package/@harmonyhub/discover
- Repository: https://github.com/AirBorne04/harmonyhub.git#master
- Homepage: https://github.com/AirBorne04/harmonyhub/tree/master/packages/discover
- Issues: https://github.com/AirBorne04/harmonyhub/issues
- npm.io page: https://npm.io/package/@harmonyhub/discover

## Dependencies (2)

- [debug](https://npm.io/package/debug.md) ^4.1.1
- [autobind-decorator](https://npm.io/package/autobind-decorator.md) ^2.4.0

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.9 (latest) — 2021-10-27
- 1.0.8 — 2019-02-26
- 1.0.7 — 2019-01-25
- 1.0.6 — 2019-01-10
- 1.0.5 — 2018-09-18
- 1.0.4 — 2018-08-16
- 1.0.3 — 2018-08-15
- 1.0.2 — 2018-08-14
- 1.0.1 — 2018-08-14
- 1.0.0 — 2018-08-08

## README

# Discover package

`@harmonyhub/discover` is a package which detects available Logitech Harmony hubs in the local network.

It is based upon [@swissmanu](https://github.com/swissmanu) harmonyhubjs-discover

## Installation

```bash
npm install @harmonyhub/discover
```

## Enhancements

Enhancements over the harmonyhubjs-discover package are the following
* rewrite to class style
* replacement of Q library with native nodejs Promises (dep reduction)
* update of dependencies to newer packages (0 security issues by npm audit)
* fix of issue of [non closing socket](https://github.com/swissmanu/harmonyhubjs-discover/issues/5)
* fix the issue of [multiple clients](https://github.com/swissmanu/harmonyhubjs-discover/issues/4)

## Usage

```javascript
const Explorer = require('@harmonyhub/discover').Explorer;
const discover = new Explorer(61991);

discover.on('online', function(hub) {
	// Triggered when a new hub was found
	console.log('discovered ' + hub.ip);
});

discover.on('offline', function(hub) {
	// Triggered when a hub disappeared
	console.log('lost ' + hub.ip);
});

discover.on('update', function(hubs) {
	// Combines the online & update events by returning an array with all known
	// hubs for ease of use.
	const knownHubIps = hubs.reduce(function(prev, hub) {
		return prev + (prev.length > 0 ? ', ' : '') + hub.ip;
	}, '');

	console.log('known ips: ' + knownHubIps);
});

// Look for hubs:
discover.start();

// Stop looking for hubs again and close the app:
setTimeout(discover.stop, 5000);
```

### Further Examples

There are further examples available within the [examples/](examples/) directory.

## Control your hub

After looking up your Harmony hub, use [@harmonyhub/client](https://github.com/AirBorne04/harmonyhub/packages/client) to control it.


## Debug Traces

`@harmonyhub/discover` uses [debug](https://github.com/visionmedia/debug) for generating traces throughout its execution time. Activate them by setting the `DEBUG` environment variable:

```bash
DEBUG=harmonyhub:discover:* node myharmonyjsapp.js
```

## Contribution

The `master` branch contains the latest stable release of the application.
Development efforts are integrated with the `develop` branch first. Changes get then merged into `master` as soon as a new release should be published.

Thank you for your contribution!

---
_Source: https://npm.io/package/@harmonyhub/discover · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
