UNPKG

harmonyhubjs-discover

Version:

Discover available Logitech Harmony Hubs in the current network.

20 lines (14 loc) 431 B
const discover = new (require('../'))(61991) discover.on('online', function (hub) { console.log('discovered ' + hub.ip) }) discover.on('offline', function (hub) { console.log('lost ' + hub.ip) }) discover.on('update', function (hubs) { const knownHubIps = hubs.reduce(function (prev, hub) { return prev + (prev.length > 0 ? ', ' : '') + hub.ip }, '') console.log('known ips: ' + knownHubIps) }) discover.start()