Add turn_on/turn_off/toggle support
- Add API_TURN_ON, API_TURN_OFF, API_TOGGLE constants - Add turn_on(), turn_off(), toggle() methods to MediaServerClient - Implement async_turn_on, async_turn_off, async_toggle in media player - Add TURN_ON and TURN_OFF to supported features - Update README with turn on/off/toggle documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,9 @@ from .const import (
|
||||
API_VOLUME,
|
||||
API_MUTE,
|
||||
API_SEEK,
|
||||
API_TURN_ON,
|
||||
API_TURN_OFF,
|
||||
API_TOGGLE,
|
||||
API_SCRIPTS_LIST,
|
||||
API_SCRIPTS_EXECUTE,
|
||||
)
|
||||
@@ -245,6 +248,30 @@ class MediaServerClient:
|
||||
"""
|
||||
return await self._request("POST", API_SEEK, {"position": position})
|
||||
|
||||
async def turn_on(self) -> dict[str, Any]:
|
||||
"""Send turn on command.
|
||||
|
||||
Returns:
|
||||
Response data
|
||||
"""
|
||||
return await self._request("POST", API_TURN_ON)
|
||||
|
||||
async def turn_off(self) -> dict[str, Any]:
|
||||
"""Send turn off command.
|
||||
|
||||
Returns:
|
||||
Response data
|
||||
"""
|
||||
return await self._request("POST", API_TURN_OFF)
|
||||
|
||||
async def toggle(self) -> dict[str, Any]:
|
||||
"""Send toggle command.
|
||||
|
||||
Returns:
|
||||
Response data
|
||||
"""
|
||||
return await self._request("POST", API_TOGGLE)
|
||||
|
||||
async def list_scripts(self) -> list[dict[str, Any]]:
|
||||
"""List available scripts on the server.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user