diff --git a/README.md b/README.md index 540da64..0688d30 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,11 @@ Please note: highlighting current playing favorite is not supported. ### **WORK IN PROGRESS** --> ## Changelog + +### WORK IN PROGRESS + +(seb2010) Added support to control bass and treble of a player (NO updates of these states on external events!) + ### 3.0.0 (2023-10-09) * (udondan) Added support for the playing Sonos playlists (added new state `playlist_set`) * (bluefox) The minimal node.js version is 16 diff --git a/main.js b/main.js index dd2f33f..f387add 100644 --- a/main.js +++ b/main.js @@ -148,6 +148,10 @@ function startAdapter(options) { } } else if (id.state === 'volume') { promise = player.setVolume(state.val); + } else if (id.state === 'treble') { + promise = player.setTreble(state.val); + } else if (id.state === 'bass') { + promise = player.setBass(state.val); } else if (id.state === 'state') { //stop,play,pause,next,previous,mute,unmute if (state.val && typeof state.val === 'string') { @@ -608,6 +612,28 @@ async function createChannel(name, ip, room) { desc: 'State and control of volume', name: 'Player volume' }, + treble: { + // level.treble - treble level (only write) + type: 'number', + read: false, + write: true, + role: 'level.treble', + min: -10, + max: 10, + desc: 'State and control of treble', + name: 'Player treble' + }, + bass: { + // level.bass - bass level (only write) + type: 'number', + read: false, + write: true, + role: 'level.bass', + min: -10, + max: 10, + desc: 'State and control of bass', + name: 'Player bass' + }, muted: { // media.muted - is muted (read only) def: false, @@ -1780,6 +1806,12 @@ function processSonosEvents(event, data) { adapter.log.debug(`volume: Volume for ${player.baseUrl}: ${data.newVolume}`); } } + } else if (event === 'treble') { + // node-sonos-discovery is not emitting any events on treble changes yet, so it is not + // possible to get the externally set treble value, yet. + } else if (event === 'bass') { + // node-sonos-discovery is not emitting any events on bass changes yet, so it is not + // possible to get the externally set bass value, yet. } else if (event === 'mute') { // { // uuid: _this.uuid,