From 682e3460e068438d98aeddd7d1184e1c950f0c6b Mon Sep 17 00:00:00 2001 From: Jon Maddox Date: Thu, 21 Jan 2016 17:45:30 -0500 Subject: [PATCH] use custom material icons to represent speaker state --- .../components/media_player/itunes.py | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/homeassistant/components/media_player/itunes.py b/homeassistant/components/media_player/itunes.py index 7bd5f9b928e..94ca5166ef6 100644 --- a/homeassistant/components/media_player/itunes.py +++ b/homeassistant/components/media_player/itunes.py @@ -383,6 +383,14 @@ class AirPlayDevice(MediaPlayerDevice): """ Returns the name of the device. """ 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 def state(self): """ Returns the state of the device. """ @@ -408,23 +416,6 @@ class AirPlayDevice(MediaPlayerDevice): """ Flags of media commands that are supported. """ 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): """ set volume level, range 0..1. """ volume = int(volume * 100)