diff --git a/custom_components/smartir/media_player.py b/custom_components/smartir/media_player.py index 278a8402..6d4a21b0 100644 --- a/custom_components/smartir/media_player.py +++ b/custom_components/smartir/media_player.py @@ -100,6 +100,7 @@ def __init__(self, hass, config, device_data): self._commands = device_data['commands'] self._state = STATE_OFF + self._is_volume_muted = None self._sources_list = [] self._source = None self._support_flags = 0 @@ -136,7 +137,7 @@ def __init__(self, hass, config, device_data): del self._commands['sources'][source] - #Sources list + # Sources list for key in self._commands['sources']: self._sources_list.append(key) @@ -194,6 +195,10 @@ def media_content_type(self): """Content type of current playing media.""" return MEDIA_TYPE_CHANNEL + @property + def is_volume_muted(self): + return self._is_volume_muted + @property def source_list(self): return self._sources_list @@ -225,6 +230,7 @@ async def async_turn_off(self): if self._power_sensor is None: self._state = STATE_OFF self._source = None + self._is_volume_muted = None self.async_write_ha_state() async def async_turn_on(self): @@ -257,6 +263,7 @@ async def async_volume_up(self): async def async_mute_volume(self, mute): """Mute the volume.""" + self._is_volume_muted = mute await self.send_command(self._commands['mute']) self.async_write_ha_state() @@ -300,5 +307,6 @@ async def async_update(self): if power_state.state == STATE_OFF: self._state = STATE_OFF self._source = None + self._is_volume_muted = None elif power_state.state == STATE_ON: self._state = STATE_ON