Skip to content

Commit

Permalink
Merge pull request #226 from seb2010/bass_and_treble_control
Browse files Browse the repository at this point in the history
added bass and treble control
  • Loading branch information
Apollon77 authored Apr 21, 2024
2 parents 2c7b98f + 8ddb3c0 commit 890a417
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 890a417

Please sign in to comment.