forked from bencevans/node-sonos
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswitchToLineIn.js
More file actions
19 lines (15 loc) · 745 Bytes
/
Copy pathswitchToLineIn.js
File metadata and controls
19 lines (15 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const Sonos = require('../').Sonos
const sonos = new Sonos(process.env.SONOS_HOST || '192.168.96.223')
sonos.getZoneInfo().then(data => {
// console.log('Got zone info %j', data)
// The mac is needed for switch to a different channel
const macCleaned = data.MACAddress.replace(/:/g, '')
console.log('Cleaned mac %j', macCleaned)
// To switch on a playbar do the following
const uri = 'x-sonos-htastream:RINCON_' + macCleaned + '01400:spdif'
// To switch on a Play:5 and Connect do the following
// var uri = 'x-rincon-stream:RINCON_' + macCleaned + '01400'
return sonos.setAVTransportURI(uri).then(result => {
console.log('Switched to different source!')
})
}).catch(err => { console.log('Error occurred %j', err) })