Files
musicmouse/python-backend/musicmouse/reactions/status.py
Martin Bauer 747c390303 Add IR remote control (LIRC) with a number-key content mapping
Adds a TCP client for lircd's classic protocol: play/pause/next/prev/
volume/mute map to the same intents every other front-end already
emits, and number keys 0-9 play an assigned album/audiobook from the
start or a podcast show's newest episode, resolved fresh on every
press. The mapping is configured in config.yml and editable from the
frontend: a small "Taste zuweisen" button on the play screen (or the
A+digit keyboard shortcut) opens a 10-key picker to assign whatever is
currently playing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-11 08:31:28 +02:00

21 lines
711 B
Python

"""Remembering which links are up.
The firmware's state is readable straight off the transport, but a broker's is not:
:class:`~musicmouse.services.mqtt.service.MqttService` announces it and then forgets.
A front-end that wants to show a connection dot needs somewhere to read it from.
"""
from __future__ import annotations
from musicmouse.app import App
from musicmouse.events import ConnectionChanged
from musicmouse.reactions.registry import on
@on(ConnectionChanged)
def connection_changed(event: ConnectionChanged, app: App) -> None:
if event.target == "mqtt":
app.state.mqtt_connected = event.connected
elif event.target == "lirc":
app.state.lirc_connected = event.connected