This commit is contained in:
e2002
2023-02-21 18:40:11 +03:00
parent f390872d6a
commit fb26dbbf14
5 changed files with 34 additions and 5 deletions

View File

@@ -39,7 +39,8 @@ from homeassistant.const import (
CONF_NAME,
STATE_IDLE,
STATE_PLAYING,
STATE_OFF
STATE_OFF,
STATE_ON,
)
SUPPORT_YORADIO = SUPPORT_PAUSE | SUPPORT_PLAY | SUPPORT_STOP |\
@@ -264,4 +265,12 @@ class yoradioDevice(MediaPlayerEntity):
async def async_media_pause(self):
await self.api.set_command("stop")
self._state = STATE_IDLE
async def async_turn_off(self):
await self.api.set_command("turnoff")
self._state = STATE_OFF
async def async_turn_on(self, **kwargs):
await self.api.set_command("turnon")
self._state = STATE_ON