How to use the sonos.DeviceDiscovery function in sonos

To help you get started, we’ve selected a few sonos examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github denysvitali / sonos-web / server.js View on Github external
function init() {
    sonos.DeviceDiscovery(function (device) {
        debug(`Found ZP at ${device.host}:${device.port}`);
        thePlayer = device;
        console.log(thePlayer.getName().then((name) => {
            SonosWeb.menu.playerName = name;
        }));
        //thePlayer.selectQueue();

        var listener = Listener;
        listener.startListener();

        listener.subscribeTo(device).then(result => {
            console.log('Manually subscribed to sonos events')
        })

        // Or start listening for events on the sonos itself, will call the listener in the background
        device.on('CurrentTrack', track => {
github tim-hellhake / sonos-adapter / adapter.js View on Github external
startPairing(_timeoutSeconds) {
        this.deviceDiscovery = DeviceDiscovery({
            timeout: _timeoutSeconds * 1000
        }, (device) => {
            this.addDevice(device).catch(console.warn);
        });
    }