play/pause
Deploy HEOS panel / deploy (push) Successful in 24s

This commit is contained in:
2026-09-15 01:03:25 +02:00
parent d2d7677519
commit dc7f09052d
9 changed files with 160 additions and 8 deletions
+12 -1
View File
@@ -49,6 +49,7 @@ class DemoController:
self.avr = _FakeAvr(cfg.AVR_INPUT_CODES)
self.heos = None
self._volume = {key: 22 + 7 * i for i, key in enumerate(cfg.TARGETS)}
self._play = {key: "play" for key in cfg.TARGETS}
self._joined = set()
# -- what the UI uses ---------------------------------------------
@@ -57,7 +58,8 @@ class DemoController:
"host": {"key": self.cfg.HOST_KEY, "label": self.cfg.TARGETS[self.cfg.HOST_KEY]["label"]},
"rooms": [
{"key": key, "label": self.cfg.TARGETS[key]["label"], "available": True,
"grouped": key in self._joined, "volume": self._volume[key], "error": None}
"grouped": key in self._joined, "volume": self._volume[key],
"play_state": self._play[key], "error": None}
for key in self.cfg.ROOM_KEYS
],
"avr": {"connected": True, "inputs": self.avr.inputs(), "input": self.avr.current_input()},
@@ -82,6 +84,15 @@ class DemoController:
def toggle_mute(self, key):
return None
def get_play_state(self, key):
return self._play[key]
def toggle_play(self, key, state=None):
if state is None:
state = "pause" if self._play[key] == "play" else "play"
self._play[key] = state
return state
def join(self, key):
self._joined.add(key)
return self.joined_keys()