8.1.1 • Published 5 years ago

harmony-ws v8.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

harmony-ws

Control a Logitech Harmony Hub via the local network

Under the hood, this is a WebSocket implementation that works without XMPP. It is compatible with hub firmware 4.15.206 (released late December 2018) that broke errbody.

import HarmonyHub from 'harmony-ws';

const hub = new HarmonyHub('192.168.1.20');

hub.getActivities()
    .then((activities) => {
        console.log(activities);
        // [ { id: '-1', name: 'off', label: 'PowerOff' },
        // { id: '21642159', name: 'chromecast', label: 'Chromecast' },
        // { id: '26240332', name: 'tv', label: 'TV' },
        // { id: '26240296', name: 'roku', label: 'Roku' },
        // { id: '21641746', name: 'blu_ray', label: 'Blu-ray' } ]
    })

hub.getCurrentActivity()
    .then((activity) => {
        console.log(`Current activity is: ${activity.label}`);
    });

// start an activity by id, name, or label
hub.startActivity('chromecast')
    .then((activity) => {
        console.log(`Started activity: ${activity.label}`);
    });

// listen for changes to the current activity
hub.onActivityStarted((activity) => {
    console.log(`Activity started: ${activity.label}`);
});

// press a button (on the current activity or a specific device)
// optional second param is how long to hold the button (in milliseconds)
// optional second/third param is which device to use
hub.pressButton('volume down', 2000, 'samsung tv')
    .then((button) => {
        console.log(`Pressed button: ${button.label}`);
    });

// alias for startActivity('off')
hub.turnOff();

// refresh the internal cache
hub.refresh()
    .then((activities) => {
        console.log('Updated activity list', activities);
    });
8.1.1

5 years ago

8.1.0

5 years ago

8.0.1

5 years ago

8.0.0

5 years ago

7.1.0

5 years ago

7.0.1

5 years ago

7.0.0

5 years ago

6.0.1

5 years ago

6.0.0

5 years ago

5.2.0

5 years ago

5.1.0

5 years ago

5.0.0

5 years ago

4.0.0

5 years ago

3.0.0

5 years ago

2.0.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago