diff --git a/API.md b/API.md index ef3dd67ee..db3487105 100644 --- a/API.md +++ b/API.md @@ -866,7 +866,7 @@ return: "card": [ { "name": "...", - "description": "...", + "driver": "...", "profiles": [ { "name": "...", diff --git a/home-assistant-polymer b/home-assistant-polymer index 6b1e5a525..8518f774d 160000 --- a/home-assistant-polymer +++ b/home-assistant-polymer @@ -1 +1 @@ -Subproject commit 6b1e5a525f7dac6867af8dd937100ce402aedac9 +Subproject commit 8518f774d44d4b9cd7e9b824dc9e9372e665347d diff --git a/requirements.txt b/requirements.txt index 55b385836..8240faf3f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ gitpython==3.1.0 jinja2==2.11.1 packaging==20.1 ptvsd==4.3.2 -pulsectl==20.2.2 +pulsectl==20.2.4 pytz==2019.3 pyudev==0.22.0 ruamel.yaml==0.15.100 diff --git a/supervisor/host/sound.py b/supervisor/host/sound.py index 1f8dc7855..a77c1eea3 100644 --- a/supervisor/host/sound.py +++ b/supervisor/host/sound.py @@ -45,7 +45,7 @@ class SoundCard: """Represent a Sound Card.""" name: str = attr.ib() - description: str = attr.ib() + driver: str = attr.ib() profiles: List[SoundProfile] = attr.ib() @@ -122,20 +122,8 @@ class SoundControl(CoreSysAttributes): """Set a profile to volume input/output.""" try: with Pulse(PULSE_NAME) as pulse: - - # Get card - select_card = None - for card in pulse.card_list(): - if card.name != card_name: - continue - select_card = card - break - - if not select_card: - raise PulseIndexError() - - # set profile - pulse.card_profile_set(select_card, profile_name) + card = pulse.get_sink_by_name(card_name) + pulse.card_profile_set(card, profile_name) except PulseIndexError: _LOGGER.error("Can't find %s profile %s", card_name, profile_name) @@ -201,7 +189,7 @@ class SoundControl(CoreSysAttributes): ) self._cards.append( - SoundCard(card.name, card.description, sound_profiles) + SoundCard(card.name, card.driver, sound_profiles) ) except PulseOperationFailed as err: