def test_volume_services(self): assert mp.setup(self.hass, {'media_player': {'platform': 'demo'}}) state = self.hass.states.get(entity_id) assert 1.0 == state.attributes.get('volume_level') mp.set_volume_level(self.hass, 0.5, entity_id) self.hass.pool.block_till_done() state = self.hass.states.get(entity_id) assert 0.5 == state.attributes.get('volume_level') mp.volume_down(self.hass, entity_id) self.hass.pool.block_till_done() state = self.hass.states.get(entity_id) assert 0.4 == state.attributes.get('volume_level') mp.volume_up(self.hass, entity_id) self.hass.pool.block_till_done() state = self.hass.states.get(entity_id) assert 0.5 == state.attributes.get('volume_level') assert False is state.attributes.get('is_volume_muted') mp.mute_volume(self.hass, True, entity_id) self.hass.pool.block_till_done() state = self.hass.states.get(entity_id) assert True is state.attributes.get('is_volume_muted')
def test_volume_services(self): assert mp.setup(self.hass, {"media_player": {"platform": "demo"}}) state = self.hass.states.get(entity_id) assert 1.0 == state.attributes.get("volume_level") mp.set_volume_level(self.hass, 0.5, entity_id) self.hass.pool.block_till_done() state = self.hass.states.get(entity_id) assert 0.5 == state.attributes.get("volume_level") mp.volume_down(self.hass, entity_id) self.hass.pool.block_till_done() state = self.hass.states.get(entity_id) assert 0.4 == state.attributes.get("volume_level") mp.volume_up(self.hass, entity_id) self.hass.pool.block_till_done() state = self.hass.states.get(entity_id) assert 0.5 == state.attributes.get("volume_level") assert False is state.attributes.get("is_volume_muted") mp.mute_volume(self.hass, True, entity_id) self.hass.pool.block_till_done() state = self.hass.states.get(entity_id) assert True is state.attributes.get("is_volume_muted")
def test_volume_services(self): """Test the volume service.""" assert setup_component(self.hass, mp.DOMAIN, {'media_player': { 'platform': 'demo' }}) state = self.hass.states.get(entity_id) print(state) assert 1.0 == state.attributes.get('volume_level') mp.set_volume_level(self.hass, None, entity_id) self.hass.block_till_done() state = self.hass.states.get(entity_id) assert 1.0 == state.attributes.get('volume_level') mp.set_volume_level(self.hass, 0.5, entity_id) self.hass.block_till_done() state = self.hass.states.get(entity_id) assert 0.5 == state.attributes.get('volume_level') mp.volume_down(self.hass, entity_id) self.hass.block_till_done() state = self.hass.states.get(entity_id) assert 0.4 == state.attributes.get('volume_level') mp.volume_up(self.hass, entity_id) self.hass.block_till_done() state = self.hass.states.get(entity_id) assert 0.5 == state.attributes.get('volume_level') assert False is state.attributes.get('is_volume_muted') mp.mute_volume(self.hass, None, entity_id) self.hass.block_till_done() state = self.hass.states.get(entity_id) assert False is state.attributes.get('is_volume_muted') mp.mute_volume(self.hass, True, entity_id) self.hass.block_till_done() state = self.hass.states.get(entity_id) assert True is state.attributes.get('is_volume_muted')
def test_volume_services(self): """Test the volume service.""" assert setup_component( self.hass, mp.DOMAIN, {'media_player': {'platform': 'demo'}}) state = self.hass.states.get(entity_id) print(state) assert 1.0 == state.attributes.get('volume_level') mp.set_volume_level(self.hass, None, entity_id) self.hass.block_till_done() state = self.hass.states.get(entity_id) assert 1.0 == state.attributes.get('volume_level') mp.set_volume_level(self.hass, 0.5, entity_id) self.hass.block_till_done() state = self.hass.states.get(entity_id) assert 0.5 == state.attributes.get('volume_level') mp.volume_down(self.hass, entity_id) self.hass.block_till_done() state = self.hass.states.get(entity_id) assert 0.4 == state.attributes.get('volume_level') mp.volume_up(self.hass, entity_id) self.hass.block_till_done() state = self.hass.states.get(entity_id) assert 0.5 == state.attributes.get('volume_level') assert False is state.attributes.get('is_volume_muted') mp.mute_volume(self.hass, None, entity_id) self.hass.block_till_done() state = self.hass.states.get(entity_id) assert False is state.attributes.get('is_volume_muted') mp.mute_volume(self.hass, True, entity_id) self.hass.block_till_done() state = self.hass.states.get(entity_id) assert True is state.attributes.get('is_volume_muted')