Control play/pause and next/prev track with buttons on media screens

This commit is contained in:
2024-05-16 16:16:22 +01:00
parent c7b0b99a25
commit d148cc0b02
2 changed files with 25 additions and 3 deletions

11
api.py
View File

@@ -70,6 +70,15 @@ class Api:
else: dir = "down"
self.__post(f"/api/services/media_player/volume_{dir}", {"entity_id": entity_id})
self.__post(f"/api/services/media_player/volume_{dir}", {"entity_id": entity_id})
def nextTrack(self, entity_id: str) -> None:
self.__post("/api/services/media_player/media_next_track", {"entity_id": entity_id})
def prevTrack(self, entity_id: str) -> None:
self.__post("/api/services/media_player/media_previous_track", {"entity_id": entity_id})
def playPause(self, entity_id: str) -> None:
self.__post("/api/services/media_player/media_play_pause", {"entity_id": entity_id})
def toggleLight(self, entity_id: str) -> None:
self.__post(f"/api/services/light/toggle", {"entity_id": entity_id})
self.__post("/api/services/light/toggle", {"entity_id": entity_id})