Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions socos/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,24 @@ def state(sonos):
"""Get the current state of a device / group"""
return sonos.get_current_transport_info()['current_transport_state']

@staticmethod
@add_command()
def night_mode(sonos, *args):
"""Change or show the night mode setting of a device
Accepted values: true, false
"""
def night_mode_str():
return "Night mode: {}".format(sonos.night_mode)

if sonos.night_mode is None:
return "Speaker has no night mode"

if not args:
return night_mode_str()

sonos.night_mode = args[0].lower() == 'true'
return night_mode_str()

@staticmethod
@add_command()
def player_name(sonos, *args):
Expand Down