mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
use custom material icons to represent speaker state
This commit is contained in:
parent
71dbd10b39
commit
682e3460e0
@ -383,6 +383,14 @@ class AirPlayDevice(MediaPlayerDevice):
|
|||||||
""" Returns the name of the device. """
|
""" Returns the name of the device. """
|
||||||
return self.device_name
|
return self.device_name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def icon(self):
|
||||||
|
""" Icon to use in the frontend, if any. """
|
||||||
|
if self.selected is True:
|
||||||
|
return "mdi:volume-high"
|
||||||
|
else:
|
||||||
|
return "mdi:volume-off"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
""" Returns the state of the device. """
|
""" Returns the state of the device. """
|
||||||
@ -408,23 +416,6 @@ class AirPlayDevice(MediaPlayerDevice):
|
|||||||
""" Flags of media commands that are supported. """
|
""" Flags of media commands that are supported. """
|
||||||
return SUPPORT_AIRPLAY
|
return SUPPORT_AIRPLAY
|
||||||
|
|
||||||
@property
|
|
||||||
def device_state_attributes(self):
|
|
||||||
""" Return the state attributes. """
|
|
||||||
state_attr = {}
|
|
||||||
state_attr[ATTR_SUPPORTED_MEDIA_COMMANDS] = SUPPORT_AIRPLAY
|
|
||||||
|
|
||||||
if self.state == STATE_OFF:
|
|
||||||
state_attr[ATTR_ENTITY_PICTURE] = \
|
|
||||||
('https://cloud.githubusercontent.com/assets/260/9833073'
|
|
||||||
'/6eb5c906-5958-11e5-9b4a-472cdf36be16.png')
|
|
||||||
else:
|
|
||||||
state_attr[ATTR_ENTITY_PICTURE] = \
|
|
||||||
('https://cloud.githubusercontent.com/assets/260/9833072'
|
|
||||||
'/6eb13cce-5958-11e5-996f-e2aaefbc9a24.png')
|
|
||||||
|
|
||||||
return state_attr
|
|
||||||
|
|
||||||
def set_volume_level(self, volume):
|
def set_volume_level(self, volume):
|
||||||
""" set volume level, range 0..1. """
|
""" set volume level, range 0..1. """
|
||||||
volume = int(volume * 100)
|
volume = int(volume * 100)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user