Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds is_volume_muted property #910

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
10 changes: 9 additions & 1 deletion custom_components/smartir/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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
Loading