mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Removed dependencies property from universal media player
The dependencies property was only being called once by the __init__ method so it was removed and the code was moved to the __init__ method. The tests were updated to reflect this.
This commit is contained in:
parent
12da6f531e
commit
07953fb7e3
@ -146,7 +146,11 @@ class UniversalMediaPlayer(MediaPlayerDevice):
|
||||
self._attrs = attributes
|
||||
self._child_state = None
|
||||
|
||||
track_state_change(hass, self.dependencies, self.update_state)
|
||||
depend = copy(children)
|
||||
for entity in attributes.values():
|
||||
depend.append(entity[0])
|
||||
|
||||
track_state_change(hass, depend, self.update_state)
|
||||
|
||||
def _entity_lkp(self, entity_id=None, state_attr=None):
|
||||
""" Looks up an entity state from hass """
|
||||
@ -196,14 +200,6 @@ class UniversalMediaPlayer(MediaPlayerDevice):
|
||||
""" Indicates whether HA should poll for updates """
|
||||
return False
|
||||
|
||||
@property
|
||||
def dependencies(self):
|
||||
""" List of entity ids of entities that the mp depends on for state """
|
||||
depend = copy(self._children)
|
||||
for entity in self._attrs.values():
|
||||
depend.append(entity[0])
|
||||
return depend
|
||||
|
||||
@property
|
||||
def master_state(self):
|
||||
""" gets the master state from entity or none """
|
||||
|
@ -135,23 +135,6 @@ class TestMediaPlayer(unittest.TestCase):
|
||||
self.assertTrue(response)
|
||||
self.assertEqual(config_start, self.config_children_and_attr)
|
||||
|
||||
def test_dependencies(self):
|
||||
""" test dependencies property """
|
||||
config = self.config_children_and_attr
|
||||
universal.validate_config(config)
|
||||
|
||||
ump = universal.UniversalMediaPlayer(self.hass, **config)
|
||||
|
||||
depend = ump.dependencies
|
||||
depend.sort()
|
||||
|
||||
check_depend = [media_player.ENTITY_ID_FORMAT.format('mock1'),
|
||||
media_player.ENTITY_ID_FORMAT.format('mock2'),
|
||||
self.mock_mute_switch_id, self.mock_state_switch_id]
|
||||
check_depend.sort()
|
||||
|
||||
self.assertEqual(depend, check_depend)
|
||||
|
||||
def test_master_state(self):
|
||||
""" test master state property """
|
||||
config = self.config_children_only
|
||||
|
Loading…
x
Reference in New Issue
Block a user