jishi / node-sonos-http-api

An HTTP API bridge for Sonos easing automation. Hostable on any node.js capable device, like a raspberry pi or similar.
http://jishi.github.io/node-sonos-http-api/
MIT License
1.83k stars 462 forks source link

Feature Request: add Toggle for NightMode ans SpeechEnhancement #813

Closed Olivier6767 closed 2 years ago

Olivier6767 commented 2 years ago

Would it be possible to add Toggle functions for NightMode and SpeechEnhancement? This would allow to use only 1 button on remotes (Logitech Harmony) to toggle these functions On or Off. The Sonos App also controls these functions using Toggle.

Thanks!

jishi commented 2 years ago

The players already track the state of these settings in the underlying lib: https://github.com/jishi/node-sonos-discovery/blob/master/lib/models/Player.js#L401-L407

So it would be a matter of adding new actions preferably in this file: https://github.com/jishi/node-sonos-http-api/blob/master/lib/actions/equalizer.js

with two new actions that checks the state and sets the value depending on that, similar to how it's done here:

https://github.com/jishi/node-sonos-http-api/blob/master/lib/actions/playpause.js#L2-L8