How to use the sonos.AsyncDeviceDiscovery 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 GPudgima / YT-SONOS / server / index.js View on Github external
app.get('/discover', function(req, res){
    let discovery = new DeviceDiscovery()
    discovery.discoverMultiple({ timeout: 5000 })
    .then((devices) => {
        let sonosDev = [];
        devices.forEach(device => {
            sonosDev.push(`${device.host}`);
        });

        res.json(sonosDev);
    })
    .catch((error) => {
        if(error){
            res.sendStatus(404);
        }
    });
});