Add a is_coordinator attribute to Sonos (#5556)

This commit is contained in:
Robbie Trencheny 2017-01-25 13:03:36 -08:00 committed by Alex Harvey
parent 9cad9c19f8
commit 7f5d6eb841

View File

@ -58,6 +58,8 @@ CONF_INTERFACE_ADDR = 'interface_addr'
# Service call validation schemas # Service call validation schemas
ATTR_SLEEP_TIME = 'sleep_time' ATTR_SLEEP_TIME = 'sleep_time'
ATTR_IS_COORDINATOR = 'is_coordinator'
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_ADVERTISE_ADDR): cv.string, vol.Optional(CONF_ADVERTISE_ADDR): cv.string,
vol.Optional(CONF_INTERFACE_ADDR): cv.string, vol.Optional(CONF_INTERFACE_ADDR): cv.string,
@ -973,3 +975,8 @@ class SonosDevice(MediaPlayerDevice):
def clear_sleep_timer(self): def clear_sleep_timer(self):
"""Clear the timer on the player.""" """Clear the timer on the player."""
self._player.set_sleep_timer(None) self._player.set_sleep_timer(None)
@property
def device_state_attributes(self):
"""Return device specific state attributes."""
return {ATTR_IS_COORDINATOR: self.is_coordinator}