# harmony-websocket

> Websocket implementation for Harmony Hub

Latest version **1.5.5** (published 2021-03-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install harmony-websocket
pnpm add harmony-websocket
yarn add harmony-websocket
bun add harmony-websocket
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.5 |
| Published | 2021-03-30 |
| First published | 2018-12-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 16.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | lopelex |
| Maintainers | lopelexone |
| Keywords | harmony, websocket |

## Links

- npm: https://www.npmjs.com/package/harmony-websocket
- Repository: https://github.com/lopelex/harmony-websocket
- Homepage: https://github.com/lopelex/harmony-websocket#readme
- Issues: https://github.com/lopelex/harmony-websocket/issues
- npm.io page: https://npm.io/package/harmony-websocket

## Dependencies (3)

- [ws](https://npm.io/package/ws.md) ^7.4.2
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.1
- [websocket-as-promised](https://npm.io/package/websocket-as-promised.md) ^1.0.1

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.5.5 (latest) — 2021-03-30
- 1.5.4 — 2021-01-30
- 1.5.3 — 2020-10-03
- 1.5.2 — 2020-06-15
- 1.5.1 — 2020-04-09
- 1.5.0 — 2019-09-09
- 1.4.0 — 2019-08-28
- 1.3.0 — 2019-08-15
- 1.2.0 — 2019-07-08
- 1.1.0 — 2019-05-30
- 1.0.9 — 2019-03-24
- 1.0.8 — 2019-03-19
- 1.0.7 — 2019-02-19
- 1.0.6 — 2019-02-15
- 1.0.5 — 2019-02-07
- … 5 more at https://npm.io/package/harmony-websocket/versions

## README

# harmony-websocket

[![npm](https://img.shields.io/npm/v/harmony-websocket/latest.svg)](https://www.npmjs.com/package/harmony-websocket)	 
[![npm package](https://img.shields.io/npm/dm/harmony-websocket.svg)](https://www.npmjs.com/package/harmony-websocket)

Websocket implementation for Harmony Hub


## Getting started

```
const Harmony = require('harmony-websocket');
const harmony = new Harmony();

harmony.on('open', () => {
    console.log('open');
});

harmony.on('close', () => {
    console.log('close');
});

harmony.on('stateDigest', (data) => {
    console.log(data);
});

harmony.on('automationState', (data) => {
    console.log(data);
});

harmony.connect(ip)

    // .then(() => harmony.getConfig())
    // .then(response => console.log(response))

    .then(() => harmony.getActivities())
    .then(response => console.log(response))

    // .then(() => harmony.getCurrentActivity())
    // .then(response => console.log(response))

    // .then(() => harmony.startActivity(activityId))
    // .then(response => console.log(response))

    // .then(() => harmony.getActivityCommands(activityId))
    // .then(response => console.log(response))

    // .then(() => harmony.getDevices())
    // .then(response => console.log(response))

    // .then(() => harmony.getDeviceCommands(DeviceId))
    // .then(response => console.log(response))

    // .then(() => harmony.getAutomationCommands())
    // .then(response => console.log(response))

    // .then(() => harmony.sendCommand('{"command":"command","type":"IRCommand","deviceId":"DeviceId"}'))
    // .then(response => console.log(response))

    // .then(() => harmony.sendCommandWithDelay('{"command":"command","type":"IRCommand","deviceId":"DeviceId"}', 50))
    // .then(response => console.log(response))

    // .then(() => harmony.sendAutomationCommand({
    //     "hueId" : {
    //         "on" : "true"
    //     }
    // }))
    // .then(response => console.log(response))

    // .then(() => harmony.close())

    .catch(e => console.error(e.message));
```

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

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