diff --git a/homeassistant/components/universal/media_player.py b/homeassistant/components/universal/media_player.py index a2981852dc1..0ebd9eaf890 100644 --- a/homeassistant/components/universal/media_player.py +++ b/homeassistant/components/universal/media_player.py @@ -612,7 +612,11 @@ class UniversalMediaPlayer(MediaPlayerEntity): async def async_toggle(self): """Toggle the power on the media player.""" - await self._async_call_service(SERVICE_TOGGLE, allow_override=True) + if SERVICE_TOGGLE in self._cmds: + await self._async_call_service(SERVICE_TOGGLE, allow_override=True) + else: + # Delegate to turn_on or turn_off by default + await super().async_toggle() async def async_update(self): """Update state in HA.""" diff --git a/tests/components/universal/test_media_player.py b/tests/components/universal/test_media_player.py index 54617a61348..737d37052c2 100644 --- a/tests/components/universal/test_media_player.py +++ b/tests/components/universal/test_media_player.py @@ -998,7 +998,8 @@ class TestMediaPlayer(unittest.TestCase): assert len(self.mock_mp_2.service_calls["shuffle_set"]) == 1 asyncio.run_coroutine_threadsafe(ump.async_toggle(), self.hass.loop).result() - assert len(self.mock_mp_2.service_calls["toggle"]) == 1 + # Delegate to turn_off + assert len(self.mock_mp_2.service_calls["turn_off"]) == 2 def test_service_call_to_command(self): """Test service call to command."""