harmony-websocket

1.5.5 • Public • Published

harmony-websocket

npm npm package

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 file for details

Readme

Keywords

Package Sidebar

Install

npm i harmony-websocket

Weekly Downloads

50

Version

1.5.5

License

MIT

Unpacked Size

16.7 kB

Total Files

6

Last publish

Collaborators

  • lopelexone